/* ============================================
   بين السطور | Cafe & Library
   Design System & Global Styles (RTL)
   ============================================ */

/* ============================================
   1. CSS Variables (Design Tokens)
   ============================================ */
:root {
  /* Primary Coffee Tones */
  --color-primary: hsl(25, 45%, 38%);
  --color-primary-light: hsl(25, 50%, 55%);
  --color-primary-dark: hsl(25, 45%, 28%);
  
  /* Warm Accent & Glow */
  --color-accent: hsl(45, 95%, 58%);
  --color-glow: hsl(45, 100%, 70%);
  --color-glow-subtle: hsla(45, 100%, 70%, 0.15);
  
  /* Neutral Beige Surfaces */
  --color-bg-primary: hsl(35, 50%, 96%);
  --color-bg-secondary: hsl(35, 40%, 92%);
  --color-bg-card: hsla(35, 40%, 98%, 0.85);
  
  /* Text Colors */
  --color-text-primary: hsl(25, 45%, 15%);
  --color-text-secondary: hsl(25, 30%, 40%);
  --color-text-muted: hsl(25, 20%, 60%);
  
  /* Glassmorphism */
  --color-glass-bg: hsla(35, 50%, 96%, 0.7);
  --color-glass-border: hsla(25, 45%, 38%, 0.15);
  
  /* Status Colors */
  --color-success: hsl(145, 60%, 42%);
  --color-warning: hsl(35, 95%, 50%);
  --color-error: hsl(0, 70%, 55%);
  --color-info: hsl(210, 60%, 50%);
  
  /* Sidebar */
  --color-sidebar-bg: hsl(25, 45%, 12%);
  --color-sidebar-text: hsl(35, 60%, 90%);
  --color-sidebar-accent: hsl(45, 95%, 65%);
  --color-sidebar-hover: hsla(45, 95%, 65%, 0.1);
  --color-sidebar-active: hsla(45, 95%, 65%, 0.2);
  
  /* Typography */
  --font-primary: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  
  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px hsla(25, 45%, 15%, 0.08);
  --shadow-md: 0 4px 12px hsla(25, 45%, 15%, 0.12);
  --shadow-lg: 0 8px 24px hsla(25, 45%, 15%, 0.16);
  --shadow-glow: 0 0 40px hsla(45, 100%, 70%, 0.25);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Easing */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;
}

/* ============================================
   Theme: Morning (صباحي) - Default
   ============================================ */
:root,
[data-theme="morning"] {
  /* Primary Coffee Tones - Warm and Light */
  --color-primary: hsl(30, 50%, 42%);
  --color-primary-light: hsl(30, 55%, 60%);
  --color-primary-dark: hsl(30, 45%, 32%);
  
  /* Warm Accent & Glow - Golden Morning */
  --color-accent: hsl(45, 100%, 60%);
  --color-glow: hsl(45, 100%, 75%);
  --color-glow-subtle: hsla(45, 100%, 75%, 0.12);
  
  /* Neutral Beige Surfaces - Creamy Morning */
  --color-bg-primary: hsl(38, 55%, 97%);
  --color-bg-secondary: hsl(38, 45%, 93%);
  --color-bg-card: hsla(38, 45%, 99%, 0.9);
  
  /* Text Colors */
  --color-text-primary: hsl(25, 50%, 18%);
  --color-text-secondary: hsl(25, 35%, 42%);
  --color-text-muted: hsl(25, 25%, 58%);
  
  /* Glassmorphism */
  --color-glass-bg: hsla(38, 55%, 97%, 0.85);
  --color-glass-border: hsla(30, 50%, 42%, 0.12);
  
  /* Sidebar - Light Coffee */
  --color-sidebar-bg: hsl(25, 35%, 18%);
  --color-sidebar-text: hsl(38, 60%, 92%);
  --color-sidebar-accent: hsl(45, 100%, 65%);
  --color-sidebar-hover: hsla(45, 100%, 65%, 0.08);
  --color-sidebar-active: hsla(45, 100%, 65%, 0.15);
  
  /* Shadows */
  --shadow-sm: 0 2px 4px hsla(25, 50%, 18%, 0.06);
  --shadow-md: 0 4px 12px hsla(25, 50%, 18%, 0.1);
  --shadow-lg: 0 8px 24px hsla(25, 50%, 18%, 0.12);
  --shadow-glow: 0 0 35px hsla(45, 100%, 75%, 0.2);
}

