/* ui/static/sbix/shell.css
   ─────────────────────────────────────────────────────────────────────────────
   🎨 Design system SBIX — harmonisé avec la landing principale
   ✅ Variables, composants et interactions cohérents entre tous les dashboards
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  /* Palette principale - identique à la landing */
  --bg: #ffffff;
  --ink: #0a1628;
  --mut: #475569;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --stroke: #e5e7eb;
  --soft: #f8fafc;

  /* Accents SBIX - cohérents avec la landing */
  --acc1: #7bd3ff;
  --acc2: #00f0dc;
  --acc3: #0a1628;
  --link: #7bd3ff;
  --linkh: #00f0dc;

  /* Status */
  --ok: #00f0dc;
  --warn: #f59e0b;
  --err: #ef4444;

  /* Backgrounds contextuels */
  --success-bg: rgba(0, 240, 220, 0.12);
  --success-bd: rgba(0, 240, 220, 0.3);
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-bd: rgba(245, 158, 11, 0.3);
  --error-bg: rgba(239, 68, 68, 0.12);
  --error-bd: rgba(239, 68, 68, 0.3);

  /* Shadows - identiques à la landing */
  --shadow: 0 1px 3px rgba(10, 22, 40, 0.08), 0 1px 2px rgba(10, 22, 40, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(10, 22, 40, 0.12), 0 4px 6px -2px rgba(10, 22, 40, 0.06);
  --shadow-xl: 0 20px 25px -5px rgba(10, 22, 40, 0.15), 0 10px 10px -5px rgba(10, 22, 40, 0.04);

  /* Gradients - cohérents avec la landing */
  --grad-hero: linear-gradient(135deg, #0a1628 0%, #000814 100%);
  --grad-card: linear-gradient(135deg, rgba(0, 240, 220, 0.06) 0%, rgba(123, 211, 255, 0.08) 100%);
  --grad-mesh: conic-gradient(from 0deg at 50% 50%, #00f0dc, #7bd3ff, #0a1628, #00f0dc);

  /* Navigation */
  --nav-bg: rgba(255, 255, 255, 0.9);
  --nav-bd: rgba(123, 211, 255, 0.2);

  /* Variables système étendues */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  --transition: all 0.2s ease;
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.3s ease;
}

/* Thème sombre - cohérent avec la landing */
[data-theme="dark"] {
  --bg: #000814;
  --ink: #e6eaf0;
  --mut: #94a3b8;
  --panel: #0a1628;
  --panel-2: #0f1a2e;
  --stroke: #1a2332;
  --soft: #0d1524;
  --acc1: #7bd3ff;
  --acc2: #00f0dc;
  --acc3: #ffffff;
  --link: #7bd3ff;
  --linkh: #00f0dc;
  --nav-bg: rgba(10, 22, 40, 0.95);
  --nav-bd: rgba(0, 240, 220, 0.3);
  --grad-hero: linear-gradient(135deg, #00f0dc 0%, #7bd3ff 100%);
  --grad-card: linear-gradient(135deg, rgba(0, 240, 220, 0.12) 0%, rgba(123, 211, 255, 0.08) 100%);
  --shadow: 0 1px 3px rgba(0, 8, 20, 0.7), 0 1px 2px rgba(0, 8, 20, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 8, 20, 0.8), 0 4px 6px -2px rgba(0, 8, 20, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 8, 20, 0.9), 0 10px 10px -5px rgba(0, 8, 20, 0.7);
}

/* Reset et base - identique à la landing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  scroll-behavior: smooth;
}

/* Layout helpers */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.muted {
  color: var(--mut);
}

/* Cards - style landing avec backdrop-filter */
.card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.card:hover {
  box-shadow: 0 0 40px rgba(0, 240, 220, 0.15), var(--shadow-lg);
  transform: translateY(-4px);
  border-color: rgba(123, 211, 255, 0.3);
}

.card.grad {
  background: var(--grad-card);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(0, 240, 220, 0.2);
}

.card.feature {
  border: 2px solid rgba(123, 211, 255, 0.3);
  background: linear-gradient(var(--panel), var(--panel)) padding-box, 
              linear-gradient(135deg, #00f0dc, #7bd3ff) border-box;
}

/* Tags et badges - style landing */
.tag {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid rgba(123, 211, 255, 0.3);
  border-radius: var(--radius);
  background: var(--soft);
  font-weight: 700;
  font-size: 12px;
  backdrop-filter: blur(20px);
}

.badge {
  font-size: 0.8rem;
  border-radius: 999px;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--panel);
  border: 1px solid var(--stroke);
  color: var(--ink);
  display: inline-flex;
  gap: var(--spacing-xs);
  font-weight: 800;
  backdrop-filter: blur(20px);
}

.pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid rgba(123, 211, 255, 0.3);
  border-radius: 20px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  backdrop-filter: blur(20px);
  text-decoration: none;
  color: var(--ink);
}

.pill:hover {
  background: var(--soft);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(0, 240, 220, 0.2);
}

/* Buttons - style cohérent avec la landing */
.btn {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  text-decoration: none;
  font-family: inherit;
  font-size: 14px;
}

.btn:hover {
  background: var(--panel-2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--acc1);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--grad-hero);
  border: 1px solid rgba(0, 240, 220, 0.4);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.btn.primary:hover {
  box-shadow: 0 0 30px rgba(0, 240, 220, 0.3), var(--shadow-xl);
  transform: translateY(-3px);
}

.btn.primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 240, 220, 0.3) 0%, rgba(123, 211, 255, 0.2) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn.primary:hover::before {
  opacity: 1;
}

.btn.icon {
  padding: 10px 12px;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 10px 16px;
  font-size: 13px;
}

.btn-mini {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: var(--soft);
  border: 1px solid var(--stroke);
  color: var(--ink);
  font-weight: 800;
}

/* Chips - style harmonisé */
.chip {
  padding: 8px 14px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-family: inherit;
  font-size: 13px;
  backdrop-filter: blur(20px);
}

.chip:hover {
  border-color: rgba(123, 211, 255, 0.5);
  box-shadow: 0 0 20px rgba(0, 240, 220, 0.15);
  transform: translateY(-1px);
}

.chip:focus-visible {
  outline: 2px solid var(--acc1);
  outline-offset: 2px;
}

.chip.active {
  background: var(--grad-hero);
  color: #ffffff;
  border-color: rgba(0, 240, 220, 0.4);
}

.chip.theme-btn {
  font-size: 16px;
  min-width: 40px;
  justify-content: center;
}

/* Navigation - style identique à la landing */
.appnav {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: saturate(130%) blur(20px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-bd);
}

.appnav .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  gap: 12px;
}

