/**
 * Work Suite - Core Style & Design System (2026 SaaS Edition)
 */

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

:root {
  /* Color Palette - Default Dark Theme */
  --bg-base: #090d16;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #151f38;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
  --accent-primary: var(--accent-cyan);
  --accent-glow: var(--accent-cyan-glow);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radii & Shadows */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 24px -4px var(--accent-cyan-glow);

  /* Layout dimensions */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 76px;
  --topbar-height: 68px;
  --transition-smooth: 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. Default Dark Theme (Midnight Navy) */
[data-theme="dark"] {
  --bg-base: #090d16;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #151f38;
  --bg-glass: rgba(15, 23, 42, 0.82);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
  --accent-primary: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.25);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* 2. Clean Light Theme (Modern Executive Studio) */
[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.90);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --accent-cyan: #0284c7;
  --accent-indigo: #4f46e5;
  --accent-purple: #9333ea;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  --accent-primary: #0284c7;
  --accent-glow: rgba(2, 132, 199, 0.18);

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

/* 3. Cyber Emerald / Mint Matrix */
[data-theme="emerald"] {
  --bg-base: #050d0a;
  --bg-surface: #0a1a14;
  --bg-surface-elevated: #112920;
  --bg-glass: rgba(10, 26, 20, 0.88);
  --border-subtle: rgba(16, 185, 129, 0.14);
  --border-strong: rgba(16, 185, 129, 0.28);

  --text-main: #ecfdf5;
  --text-muted: #a7f3d0;
  --text-dim: #34d399;

  --accent-cyan: #10b981;
  --accent-indigo: #059669;
  --accent-purple: #34d399;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --primary-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --accent-primary: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.32);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* 4. Cyberpunk Violet / Royal Amethyst */
[data-theme="violet"] {
  --bg-base: #0a0714;
  --bg-surface: #140e28;
  --bg-surface-elevated: #1e153c;
  --bg-glass: rgba(20, 14, 40, 0.88);
  --border-subtle: rgba(139, 92, 246, 0.15);
  --border-strong: rgba(139, 92, 246, 0.30);

  --text-main: #faf5ff;
  --text-muted: #ddd6fe;
  --text-dim: #a78bfa;

  --accent-cyan: #8b5cf6;
  --accent-indigo: #6366f1;
  --accent-purple: #c084fc;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #ec4899;
  --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  --accent-primary: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.32);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* 5. Sunset Amber / Warm Luxe */
[data-theme="amber"] {
  --bg-base: #0d0b08;
  --bg-surface: #1a140d;
  --bg-surface-elevated: #261e14;
  --bg-glass: rgba(26, 20, 13, 0.88);
  --border-subtle: rgba(245, 158, 11, 0.15);
  --border-strong: rgba(245, 158, 11, 0.30);

  --text-main: #fffbeb;
  --text-muted: #fde68a;
  --text-dim: #f59e0b;

  --accent-cyan: #f59e0b;
  --accent-indigo: #ea580c;
  --accent-purple: #fbbf24;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --primary-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --accent-primary: #f59e0b;
  --accent-glow: rgba(245, 158, 11, 0.32);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* 6. Nordic Slate / Glacier Frost */
[data-theme="nordic"] {
  --bg-base: #080e18;
  --bg-surface: #0e1a2b;
  --bg-surface-elevated: #15263d;
  --bg-glass: rgba(14, 26, 43, 0.88);
  --border-subtle: rgba(56, 189, 248, 0.15);
  --border-strong: rgba(56, 189, 248, 0.28);

  --text-main: #f0f9ff;
  --text-muted: #bae6fd;
  --text-dim: #38bdf8;

  --accent-cyan: #38bdf8;
  --accent-indigo: #0284c7;
  --accent-purple: #818cf8;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #f87171;
  --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  --accent-primary: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.30);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* Box Sizing & Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
}

/* App Layout Grid */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: width var(--transition-smooth);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo img {
  width: 36px;
  height: 36px;
}

.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-name {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 18px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 12px 14px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all var(--transition-smooth);
}

.nav-item:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(99, 102, 241, 0.12) 100%);
  color: var(--accent-cyan);
  font-weight: 600;
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.nav-badge.badge-accent {
  background: var(--accent-cyan);
  color: #090d16;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-smooth);
}

.user-snippet:hover {
  background: var(--bg-surface-elevated);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left var(--transition-smooth);
}

/* Top Navigation Bar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-heading {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  width: 240px;
}

.search-trigger-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
  box-shadow: 0 0 16px -2px rgba(6, 182, 212, 0.15);
}

.kbd-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Floating Topbar Active Timer Pill */
.topbar-timer-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.topbar-timer-pill:hover {
  background: rgba(6, 182, 212, 0.16);
  border-color: var(--accent-cyan);
}

.timer-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulseGlow 1.8s infinite;
}

.timer-pill-digits {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent-cyan);
}

.topbar-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-smooth);
}

.topbar-icon-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.unread-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-rose);
}

/* Content Container */
.content-body {
  flex: 1;
  padding: 28px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Mobile Sidebar Backdrop Overlay */
.mobile-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.mobile-sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-sidebar-close {
  display: none;
  position: absolute;
  top: 18px;
  right: 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-smooth);
}

.mobile-sidebar-close:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

/* Tablet and Mobile Breakpoints (<= 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 0px;
    --topbar-height: 60px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px !important;
    transform: translateX(-100%);
    z-index: 1000;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-sidebar-close {
    display: flex;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  #mobile-menu-btn {
    display: inline-flex !important;
  }

  .topbar {
    padding: 0 16px;
  }

  .content-body {
    padding: 20px 16px;
  }

  .search-trigger-btn {
    width: 170px;
  }

  .kbd-badge {
    display: none;
  }
}

/* Mobile Small Devices (<= 768px) */
@media (max-width: 768px) {
  .topbar {
    padding: 0 12px;
  }

  .topbar-left {
    gap: 8px;
  }

  .page-heading {
    font-size: 1rem;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .search-trigger-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
  }

  .search-trigger-btn span:first-child {
    font-size: 1rem;
    line-height: 1;
    overflow: hidden;
    width: 18px;
    white-space: nowrap;
  }

  .topbar-right {
    gap: 8px;
  }

  .topbar-timer-pill {
    padding: 4px 10px;
  }

  .topbar-timer-pill span:first-of-type {
    display: none;
  }

  .topbar-timer-digits {
    font-size: 0.8rem;
  }

  .topbar-icon-btn {
    width: 36px;
    height: 36px;
  }

  .content-body {
    padding: 14px 10px;
  }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
  .page-heading {
    display: none;
  }
  
  .topbar-right .btn-primary.btn-sm span {
    font-size: 0.8rem;
  }
}
