/* ==========================================
   AI Workspace — Brand Design System
   Classic Dark + Light + System-Follow Purple Theme
   Shared design tokens (extracted from the design spec).
   ========================================== */

:root {
  /* === Brand Colors === */
  --color-dark: #0f0f14;
  --color-light: #f8f9fc;
  --color-mid-gray: #8b8b9e;
  --color-light-gray: #e2e3eb;

  /* Primary Accent: Rich Purple */
  --color-primary: #8b5cf6;
  --color-primary-hover: #7c3aed;
  --color-primary-light: rgba(139, 92, 246, 0.10);
  --color-primary-dark: #6d28d9;

  /* Secondary Accent: Soft Indigo */
  --color-secondary: #a78bfa;
  --color-secondary-light: rgba(167, 139, 250, 0.10);
  --color-secondary-dark: #8b5cf6;

  /* Tertiary Accent: Cool Slate */
  --color-tertiary: #94a3b8;
  --color-tertiary-light: rgba(148, 163, 184, 0.10);

  /* === Semantic State Colors === */
  --state-success: #22c55e;
  --state-warning: #f59e0b;
  --state-error: #ef4444;
  --state-info: #3b82f6;

  /* === Surface & Depth === */
  --surface-bg: #f8f9fc;
  --surface-card: #ffffff;
  --surface-elevated: #ffffff;
  --surface-inset: #f1f2f6;
  --surface-hover: #f5f5fa;

  --border-default: #e2e3eb;
  --border-subtle: #eef0f6;
  --border-strong: #c8cad6;

  --shadow-static: 0 1px 3px rgba(15, 15, 20, 0.04);
  --shadow-elevated: 0 8px 24px rgba(15, 15, 20, 0.08);
  --shadow-float: 0 12px 32px rgba(15, 15, 20, 0.12);

  /* === Typography === */
  --font-heading: 'Inter', 'Poppins', 'Arial', sans-serif;
  --font-body: 'Inter', 'Poppins', 'Arial', sans-serif;

  --text-heading: #0f0f14;
  --text-body: #374151;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #f8f9fc;
  --text-link: #8b5cf6;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  --line-height-tight: 1.2;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* === Spacing === */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* === Radius === */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* === Transition === */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* === Layout === */
  --sidebar-width: 220px;
}

/* === Dark Mode (default per design) === */
.dark {
  --surface-bg: #0f0f14;
  --surface-card: #1a1a24;
  --surface-elevated: #22222e;
  --surface-inset: #141420;
  --surface-hover: #28283a;

  --border-default: #2e2e40;
  --border-subtle: #222234;
  --border-strong: #3e3e54;

  --text-heading: #f0f0f6;
  --text-body: #c8c8d8;
  --text-secondary: #9090a8;
  --text-muted: #606078;

  --shadow-static: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.45);

  --color-primary-light: rgba(139, 92, 246, 0.16);
  --color-secondary-light: rgba(167, 139, 250, 0.14);
  --color-tertiary-light: rgba(148, 163, 184, 0.12);

  --color-light-gray: #2a2a3c;
}

/* === Typography Classes === */
.heading-xl {
  font-family: var(--font-heading);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.heading-lg {
  font-family: var(--font-heading);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

.heading-md {
  font-family: var(--font-heading);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--text-heading);
}

.heading-sm {
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  color: var(--text-heading);
}

.body-text {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-body);
}

.body-sm {
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-body);
}

.caption {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.label {
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
}

/* === Active nav state === */
[data-active="true"] {
  background-color: var(--color-primary-light) !important;
  color: var(--color-primary) !important;
  font-weight: 600;
}

/* === Utility helpers === */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  background-color: currentColor;
}

/* ==========================================
   Multi-device adaptation (responsive layout)
   The design targets a desktop shell with a 220px fixed
   sidebar. Below the lg breakpoint we collapse the
   sidebar into an off-canvas drawer and reveal a
   hamburger button in the header.
   ========================================== */

/* Sidebar: hidden off-canvas on small screens, slides in when .is-open */
@media (max-width: 1023px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-float);
  }
  .app-sidebar.is-open {
    transform: translateX(0);
  }
  /* Main content takes full width on small screens */
  .app-main {
    margin-left: 0 !important;
  }
  /* Header gets a hamburger button on small screens */
  .menu-toggle { display: inline-flex !important; }
  /* Backdrop for the drawer */
  .app-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 20, 0.5);
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
  }
  .app-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (min-width: 1024px) {
  .menu-toggle { display: none !important; }
  .app-backdrop { display: none !important; }
  .app-sidebar { transform: none !important; }
}

/* Allow the header search to shrink gracefully on narrow viewports */
@media (max-width: 640px) {
  .header-search {
    margin: 0 !important;
    max-width: 100% !important;
  }
  .header-search input { font-size: 13px; }
  .header-page-title { font-size: 1rem !important; }
}

/* Notification dropdown */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background-color: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  z-index: 40;
  padding: 8px;
  display: none;
}
.notif-dropdown.is-open { display: block; }
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.notif-item:hover { background-color: var(--surface-hover); }

/* Filter tab active state (AI员工管理) */
.filter-tab[data-active="true"] {
  background-color: var(--surface-card) !important;
  color: var(--color-primary) !important;
  font-weight: 600 !important;
  box-shadow: var(--shadow-static) !important;
  border: 1px solid var(--border-default) !important;
}

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