.appnav .brand {
  display: flex;
  align-items: center;
  gap: var(--spacing);
  text-decoration: none;
  font-weight: 900;
  transition: var(--transition);
}

.appnav .brand:hover {
  transform: scale(1.02);
}

.appnav .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.appnav .nav-link {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
  color: var(--ink);
}

.appnav .nav-link:hover {
  background: var(--soft);
  transform: translateY(-1px);
}

.appnav .nav-link.active {
  background: var(--soft);
  border: 1px solid var(--stroke);
}

.appnav .controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

/* API box */
.api-box {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px);
}

.api-input {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 12px;
  min-width: 180px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.api-input:focus {
  box-shadow: 0 0 0 2px rgba(0, 240, 220, 0.2);
}

/* Notifications & Profile - style cohérent */
.badge-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--err);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .badge-dot {
  box-shadow: 0 0 0 3px rgba(10, 22, 40, 0.6);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--grad-hero);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #001014;
  font-weight: 800;
  font-size: 13px;
}

/* Panneau de notifications */
.panel {
  position: fixed;
  top: 64px;
  right: 16px;
  width: 360px;
  max-width: calc(100% - 32px);
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  display: none;
  z-index: 80;
  backdrop-filter: blur(20px);
}

.panel.show {
  display: block;
  animation: panelSlideIn 0.3s ease;
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  font-weight: 800;
}

.panel .list {
  max-height: 60vh;
  overflow: auto;
}

.notif {
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  transition: var(--transition);
}

.notif:hover {
  background: var(--soft);
}

.notif:last-child {
  border-bottom: none;
}

.notif .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.notif small {
  color: var(--mut);
  font-size: 11px;
}

.empty {
  padding: 20px;
  text-align: center;
  color: var(--mut);
  font-style: italic;
}

/* Menu profil */
.menu {
  position: fixed;
  top: 64px;
  right: 16px;
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  display: none;
  z-index: 80;
  backdrop-filter: blur(20px);
}

.menu.show {
  display: block;
  animation: panelSlideIn 0.3s ease;
}

.menu a,
.menu button {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  font-family: inherit;
}

.menu a:hover,
.menu button:hover {
  background: var(--soft);
}

.menu a:focus-visible,
.menu button:focus-visible {
  outline: 2px solid var(--acc1);
  outline-offset: -2px;
}

/* Status helpers */
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.ok { background: var(--ok); }
.warn { background: var(--warn); }
.err { background: var(--err); }

/* Animations cohérentes avec la landing */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }

/* Toast notifications */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  min-width: 280px;
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition-slow);
  backdrop-filter: blur(20px);
  z-index: 70;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Grilles et layouts */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.svc-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.metrics-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing);
}

/* Responsive design */
@media (max-width: 920px) {
  .container {
    padding: 0 var(--spacing);
  }
  
  .panel {
    top: 56px;
    right: 8px;
    width: calc(100% - 16px);
  }
  
  .menu {
    top: 56px;
    right: 8px;
  }
  
  .appnav .controls {
    gap: var(--spacing-xs);
  }
  
  .appnav .nav-links {
    gap: var(--spacing-xs);
  }
  
  .btn {
    padding: 12px 16px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .chip, .pill {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .btn {
    padding: 10px 14px;
    font-size: 12px;
  }
  
  .card {
    padding: var(--spacing);
  }
}

/* Préférence de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- SBIX Verify: compat alias + contrast fix (safe, drop-in) --- */
/* Aligne les variantes "dash" avec la convention "space" existante */
.btn-primary {
  background: var(--grad-hero);
  border: 1px solid rgba(0, 240, 220, 0.4);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.btn-primary:hover {
  box-shadow: 0 0 30px rgba(0, 240, 220, 0.3), var(--shadow-xl);
  transform: translateY(-3px);
}
.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,240,220,.3) 0%, rgba(123,211,255,.2) 100%);
  opacity: 0; transition: opacity .3s;
}
.btn-primary:hover::before { opacity: 1; }

/* Fix contraste: en clair → texte foncé ; en sombre → texte clair */
.btn-secondary {
  background: var(--panel);
  border: 1px solid var(--stroke);
  color: var(--ink);              /* corrige le "blanc sur blanc" */
}
.btn-secondary:hover {
  background: var(--soft);
  transform: translateY(-1px);
  border-color: var(--acc1);
}
/* En dark mode, texte clair si nécessaire */
[data-theme="dark"] .btn-secondary { color: #fff; }

/* Normalisation optionnelle (compat totale) */
.btn.secondary { /* alias neutre, .btn suffit */ }

/* Icônes dans les boutons héritent bien de la couleur de texte */
.btn svg, .btn [class*="icon"] { fill: currentColor; color: currentColor; }
