/* ============================================================
   DESIGN SYSTEM TOKENS — NexiBook / Insightful Booking
   Gold Premium DNA · Modern Layout · Mobile-First · Dual Theme
   ============================================================ */

/* --- Google Fonts are loaded in header.ejs --- */

:root {
  /* ============ COLOR PALETTE — NexiBook Gold DNA ============ */

  /* Primary — NexiBook Signature Gold */
  --color-primary: #FFD700;
  --color-primary-hover: #f0c050;
  --color-primary-light: rgba(255, 215, 0, 0.12);
  --color-primary-lighter: rgba(255, 215, 0, 0.06);
  --color-primary-rgb: 255, 215, 0;
  --color-primary-text: #111111;  /* Dark text on gold buttons for contrast */

  /* Gold Extended Palette */
  --color-gold: #FFD700;
  --color-gold-strong: #f0c050;
  --color-gold-warm: #f5c842;
  --color-gold-glow: rgba(255, 215, 0, 0.12);
  --color-gold-border: rgba(255, 215, 0, 0.3);

  /* Accent — Warm Amber (secondary CTAs, promotions) */
  --color-accent: #F59E0B;
  --color-accent-hover: #D97706;
  --color-accent-light: rgba(245, 158, 11, 0.12);
  --color-accent-rgb: 245, 158, 11;

  /* Neutrals — Warm tones */
  --color-text: #1F2937;
  --color-text-secondary: #6B7280;
  --color-text-muted: #9CA3AF;
  --color-text-inverse: #FFFFFF;

  /* Backgrounds — Light theme (warm off-white) */
  --color-bg: #FAFAF8;
  --color-bg-secondary: #F5F4F0;
  --color-bg-tertiary: #EDECE8;
  --color-bg-elevated: #FFFFFF;

  /* Borders */
  --color-border: #E5E4DF;
  --color-border-light: #F0EFE8;
  --color-border-focus: var(--color-primary);

  /* Glassmorphism — NexiBook Premium Effects */
  --glass-bg: rgba(200, 200, 240, 0.04);
  --glass-border: rgba(200, 200, 240, 0.16);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(12px);
  --glass-backdrop: saturate(140%) blur(8px);

  /* Gold Shadows — NexiBook Signature Glow */
  --shadow-gold: 0 10px 16px rgba(242, 195, 0, 0.12);
  --shadow-gold-hover: 0 16px 32px rgba(212, 175, 55, 0.18);
  --shadow-gold-glow: 0 0 20px rgba(255, 215, 0, 0.15);

  /* Status Colors */
  --color-success: #22C55E;
  --color-success-light: #DCFCE7;
  --color-success-rgb: 34, 197, 94;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-warning-rgb: 245, 158, 11;
  --color-error: #EF4444;
  --color-error-light: #FEE2E2;
  --color-error-rgb: 239, 68, 68;
  --color-info: #3B82F6;
  --color-info-light: #DBEAFE;
  --color-info-rgb: 59, 130, 246;

  /* Booking-specific */
  --color-available: #22C55E;
  --color-booked: #F59E0B;
  --color-full: #EF4444;
  --color-private: #8B5CF6;
  --color-group: #06B6D4;

  /* ============ TYPOGRAPHY ============ */

  /* Font Families */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Font Sizes — Modular Scale 1.25 */
  --text-2xs: 0.625rem;   /* 10px — tiny labels */
  --text-xs: 0.75rem;     /* 12px — captions, badges */
  --text-sm: 0.8125rem;   /* 13px — secondary text */
  --text-base: 0.9375rem; /* 15px — body (mobile-optimized) */
  --text-md: 1rem;        /* 16px — standard body */
  --text-lg: 1.125rem;    /* 18px — sub-headings */
  --text-xl: 1.25rem;     /* 20px — section headings */
  --text-2xl: 1.5rem;     /* 24px — page headings */
  --text-3xl: 1.875rem;   /* 30px — hero headings */
  --text-4xl: 2.25rem;    /* 36px — display */
  --text-5xl: 3rem;       /* 48px — large display */

  /* Font Weights */
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* ============ SPACING — 8px Grid ============ */

  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;  /* 2px */
  --space-1: 0.25rem;     /* 4px */
  --space-1-5: 0.375rem;  /* 6px */
  --space-2: 0.5rem;      /* 8px */
  --space-2-5: 0.625rem;  /* 10px */
  --space-3: 0.75rem;     /* 12px */
  --space-4: 1rem;        /* 16px */
  --space-5: 1.25rem;     /* 20px */
  --space-6: 1.5rem;      /* 24px */
  --space-8: 2rem;        /* 32px */
  --space-10: 2.5rem;     /* 40px */
  --space-12: 3rem;       /* 48px */
  --space-16: 4rem;       /* 64px */
  --space-20: 5rem;       /* 80px */
  --space-24: 6rem;       /* 96px */

  /* Page Padding */
  --page-padding: var(--space-4);         /* 16px mobile */
  --page-padding-desktop: var(--space-8); /* 32px desktop */
  --content-max-width: 1280px;

  /* ============ BORDER RADIUS ============ */

  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 20px;
  --radius-full: 9999px;

  /* ============ SHADOWS ============ */

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.04);

  /* Focus ring — Gold glow */
  --ring-width: 3px;
  --ring-color: rgba(255, 215, 0, 0.25);
  --ring-offset: 2px;

  /* ============ TRANSITIONS ============ */

  --transition-fast: 0.1s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ============ Z-INDEX SCALE ============ */

  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
  --z-top: 900;
  --z-bottom-nav: 1000;

  /* ============ LAYOUT ============ */

  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --bottom-nav-height: 64px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);

  /* ============ BREAKPOINTS (reference, use in @media) ============ */
  /* sm: 640px, md: 768px, lg: 1024px, xl: 1280px, 2xl: 1536px */
}