/* ============================================
   Theme: Evening (مسائي) - Dark Mode
   ============================================ */
[data-theme="evening"] {
  /* Primary Coffee Tones - Dark and Rich */
  --color-primary: hsl(25, 40%, 55%);
  --color-primary-light: hsl(25, 45%, 65%);
  --color-primary-dark: hsl(25, 40%, 40%);
  
  /* Warm Accent & Glow - Warm Amber */
  --color-accent: hsl(35, 100%, 60%);
  --color-glow: hsl(35, 100%, 70%);
  --color-glow-subtle: hsla(35, 100%, 70%, 0.15);
  
  /* Neutral Surfaces - Dark Coffee Tones */
  --color-bg-primary: hsl(220, 15%, 12%);
  --color-bg-secondary: hsl(220, 15%, 16%);
  --color-bg-card: hsla(220, 15%, 10%, 0.9);
  
  /* Text Colors - Light on Dark */
  --color-text-primary: hsl(35, 60%, 92%);
  --color-text-secondary: hsl(35, 40%, 70%);
  --color-text-muted: hsl(35, 25%, 50%);
  
  /* Glassmorphism */
  --color-glass-bg: hsla(220, 15%, 12%, 0.85);
  --color-glass-border: hsla(25, 40%, 55%, 0.2);
  
  /* Sidebar - Deep Espresso */
  --color-sidebar-bg: hsl(220, 20%, 8%);
  --color-sidebar-text: hsl(35, 50%, 88%);
  --color-sidebar-accent: hsl(35, 100%, 65%);
  --color-sidebar-hover: hsla(35, 100%, 65%, 0.1);
  --color-sidebar-active: hsla(35, 100%, 65%, 0.2);
  
  /* Shadows - Deeper in dark mode */
  --shadow-sm: 0 2px 4px hsla(0, 0%, 0%, 0.3);
  --shadow-md: 0 4px 12px hsla(0, 0%, 0%, 0.4);
  --shadow-lg: 0 8px 24px hsla(0, 0%, 0%, 0.5);
  --shadow-glow: 0 0 50px hsla(35, 100%, 70%, 0.25);
}

/* ============================================
   Theme Toggle Button Styles
   ============================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) var(--space-4);
  background: hsla(0, 0%, 0%, 0.2);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  width: calc(100% - var(--space-8));
}

.theme-toggle:hover {
  background: hsla(0, 0%, 0%, 0.3);
}

.theme-toggle-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-sidebar-text);
}

.theme-toggle-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.theme-toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--color-sidebar-hover);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

.theme-toggle-switch::before {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  background: var(--color-sidebar-accent);
  border-radius: 50%;
  transition: all var(--transition-base);
}

[data-theme="evening"] .theme-toggle-switch {
  background: var(--color-sidebar-accent);
}

[data-theme="evening"] .theme-toggle-switch::before {
  right: 25px;
}

/* ============================================
   2. Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  direction: rtl;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-primary);
  background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-primary) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* Selection */
::selection {
  background: var(--color-accent);
  color: var(--color-text-primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
}

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

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

/* ============================================
   3. Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: 1.3;
  color: var(--color-text-primary);
}

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

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

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

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

/* ============================================
   4. Layout Components
   ============================================ */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-base);
}

.sidebar-header {
  padding: var(--space-6);
  text-align: center;
  border-bottom: 1px solid hsla(45, 95%, 65%, 0.1);
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-glow) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.logo-icon svg {
  width: 36px;
  height: 36px;
  color: var(--color-sidebar-bg);
}

.logo-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-sidebar-text);
  margin: 0;
}

