/* ========================================
   Bamiyan Intelligence Platform
   Premium Dark Theme — Cinematic Design
   ======================================== */

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

/* === CSS Custom Properties === */
:root {
  /* Core Palette — Deep Space + Warm Gold */
  --bg-primary: #06060b;
  --bg-secondary: #0c0c14;
  --bg-tertiary: #13131f;
  --bg-card: rgba(16, 16, 28, 0.8);
  --bg-card-solid: #10101c;
  --bg-card-hover: rgba(24, 24, 42, 0.9);
  --bg-elevated: #161628;
  --bg-glass: rgba(255, 255, 255, 0.03);
  
  /* Accent – Warm Amber-Gold Gradient */
  --accent-primary: #f59e0b;
  --accent-secondary: #d97706;
  --accent-tertiary: #b45309;
  --accent-light: #fbbf24;
  --accent-glow: rgba(245, 158, 11, 0.12);
  --accent-glow-strong: rgba(245, 158, 11, 0.25);
  
  /* Secondary Accents */
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.12);
  --purple: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.12);
  --emerald: #10b981;
  --rose: #f43f5e;
  
  /* Text */
  --text-primary: #f0f2f5;
  --text-secondary: #9ca3b0;
  --text-tertiary: #5f6980;
  --text-muted: #3d4659;
  
  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(245, 158, 11, 0.25);
  --border-active: rgba(245, 158, 11, 0.5);
  
  /* Status Colors */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.08);
  --shadow-glow-lg: 0 0 60px rgba(245, 158, 11, 0.12);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === Light Theme Overrides === */
[data-theme="light"] {
  --bg-primary: #f3f4f6;
  --bg-secondary: #e5e7eb;
  --bg-tertiary: #d1d5db;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-solid: #ffffff;
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-elevated: #ffffff;
  --bg-glass: rgba(0, 0, 0, 0.03);
  
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-tertiary: #4b5563;
  --text-muted: #6b7280;
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-default: rgba(0, 0, 0, 0.15);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] body::before {
  opacity: 0.6;
}

[data-theme="light"] body::after {
  opacity: 0.05;
}

[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.98);
}

[data-theme="light"] .form-input {
  background: rgba(0, 0, 0, 0.02);
  color: var(--text-primary);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Cinematic ambient background */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 15% 5%, rgba(245, 158, 11, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 15%, rgba(139, 92, 246, 0.03) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 90%, rgba(6, 182, 212, 0.03) 0%, transparent 45%),
    radial-gradient(ellipse at 25% 60%, rgba(245, 158, 11, 0.02) 0%, transparent 35%);
  animation: ambientDrift 30s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes ambientDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(0.5deg); }
  66% { transform: translate(-1%, 2%) rotate(-0.3deg); }
  100% { transform: translate(1%, -2%) rotate(0.2deg); }
}

/* Subtle noise texture overlay */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.015'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* === Login Page === */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 3rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  animation: cardReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), var(--accent-light), var(--accent-primary), transparent);
  background-size: 300% 100%;
  animation: shimmerLine 4s ease infinite;
}

.login-card::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes shimmerLine {
  0%, 100% { background-position: 300% center; }
  50% { background-position: 0% center; }
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(40px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 1;
}

.login-brand .brand-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  margin: 0 auto 1.25rem;
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.25);
  position: relative;
}

.login-brand .brand-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), transparent, rgba(245, 158, 11, 0.1));
  z-index: -1;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.375rem;
}

.login-brand p {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* === Form Elements === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  transition: var(--transition-base);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
  background: rgba(255, 255, 255, 0.06);
}

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

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235f6980' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2rem;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: var(--transition-fast);
}