/* ============================================================
   DARK THEME OVERRIDES
   ============================================================ */

[data-theme="dark"] {
  /* Backgrounds — NexiBook Warm Indigo Charcoal */
  --color-bg: #12121a;
  --color-bg-secondary: #1a1a24;
  --color-bg-tertiary: #22222e;
  --color-bg-elevated: #1e1e2a;

  /* Text — Warm off-white */
  --color-text: #f0f0f5;
  --color-text-secondary: #b0b0be;
  --color-text-muted: #78788a;
  --color-text-inverse: #12121a;

  /* Borders — Subtle warm borders */
  --color-border: rgba(200, 200, 240, 0.15);
  --color-border-light: rgba(200, 200, 240, 0.08);

  /* Gold primary adjustments for dark */
  --color-primary-light: rgba(255, 215, 0, 0.12);

  /* Glassmorphism — Enhanced on dark */
  --glass-bg: rgba(200, 200, 240, 0.04);
  --glass-border: rgba(200, 200, 240, 0.16);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);

  /* Status — slightly desaturated for dark */
  --color-success-light: rgba(34, 197, 94, 0.15);
  --color-warning-light: rgba(245, 158, 11, 0.15);
  --color-error-light: rgba(239, 68, 68, 0.15);
  --color-info-light: rgba(59, 130, 246, 0.15);

  /* Shadows — Deeper + gold glow accents */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-gold: 0 10px 16px rgba(242, 195, 0, 0.15);
  --shadow-gold-hover: 0 16px 32px rgba(212, 175, 55, 0.22);
  --shadow-gold-glow: 0 0 30px rgba(255, 215, 0, 0.2);

  /* Focus ring — Gold glow on dark */
  --ring-color: rgba(255, 215, 0, 0.35);
}

