/* ─────────────────────────────────────────────────────────────
   VARIABLES & RESET
───────────────────────────────────────────────────────────── */
:root {
  --primary:       #6C63FF;
  --primary-dark:  #5a52d5;
  --primary-light: #ede9ff;
  --accent:        #FF6584;
  --success:       #22c55e;
  --success-bg:    #dcfce7;
  --error:         #ef4444;
  --error-bg:      #fee2e2;
  --bg:            #0f0f1a;
  --surface:       #1a1a2e;
  --surface2:      #16213e;
  --border:        rgba(255,255,255,0.08);
  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --text-light:    #64748b;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-card:   0 2px 16px rgba(0,0,0,0.3);
  --transition:    .2s ease;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: var(--font); cursor: pointer; }

/* ─────────────────────────────────────────────────────────────
   SCROLLBAR
───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ─────────────────────────────────────────────────────────────
   NAVBAR
───────────────────────────────────────────────────────────── */
.navbar {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         0 2rem;
  height:          64px;
  background:      var(--surface);
  border-bottom:   1px solid var(--border);
  position:        sticky;
  top:             0;
  z-index:         100;
  backdrop-filter: blur(12px);
}

.navbar-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo     { font-size: 1.5rem; }
.nav-title    { font-size: 1rem; font-weight: 600; letter-spacing: .5px; }
.navbar-actions { display: flex; align-items: center; gap: 10px; }
.nav-user { font-size: .85rem; color: var(--text-muted); margin-right: 4px; }

/* ─────────────────────────────────────────────────────────────
   BOUTONS
───────────────────────────────────────────────────────────── */
.btn {
  display:        inline-flex;
  align-items:    center;
  gap:            6px;
  padding:        .55rem 1.1rem;
  border-radius:  var(--radius-sm);
  border:         none;
  font-size:      .875rem;
  font-weight:    500;
  cursor:         pointer;
  transition:     all var(--transition);
  white-space:    nowrap;
}

.btn-primary {
  background: var(--primary);
  color:      #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(108,99,255,.45); }

.btn-outline {
  background:  transparent;
  color:       var(--primary);
  border:      1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); color: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color:      var(--text-muted);
}
.btn-ghost:hover { color: var(--text); background: var(--border); }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-full { width: 100%; justify-content: center; padding: .75rem; }
.btn-sm   { padding: .4rem .8rem; font-size: .8rem; }
.btn-xs   { padding: .28rem .6rem; font-size: .75rem; }

/* ─────────────────────────────────────────────────────────────
   FORMULAIRES
───────────────────────────────────────────────────────────── */
.form-group  { display: flex; flex-direction: column; gap: 6px; }
.form-label  { font-size: .82rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }

.form-input {
  background:    rgba(255,255,255,.05);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text);
  padding:       .7rem 1rem;
  font-size:     .95rem;
  font-family:   var(--font);
  transition:    border-color var(--transition), box-shadow var(--transition);
  width:         100%;
}
.form-input::placeholder { color: var(--text-light); }
.form-input:focus {
  outline:      none;
  border-color: var(--primary);
  box-shadow:   0 0 0 3px rgba(108,99,255,.2);
}
.form-textarea { resize: vertical; min-height: 90px; }

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper .form-input { padding-left: 2.6rem; }
.input-icon {
  position:  absolute;
  left:      .85rem;
  font-size: 1rem;
  pointer-events: none;
}
.toggle-pass {
  position:   absolute;
  right:      .75rem;
  background: none;
  border:     none;
  font-size:  1rem;
  cursor:     pointer;
  color:      var(--text-muted);
  padding:    0;
}

/* ─────────────────────────────────────────────────────────────
   ALERTES
───────────────────────────────────────────────────────────── */
.alert {
  padding:       .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size:     .875rem;
  font-weight:   500;
  animation:     fadeIn .25s ease;
}
.alert-error   { background: var(--error-bg);   color: #991b1b; }
.alert-success { background: var(--success-bg); color: #166534; }

/* ─────────────────────────────────────────────────────────────
   PAGE LOGIN
───────────────────────────────────────────────────────────── */
.auth-body {
  display:         flex;
  align-items:     center;
  justify-content: center;
  min-height:      100vh;
  background:      var(--bg);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(108,99,255,.15) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(255,101,132,.1) 0%, transparent 50%);
}

.auth-container { width: 100%; max-width: 420px; padding: 1.5rem; }

.auth-card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: 20px;
  padding:       2.5rem;
  box-shadow:    var(--shadow);
}

.auth-logo   { text-align: center; margin-bottom: 2rem; }
.logo-icon   { font-size: 3rem; margin-bottom: .5rem; }
.auth-title  { font-size: 1.6rem; font-weight: 700; margin-bottom: .25rem; }
.auth-subtitle { color: var(--text-muted); font-size: .9rem; }

.auth-form { display: flex; flex-direction: column; gap: 1.2rem; }

/* ─────────────────────────────────────────────────────────────
   DASHBOARD
───────────────────────────────────────────────────────────── */
.app-body { display: flex; flex-direction: column; }