.logo-tagline {
  font-size: var(--text-sm);
  color: var(--color-sidebar-accent);
  margin: 0;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--color-sidebar-text);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.nav-link:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-sidebar-accent);
}

.nav-link.active {
  background: var(--color-sidebar-active);
  color: var(--color-sidebar-accent);
  border-right: 3px solid var(--color-sidebar-accent);
}

.nav-link svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-link span {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid hsla(45, 95%, 65%, 0.1);
  text-align: center;
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.version-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* Main Content */
.main-content {
  margin-right: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: var(--space-6);
  transition: margin-right var(--transition-base);
}

.content-wrapper {
  background: var(--color-bg-primary);
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--space-6) * 2);
}

.content-wrapper::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 70% 30%,
    var(--color-glow-subtle) 0%,
    transparent 50%
  );
  pointer-events: none;
  animation: softGlow 8s ease-in-out infinite;
}

@keyframes softGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.content-inner {
  position: relative;
  z-index: 1;
  padding: var(--space-6);
}

/* Page Header */
.page-header {
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.page-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
}

/* ============================================
   5. Card Components
   ============================================ */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

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

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  backdrop-filter: blur(10px);
  transition: all var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}

.stat-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ============================================
   6. Button Components
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.btn:focus {
  box-shadow: 0 0 0 3px hsla(45, 95%, 58%, 0.3);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-glow) 100%);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover {
  background: hsl(0, 70%, 45%);
}

.btn-success {
  background: var(--color-success);
  color: white;
}

.btn-success:hover {
  background: hsl(145, 60%, 35%);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   7. Form Components
   ============================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: white;
  border: 2px solid var(--color-glass-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-glow-subtle);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236B5A35' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left var(--space-3) center;
  background-size: 20px;
  padding-left: var(--space-8);
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* ============================================
   8. Table Components
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: white;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--space-4);
  text-align: right;
  border-bottom: 1px solid var(--color-glass-border);
}

.data-table th {
  background: var(--color-bg-secondary);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:hover td {
  background: var(--color-glow-subtle);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* ============================================
   9. Badge Components
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-success {
  background: hsla(145, 60%, 42%, 0.15);
  color: var(--color-success);
}

.badge-warning {
  background: hsla(35, 95%, 50%, 0.15);
  color: var(--color-warning);
}

.badge-error {
  background: hsla(0, 70%, 55%, 0.15);
  color: var(--color-error);
}

.badge-info {
  background: hsla(210, 60%, 50%, 0.15);
  color: var(--color-info);
}

.badge-neutral {
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
}

/* Category Badges */
.badge-novels {
  background: hsla(340, 60%, 55%, 0.15);
  color: hsl(340, 60%, 45%);
}

.badge-self-dev {
  background: hsla(145, 60%, 42%, 0.15);
  color: var(--color-success);
}

.badge-tech {
  background: hsla(210, 60%, 50%, 0.15);
  color: var(--color-info);
}

.badge-literature {
  background: hsla(280, 60%, 55%, 0.15);
  color: hsl(280, 60%, 45%);
}

.badge-poetry {
  background: hsla(45, 95%, 58%, 0.15);
  color: hsl(45, 80%, 40%);
}

/* ============================================
   10. Tabs Component
   ============================================ */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 2px solid var(--color-glass-border);
  margin-bottom: var(--space-5);
}

.tab-btn {
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--color-primary);
}

.tab-btn.active {
  color: var(--color-primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-glow));
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glow);
}

/* ============================================
   11. Grid Layouts
   ============================================ */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-5);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

/* ============================================
   12. Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s var(--ease-bounce);
  min-width: 300px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.hiding {
  animation: toastOut 0.3s var(--ease-smooth) forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-info); }

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.toast-close {
  background: none;
  border: none;
  padding: var(--space-1);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--color-text-primary);
}

/* ============================================
   13. Modal Components
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: hsla(25, 45%, 15%, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform var(--transition-base);
}

.modal-backdrop.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-glass-border);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-secondary);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-error);
  color: white;
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-glass-border);
}

/* ============================================
   14. Search Bar
   ============================================ */
