/* ============================================
   NIMBLEAI DESIGN TOKENS
   Source of truth  import FIRST in <head>
   Generated from ui-ux-pro-max skill
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Primitives */
  --nim-black:       #0A0C14;
  --nim-dark-900:    #0F1220;
  --nim-dark-800:    #141828;
  --nim-dark-700:    #1C2235;
  --nim-dark-600:    #252C42;
  --nim-dark-500:    #2E3850;
  --nim-gray-400:    #64748B;
  --nim-gray-300:    #94A3B8;
  --nim-gray-200:    #CBD5E1;
  --nim-gray-100:    #E2E8F0;
  --nim-white:       #F8FAFC;
  --nim-pink-600:    #DB2777;
  --nim-pink-500:    #EC4899;
  --nim-pink-400:    #F472B6;
  --nim-blue-600:    #1D4ED8;
  --nim-blue-500:    #2563EB;
  --nim-blue-400:    #3B82F6;
  --nim-green-500:   #10B981;
  --nim-red-500:     #EF4444;
  --nim-amber-500:   #F59E0B;

  /* Semantic  Backgrounds */
  --color-bg:              var(--nim-black);
  --color-surface:         var(--nim-dark-800);
  --color-surface-raised:  var(--nim-dark-700);
  --color-surface-hover:   var(--nim-dark-600);
  --color-sidebar:         var(--nim-dark-900);

  /* Semantic  Text */
  --color-text-primary:    var(--nim-white);
  --color-text-secondary:  var(--nim-gray-300);
  --color-text-muted:      var(--nim-gray-400);
  --color-text-disabled:   #3D4A63;
  --color-text-on-primary: #FFFFFF;

  /* Semantic  Brand */
  --color-primary:         var(--nim-pink-500);
  --color-primary-hover:   var(--nim-pink-600);
  --color-primary-subtle:  rgba(236, 72, 153, 0.12);
  --color-accent:          var(--nim-blue-500);
  --color-accent-hover:    var(--nim-blue-600);
  --color-accent-subtle:   rgba(37, 99, 235, 0.12);

  /* Semantic  Feedback */
  --color-success:         var(--nim-green-500);
  --color-success-subtle:  rgba(16, 185, 129, 0.12);
  --color-error:           var(--nim-red-500);
  --color-error-subtle:    rgba(239, 68, 68, 0.12);
  --color-warning:         var(--nim-amber-500);
  --color-warning-subtle:  rgba(245, 158, 11, 0.12);

  /* Semantic  Borders */
  --color-border:          rgba(255, 255, 255, 0.08);
  --color-border-strong:   rgba(255, 255, 255, 0.16);
  --color-border-primary:  rgba(236, 72, 153, 0.40);

  /* Focus */
  --color-ring:   var(--nim-pink-500);
  --ring-offset:  var(--nim-dark-800);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;
  --text-3xl:  36px;
  --text-4xl:  48px;
  --leading-tight:   1.25;
  --leading-snug:    1.375;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --sidebar-width:       240px;
  --content-max-width:   1200px;
  --panel-padding:       var(--space-6);

  /* Border Radius */
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:       0 1px 2px rgba(0,0,0,0.40);
  --shadow-md:       0 4px 12px rgba(0,0,0,0.50);
  --shadow-lg:       0 8px 24px rgba(0,0,0,0.60);
  --shadow-xl:       0 16px 48px rgba(0,0,0,0.70);
  --shadow-primary:  0 0 20px rgba(236, 72, 153, 0.25);
  --shadow-accent:   0 0 20px rgba(37, 99, 235, 0.20);
  --ring-focus:      0 0 0 2px var(--ring-offset), 0 0 0 4px var(--color-ring);

  /* Animation */
  --duration-fast:   100ms;
  --duration-base:   200ms;
  --duration-slow:   300ms;
  --duration-enter:  250ms;
  --duration-exit:   150ms;
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --ease-inout:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-base:     0;
  --z-raised:   10;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;
}

/* Light mode override */
[data-theme="light"] {
  --color-bg:              #F5F3FF;
  --color-surface:         #FFFFFF;
  --color-surface-raised:  #F8FAFC;
  --color-surface-hover:   #F1F5F9;
  --color-sidebar:         #EDE9FE;
  --color-text-primary:    #1E1B4B;
  --color-text-secondary:  #475569;
  --color-text-muted:      #94A3B8;
  --color-text-disabled:   #CBD5E1;
  --color-border:          rgba(0, 0, 0, 0.08);
  --color-border-strong:   rgba(0, 0, 0, 0.16);
  --ring-offset:           #FFFFFF;
}