.btn:hover::before { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #000;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
  font-weight: 700;
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8125rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* === App Layout === */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* === Sidebar Navigation === */
.sidebar {
  width: 270px;
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(20px) saturate(1.3);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition-slow);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand .brand-dot {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.sidebar-brand h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand span {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 1rem 0.75rem 0.375rem;
  margin-top: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border-color: rgba(245, 158, 11, 0.15);
  font-weight: 600;
}

.nav-link .nav-icon {
  font-size: 1rem;
  width: 1.5rem;
  text-align: center;
}

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

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
  color: #000;
  flex-shrink: 0;
}

.user-info .user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-info .user-role {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* === Main Content === */
.main-content {
  flex: 1;
  margin-left: 270px;
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.page-header .page-subtitle {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
  font-weight: 400;
}

/* === Cards — Glassmorphism === */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition-base);
  position: relative;
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* === KPI Grid === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 0 0 0 80px;
  opacity: 0.04;
}

.kpi-card.accent::before { background: linear-gradient(90deg, var(--accent-primary), transparent); }
.kpi-card.accent::after { background: var(--accent-primary); }
.kpi-card.success::before { background: linear-gradient(90deg, var(--success), transparent); }
.kpi-card.success::after { background: var(--success); }
.kpi-card.info::before { background: linear-gradient(90deg, var(--info), transparent); }
.kpi-card.info::after { background: var(--info); }
.kpi-card.warning::before { background: linear-gradient(90deg, var(--warning), transparent); }
.kpi-card.warning::after { background: var(--warning); }
.kpi-card.danger::before { background: linear-gradient(90deg, var(--danger), transparent); }
.kpi-card.danger::after { background: var(--danger); }
.kpi-card.cyan::before { background: linear-gradient(90deg, var(--cyan), transparent); }
.kpi-card.cyan::after { background: var(--cyan); }
.kpi-card.purple::before { background: linear-gradient(90deg, var(--purple), transparent); }
.kpi-card.purple::after { background: var(--purple); }

.kpi-card:hover {
  border-color: var(--border-default);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.kpi-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.625rem;
}

.kpi-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.kpi-delta.up { color: var(--success); background: var(--success-bg); }
.kpi-delta.down { color: var(--danger); background: var(--danger-bg); }

/* === Charts Grid === */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition-base);
}

.chart-card:hover {
  border-color: var(--border-default);
}

.chart-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-container {
  position: relative;
  height: 280px;
}

/* === Data Table === */
.table-container {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  flex-wrap: wrap;
}

.table-toolbar h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-select, .search-input {
  padding: 0.4375rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  outline: none;
  transition: var(--transition-fast);
}

.filter-select { cursor: pointer; }
.search-input { width: 220px; }

.filter-select:focus, .search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

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

.data-table thead {
  background: rgba(255, 255, 255, 0.02);
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  max-width: 300px;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

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

/* Rating Stars */
.stars {
  color: var(--accent-primary);
  font-size: 0.875rem;
  letter-spacing: 1px;
}

/* Sentiment Badge */
.sentiment-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.sentiment-badge.positive { background: var(--success-bg); color: var(--success); }
.sentiment-badge.neutral { background: var(--warning-bg); color: var(--warning); }
.sentiment-badge.negative { background: var(--danger-bg); color: var(--danger); }

/* Theme tag */
.theme-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--info);
  letter-spacing: 0.02em;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.pagination button {
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pagination button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.pagination button.active {
  background: var(--accent-primary);
  color: #000;
  border-color: var(--accent-primary);
  font-weight: 700;
}

.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* === Admin Panel === */
.admin-grid {
  display: grid;
  gap: 1rem;
}

.user-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-base);
  gap: 1rem;
}

.user-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.user-card-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.user-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #000;
  flex-shrink: 0;
}

.user-card-details h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-card-details p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.role-badge {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.role-badge.admin {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.role-badge.analyst {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.user-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-base);
}

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

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 90%;
  max-width: 480px;
  transform: scale(0.94) translateY(16px);
  transition: var(--transition-slow);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  backdrop-filter: blur(12px);
}