.dashboard-hero {
  text-align: center;
  padding:    3.5rem 1.5rem 2rem;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border-bottom: 1px solid var(--border);
}
.dashboard-hero h1 {
  font-size:   2rem;
  font-weight: 700;
  background:  linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dashboard-hero p { color: var(--text-muted); margin-top: .5rem; }

.dashboard-main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }

/* Filtres */
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-bottom: 2rem; }
.search-input {
  background:    rgba(255,255,255,.05);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  color:         var(--text);
  padding:       .6rem 1rem;
  font-size:     .9rem;
  font-family:   var(--font);
  flex:          1;
  min-width:     200px;
  transition:    border-color var(--transition);
}
.search-input::placeholder { color: var(--text-light); }
.search-input:focus { outline: none; border-color: var(--primary); }

.category-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding:       .35rem .85rem;
  border-radius: 20px;
  border:        1px solid var(--border);
  background:    transparent;
  color:         var(--text-muted);
  font-size:     .82rem;
  cursor:        pointer;
  transition:    all var(--transition);
}
.pill:hover, .pill.active {
  background:    var(--primary);
  border-color:  var(--primary);
  color:         #fff;
}

/* Sections & Cartes */
.link-section { margin-bottom: 2.5rem; }
.section-title {
  font-size:    .78rem;
  font-weight:  600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color:        var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.cards-row {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap:                   1rem;
}

.link-card {
  display:        flex;
  align-items:    center;
  gap:            1rem;
  padding:        1.1rem 1.2rem;
  background:     var(--surface);
  border:         1px solid var(--border);
  border-radius:  var(--radius);
  transition:     all var(--transition);
  cursor:         pointer;
  text-decoration: none;
  color:          var(--text);
}
.link-card:hover {
  border-color: var(--primary);
  background:   var(--surface2);
  transform:    translateY(-3px);
  box-shadow:   var(--shadow-card);
}

.card-icon   { font-size: 2rem; flex-shrink: 0; width: 44px; text-align: center; }
.card-body   { flex: 1; min-width: 0; }
.card-title  { font-size: .95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc   { font-size: .8rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-domain { font-size: .72rem; color: var(--primary); margin-top: 4px; display: block; }
.card-arrow  { color: var(--text-muted); font-size: 1.1rem; flex-shrink: 0; transition: transform var(--transition); }
.link-card:hover .card-arrow { transform: translateX(4px); color: var(--primary); }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }

/* ─────────────────────────────────────────────────────────────
   ADMIN
───────────────────────────────────────────────────────────── */
.admin-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

.tabs {
  display:       flex;
  gap:           4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  flex-wrap:     wrap;
}
.tab {
  padding:      .6rem 1.2rem;
  border:       none;
  background:   transparent;
  color:        var(--text-muted);
  font-size:    .875rem;
  font-weight:  500;
  cursor:       pointer;
  border-bottom: 2px solid transparent;
  transition:   all var(--transition);
  margin-bottom: -1px;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-content h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 1.5rem; }

.section-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   1.2rem;
  flex-wrap:       wrap;
  gap:             .75rem;
}

/* Table */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

.data-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       .875rem;
}
.data-table th {
  background:     var(--surface2);
  color:          var(--text-muted);
  font-weight:    600;
  text-transform: uppercase;
  font-size:      .75rem;
  letter-spacing: .5px;
  padding:        .75rem 1rem;
  text-align:     left;
  border-bottom:  1px solid var(--border);
}
.data-table td {
  padding:        .75rem 1rem;
  border-bottom:  1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: rgba(255,255,255,.03); }

.table-link { color: var(--primary); word-break: break-all; font-size: .8rem; }
.table-link:hover { text-decoration: underline; }
.actions-cell { display: flex; gap: 6px; white-space: nowrap; }

.badge {
  display:       inline-block;
  padding:       .2rem .6rem;
  background:    var(--primary-light);
  color:         var(--primary);
  border-radius: 20px;
  font-size:     .75rem;
  font-weight:   600;
}

/* Admin form */
.admin-form { display: flex; flex-direction: column; gap: 1.2rem; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; padding-top: .5rem; }

/* ─────────────────────────────────────────────────────────────
   MODAL
───────────────────────────────────────────────────────────── */
.modal-overlay {
  position:        fixed;
  inset:           0;
  background:      rgba(0,0,0,.65);
  display:         flex;
  align-items:     center;
  justify-content: center;
  z-index:         1000;
  padding:         1rem;
  backdrop-filter: blur(4px);
  animation:       fadeIn .2s ease;
}
.modal {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: 16px;
  padding:       1.75rem;
  width:         100%;
  max-width:     560px;
  max-height:    90vh;
  overflow-y:    auto;
}
.modal-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   1.5rem;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  background: none;
  border:     none;
  color:      var(--text-muted);
  font-size:  1.2rem;
  cursor:     pointer;
  padding:    .2rem .4rem;
  border-radius: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

/* ─────────────────────────────────────────────────────────────
   UTILITAIRES
───────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .8rem; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .navbar { padding: 0 1rem; }
  .nav-title { display: none; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .dashboard-hero { padding: 2rem 1rem 1.5rem; }
  .dashboard-hero h1 { font-size: 1.5rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .cards-row { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }
  .tabs      { gap: 0; }
  .tab       { padding: .5rem .75rem; font-size: .8rem; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }
}