/* Base reset */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer; border: none;
  transition: background var(--duration-base) var(--ease-out),
              transform  var(--duration-fast)  var(--ease-spring),
              box-shadow var(--duration-base)  var(--ease-out);
  user-select: none; white-space: nowrap; text-decoration: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring-focus); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-accent  { background: var(--color-accent); color: #fff; box-shadow: var(--shadow-accent); }
.btn-accent:hover { background: var(--color-accent-hover); }
.btn-ghost   { background: transparent; color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.btn-ghost:hover { background: var(--color-surface-hover); color: var(--color-text-primary); border-color: var(--color-border-strong); }
.btn-danger  { background: var(--color-error); color: #fff; }
.btn-danger:hover { background: #DC2626; }

.btn-sm { min-height: 36px; padding: var(--space-1) var(--space-3); font-size: var(--text-sm); }
.btn-lg { min-height: 52px; padding: var(--space-3) var(--space-8); font-size: var(--text-md); }
.btn-icon { padding: var(--space-2); min-width: 44px; }

.btn.loading { position: relative; color: transparent; }
.btn.loading::after {
  content: ''; position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: nim-spin 0.6s linear infinite;
}
@keyframes nim-spin { to { transform: rotate(360deg); } }

/* === INPUTS === */
.input {
  width: 100%; min-height: 44px;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: max(16px, var(--text-base)); /* iOS Safari zoome le viewport si <16px au focus */
  color: var(--color-text-primary);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow   var(--duration-base) var(--ease-out);
  outline: none;
}
.input::placeholder { color: var(--color-text-muted); }
.input:hover  { border-color: var(--color-border-strong); }
.input:focus  { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-subtle); }
.input.error  { border-color: var(--color-error); box-shadow: 0 0 0 3px var(--color-error-subtle); }
.input:disabled { opacity: 0.38; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-secondary); }
.field-label .required { color: var(--color-error); margin-left: 2px; }
.field-helper { font-size: var(--text-sm); color: var(--color-text-muted); }
.field-error  { font-size: var(--text-sm); color: var(--color-error); }

/* === CARDS === */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--panel-padding);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow   var(--duration-base) var(--ease-out);
}
.card-interactive { cursor: pointer; }
.card-interactive:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); transition: transform var(--duration-base) var(--ease-out); }
.card-interactive:active { transform: translateY(0); }

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2); border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: .03em; text-transform: uppercase;
}
.badge-primary { background: var(--color-primary-subtle); color: var(--nim-pink-400); }
.badge-accent  { background: var(--color-accent-subtle);  color: var(--nim-blue-400); }
.badge-success { background: var(--color-success-subtle); color: var(--nim-green-500); }
.badge-error   { background: var(--color-error-subtle);   color: var(--nim-red-500); }
.badge-warning { background: var(--color-warning-subtle); color: var(--nim-amber-500); }
.badge-muted   { background: var(--nim-dark-600);         color: var(--color-text-muted); }
.badge-premium { background: linear-gradient(135deg, var(--nim-pink-500), var(--nim-blue-500)); color: #fff; }

/* === SIDEBAR === */
.sidebar {
  width: min(var(--sidebar-width), 85vw);
  height: 100vh;   /* fallback */
  height: 100svh;
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  padding: var(--space-4) 0;
  position: fixed; left: 0; top: 0;
  overflow-y: auto; z-index: var(--z-sticky);
  transition: transform var(--duration-enter) var(--ease-out);
}
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  margin: 2px var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-base); font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  cursor: pointer; min-height: 44px;
  transition: background var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out);
  user-select: none; text-decoration: none;
}
.nav-item:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.nav-item.active { background: var(--color-primary-subtle); color: var(--nim-pink-400); font-weight: var(--weight-semibold); }
.nav-item.locked { opacity: 0.5; cursor: not-allowed; }
.nav-section-label {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--color-text-muted); letter-spacing: .08em; text-transform: uppercase;
  padding: var(--space-4) var(--space-6) var(--space-2);
}

/* === PROGRESS === */
.progress-bar {
  width: 100%; height: 6px;
  background: var(--nim-dark-600);
  border-radius: var(--radius-full); overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-out);
}

/* === TOASTS === */
.toast {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-width: min(360px, calc(100vw - 32px));
  animation: nim-toast-in var(--duration-enter) var(--ease-out);
}
.toast-success { border-left: 3px solid var(--color-success); }
.toast-error   { border-left: 3px solid var(--color-error); }
.toast-warning { border-left: 3px solid var(--color-warning); }
@keyframes nim-toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* === EMPTY STATE === */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-16) var(--space-8); text-align: center; gap: var(--space-4);
}
.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
}

/* === SKELETON === */
.skeleton {
  background: linear-gradient(90deg, var(--nim-dark-700) 25%, var(--nim-dark-600) 50%, var(--nim-dark-700) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: nim-shimmer 1.5s infinite;
}
@keyframes nim-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === LAYOUT === */
.app-shell { display: flex; min-height: 100vh; min-height: 100svh; }
.main-content {
  margin-left: var(--sidebar-width); flex: 1;
  padding: var(--space-8) var(--space-10);
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-8);
}
.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}

/* === TYPE UTILITIES === */
.text-heading-lg  { font-size: var(--text-3xl); font-weight: var(--weight-bold); line-height: var(--leading-tight); }
.text-heading-md  { font-size: var(--text-xl);  font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.text-heading-sm  { font-size: var(--text-lg);  font-weight: var(--weight-semibold); }
.text-body        { font-size: var(--text-base); color: var(--color-text-secondary); line-height: var(--leading-relaxed); }
.text-label       { font-size: var(--text-sm);  font-weight: var(--weight-medium); }
.text-caption     { font-size: var(--text-xs);  color: var(--color-text-muted); letter-spacing: .02em; }
.text-mono        { font-family: var(--font-mono); font-size: var(--text-sm); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: var(--space-4); }
}

/* Safety net: this file's .btn also has white-space:nowrap with no mobile
   fallback (see styles.css/dashboard.css for the same fix) — kept in sync
   here in case this rule ever wins the cascade on a given page. */
@media (max-width: 640px) {
  .btn { white-space: normal; text-align: center; }
}