/* System preference fallback (when no data-theme is set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #12121a;
    --color-bg-secondary: #1a1a24;
    --color-bg-tertiary: #22222e;
    --color-bg-elevated: #1e1e2a;
    --color-text: #f0f0f5;
    --color-text-secondary: #b0b0be;
    --color-text-muted: #78788a;
    --color-text-inverse: #12121a;
    --color-border: rgba(200, 200, 240, 0.15);
    --color-border-light: rgba(200, 200, 240, 0.08);
    --color-primary-light: rgba(255, 215, 0, 0.12);
    --color-success-light: rgba(34, 197, 94, 0.15);
    --color-warning-light: rgba(245, 158, 11, 0.15);
    --color-error-light: rgba(239, 68, 68, 0.15);
    --color-info-light: rgba(59, 130, 246, 0.15);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --ring-color: rgba(255, 215, 0, 0.35);
  }
}


/* ============================================================
   BASE RESET & GLOBALS
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

@media (min-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Focus visible */
:focus-visible {
  outline: var(--ring-width) solid var(--ring-color);
  outline-offset: var(--ring-offset);
  border-radius: var(--radius-lg);
}

/* Selection — Gold highlight */
::selection {
  background-color: rgba(255, 215, 0, 0.2);
  color: var(--color-text);
}

/* Scrollbar — subtle */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Hide scrollbar utility */
.hide-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */

.ds-container {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

@media (min-width: 768px) {
  .ds-container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .ds-container {
    padding: 0 var(--page-padding-desktop);
  }
}

/* Page wrapper — accounts for bottom nav on mobile */
.ds-page {
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-4));
}

@media (min-width: 768px) {
  .ds-page {
    padding-bottom: var(--space-8);
  }
}

/* Admin layout with sidebar */
.ds-admin-layout {
  display: flex;
  min-height: 100vh;
}

.ds-admin-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-6);
  overflow-x: hidden;
}

@media (max-width: 1023px) {
  .ds-admin-content {
    padding: var(--space-4);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--space-4));
  }
}

/* Grid system */
.ds-grid {
  display: grid;
  gap: var(--space-4);
}

.ds-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ds-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ds-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 767px) {
  .ds-grid-2,
  .ds-grid-3,
  .ds-grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .ds-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .ds-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Flex utilities */
.ds-flex { display: flex; }
.ds-flex-col { display: flex; flex-direction: column; }
.ds-flex-center { display: flex; align-items: center; justify-content: center; }
.ds-flex-between { display: flex; align-items: center; justify-content: space-between; }
.ds-gap-1 { gap: var(--space-1); }
.ds-gap-2 { gap: var(--space-2); }
.ds-gap-3 { gap: var(--space-3); }
.ds-gap-4 { gap: var(--space-4); }
.ds-gap-6 { gap: var(--space-6); }
.ds-gap-8 { gap: var(--space-8); }

/* Section spacing */
.ds-section {
  margin-bottom: var(--space-8);
}

.ds-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.ds-section-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.ds-section-link {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
}

/* ============================================================
   TEXT UTILITIES
   ============================================================ */

.ds-text-xs { font-size: var(--text-xs); }
.ds-text-sm { font-size: var(--text-sm); }
.ds-text-base { font-size: var(--text-base); }
.ds-text-lg { font-size: var(--text-lg); }
.ds-text-xl { font-size: var(--text-xl); }
.ds-text-2xl { font-size: var(--text-2xl); }

.ds-text-muted { color: var(--color-text-muted); }
.ds-text-secondary { color: var(--color-text-secondary); }
.ds-text-primary { color: var(--color-primary); }
.ds-text-success { color: var(--color-success); }
.ds-text-error { color: var(--color-error); }
.ds-text-warning { color: var(--color-warning); }

.ds-font-medium { font-weight: var(--font-medium); }
.ds-font-semibold { font-weight: var(--font-semibold); }
.ds-font-bold { font-weight: var(--font-bold); }

.ds-uppercase {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.ds-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