.search-container {
  position: relative;
  margin-bottom: var(--space-5);
}

.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  padding-right: var(--space-10);
  font-size: var(--text-base);
  background: white;
  border: 2px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-glow-subtle);
}

.search-icon {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

/* ============================================
   15. Menu Item Cards
   ============================================ */
.menu-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

.menu-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.menu-card-image {
  height: 120px;
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-card-image svg {
  width: 48px;
  height: 48px;
  color: white;
  opacity: 0.8;
}

.menu-card-content {
  padding: var(--space-4);
}

.menu-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.menu-card-price {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.menu-card-price span {
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  color: var(--color-text-muted);
}

/* ============================================
   16. Book Cards
   ============================================ */
.book-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.book-card-cover {
  height: 160px;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.book-card-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.book-card-cover svg {
  width: 64px;
  height: 64px;
  color: white;
  opacity: 0.7;
}

.book-card-content {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.book-card-author {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.book-card-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   17. Service Cards
   ============================================ */
.service-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}

.service-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-glow) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-icon svg {
  width: 32px;
  height: 32px;
  color: var(--color-text-primary);
}

.service-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.service-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ============================================
   18. Event Cards
   ============================================ */
.event-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.event-date-badge {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-glow) 100%);
  padding: var(--space-3) var(--space-4);
  text-align: center;
}

.event-date-day {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  line-height: 1;
}

.event-date-label {
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  opacity: 0.8;
}

.event-content {
  padding: var(--space-4);
}

.event-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.event-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.event-schedule {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-primary);
}

/* ============================================
   19. Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--space-10);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 40px;
  height: 40px;
  color: var(--color-text-muted);
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-base);
  color: var(--color-text-muted);
}

/* ============================================
   20. About Section
   ============================================ */
.about-section {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  color: white;
  position: relative;
  overflow: hidden;
}

.about-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, hsla(45, 100%, 70%, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.about-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
  position: relative;
}

.about-text {
  font-size: var(--text-lg);
  line-height: 1.8;
  opacity: 0.95;
  max-width: 700px;
  position: relative;
}

/* ============================================
   21. Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }

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

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

/* ============================================
   22. Responsive Design
   ============================================ */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 72px;
  }

  .sidebar {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: var(--space-2);
  }

  .sidebar-header {
    display: none;
  }

  .sidebar-nav {
    flex: 1;
    padding: var(--space-1);
    overflow-x: auto;
    overflow-y: visible;
  }

  .nav-list {
    flex-direction: row;
    justify-content: space-around;
    gap: var(--space-1);
  }

  .nav-link {
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2);
  }

  .nav-link span {
    font-size: var(--text-xs);
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin-right: 0;
    margin-bottom: 80px;
    padding: var(--space-4);
  }

  .content-wrapper {
    border-radius: var(--radius-lg);
  }

  .content-inner {
    padding: var(--space-4);
  }

  .page-title {
    font-size: var(--text-2xl);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .about-section {
    padding: var(--space-5);
  }

  .about-title {
    font-size: var(--text-2xl);
  }

  .data-table {
    font-size: var(--text-sm);
  }

  .data-table th,
  .data-table td {
    padding: var(--space-3);
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: var(--text-xl);
  }

  .stat-card {
    padding: var(--space-4);
  }

  .stat-icon {
    width: 48px;
    height: 48px;
  }

  .stat-value {
    font-size: var(--text-xl);
  }
}

/* ============================================
   23. Animation Classes
   ============================================ */
.fade-in {
  animation: fadeIn 0.4s var(--ease-smooth);
}

.slide-up {
  animation: slideUp 0.4s var(--ease-smooth);
}

.scale-in {
  animation: scaleIn 0.3s var(--ease-bounce);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Staggered animations for lists */
.stagger-item {
  opacity: 0;
  animation: slideUp 0.4s var(--ease-smooth) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }

/* ============================================
   24. Print Styles
   ============================================ */
@media print {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-right: 0;
  }

  .content-wrapper {
    box-shadow: none;
  }
}