.toast.success { background: rgba(34, 197, 94, 0.9); color: white; }
.toast.error { background: rgba(239, 68, 68, 0.9); color: white; }
.toast.info { background: rgba(59, 130, 246, 0.9); color: white; }

.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(120px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(120px) scale(0.95); }
}

/* === Profile Page === */
.profile-container {
  max-width: 560px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.75rem;
  color: #000;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.2);
}

.profile-meta h2 { font-size: 1.25rem; font-weight: 700; }
.profile-meta p { font-size: 0.8125rem; color: var(--text-tertiary); }

.profile-section {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* === Rating Distribution Bar === */
.rating-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
}

.rating-bar-label {
  width: 16px;
  text-align: right;
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 0.75rem;
}

.rating-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.rating-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-light));
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rating-bar-count {
  width: 32px;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-family: var(--font-mono);
}

/* === Skeleton Loading === */
.skeleton {
  animation: shimmerPulse 2s ease-in-out infinite;
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(255,255,255,0.05) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
}

@keyframes shimmerPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Spinner === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.8125rem;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* === Recent Reviews List === */
.review-list { display: flex; flex-direction: column; gap: 0.625rem; }

.review-item {
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

.review-item:hover { border-color: var(--border-default); background: rgba(255, 255, 255, 0.04); }

.review-item-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.review-item-author { font-weight: 600; font-size: 0.8125rem; color: var(--text-primary); }
.review-item-date { font-size: 0.6875rem; color: var(--text-muted); margin-left: auto; }

.review-item-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-default);
}

/* === Alert Messages === */
.alert-msg {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  display: none;
  font-weight: 500;
}

.alert-msg.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
  display: block;
}

.alert-msg.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.15);
  display: block;
}

/* === Competitor Cards === */
.competitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.competitor-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.competitor-card.self-card {
  border-color: rgba(245, 158, 11, 0.2);
}

.competitor-card.self-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), transparent);
}

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

.competitor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.competitor-card-header h4 {
  font-size: 1rem;
  font-weight: 700;
}

.competitor-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.competitor-stat {
  text-align: center;
}

.competitor-stat-value {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-primary);
}

.competitor-stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.125rem;
}

/* === Marketing Mix Radar/Score Cards === */
.marketing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.marketing-p-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.marketing-p-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
}

.marketing-p-icon {
  font-size: 1.75rem;
  margin-bottom: 0.625rem;
}

.marketing-p-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.625rem;
}

.marketing-p-score {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.marketing-p-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.marketing-p-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Score color thresholds */
.score-excellent { color: var(--success); }
.score-excellent .marketing-p-bar-fill { background: var(--success); }
.score-good { color: var(--cyan); }
.score-good .marketing-p-bar-fill { background: var(--cyan); }
.score-fair { color: var(--warning); }
.score-fair .marketing-p-bar-fill { background: var(--warning); }
.score-poor { color: var(--danger); }
.score-poor .marketing-p-bar-fill { background: var(--danger); }

/* === Recommendation Cards === */
.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recommendation-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-primary);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.recommendation-item .rec-number {
  width: 24px;
  height: 24px;
  background: var(--accent-glow);
  color: var(--accent-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .competitor-grid { grid-template-columns: 1fr; }
  .marketing-grid { grid-template-columns: repeat(2, 1fr); }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }
  .page-header h1 { font-size: 1.5rem; }
}

/* Mobile Menu Toggle */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  width: 42px;
  height: 42px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .mobile-toggle { display: flex; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* === Period Selector === */
.period-tabs {
  display: flex;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  border: 1px solid var(--border-subtle);
}

.period-tab {
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.period-tab:hover { color: var(--text-secondary); }
.period-tab.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
}

/* === Source Badge === */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* === Trend Indicator === */
.trend-arrow {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
}

.trend-arrow.up { color: var(--success); }
.trend-arrow.down { color: var(--danger); }
.trend-arrow.flat { color: var(--text-muted); }

/* Hero stat display */
.hero-stat {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
