/* ==========================================================================
   My Car Concierge - Shared Styles
   Premium Automotive Theme with Bronze/Copper Gold and Coolant Teal accents
   ========================================================================== */

/* ==========================================================================
   CSS Variables - Theme Colors
   ========================================================================== */
:root {
  /* Backgrounds - Warmer, garage-inspired */
  --bg-deep: #12161c;
  --bg-card: rgba(26, 32, 42, 0.9);
  --bg-elevated: rgba(36, 44, 56, 0.95);
  --bg-input: rgba(30, 38, 48, 0.9);
  
  /* Typography */
  --text-primary: #f5f5f7;
  --text-secondary: #a0a8b8;
  --text-muted: #6b7280;
  
  /* Bronze/copper - engine metal vibes */
  --accent-gold: #c9a227;
  --accent-gold-soft: rgba(201, 162, 39, 0.18);
  --accent-bronze: #cd7f32;
  --accent-bronze-soft: rgba(205, 127, 50, 0.15);
  
  /* Coolant teal - automotive fluid accent */
  --accent-teal: #22d3ee;
  --accent-teal-soft: rgba(34, 211, 238, 0.12);
  --accent-blue: #38bdf8;
  --accent-blue-soft: rgba(56, 189, 248, 0.12);
  
  /* Status Colors */
  --accent-green: #34d399;
  --accent-green-soft: rgba(52, 211, 153, 0.12);
  --accent-red: #f87171;
  --accent-red-soft: rgba(248, 113, 113, 0.15);
  --accent-orange: #fb923c;
  --accent-orange-soft: rgba(251, 146, 60, 0.15);
  
  /* Borders */
  --border-subtle: rgba(160, 168, 184, 0.15);
  --border-medium: rgba(160, 168, 184, 0.25);
  --border-focus: rgba(56, 189, 248, 0.5);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.3);
  --shadow-glow-gold: 0 0 60px rgba(201, 162, 39, 0.1);
  --shadow-glow-blue: 0 2px 12px rgba(56, 189, 248, 0.3);
}

/* ==========================================================================
   Light Theme Override
   ========================================================================== */
[data-theme="light"] {
  /* Softer light backgrounds - less harsh white, premium automotive feel */
  --bg-deep: #f3f4f6;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-input: #f0f1f3;
  --bg-section-alt: #eaecf0;
  
  /* Strong readable text - deeper for better contrast */
  --text-primary: #1a1a2e;
  --text-secondary: #3d3d5c;
  --text-muted: #5c5c7a;
  
  /* Subtle professional borders */
  --border-subtle: rgba(30, 58, 95, 0.10);
  --border-medium: rgba(30, 58, 95, 0.18);
  --border-focus: rgba(30, 58, 95, 0.4);
  
  /* Deeper gold for higher contrast CTAs (research: 23% more clicks) */
  --accent-gold: #b8942d;
  --accent-gold-soft: rgba(184, 148, 45, 0.12);
  --accent-bronze: #1e3a5f;
  --accent-bronze-soft: rgba(30, 58, 95, 0.1);
  --accent-teal: #0d7377;
  --accent-teal-soft: rgba(13, 115, 119, 0.12);
  --accent-blue: #1e3a5f;
  --accent-blue-soft: rgba(30, 58, 95, 0.1);
  
  /* Status colors - accessible contrast */
  --accent-green: #059669;
  --accent-green-soft: rgba(5, 150, 105, 0.12);
  
  /* Light mode shadows - softer with navy tint */
  --shadow-sm: 0 2px 8px rgba(30, 58, 95, 0.08);
  --shadow-md: 0 4px 16px rgba(30, 58, 95, 0.1);
  --shadow-lg: 0 12px 32px rgba(30, 58, 95, 0.12);
  --shadow-glow-gold: 0 0 40px rgba(201, 169, 98, 0.15);
  --shadow-glow-blue: 0 2px 12px rgba(30, 58, 95, 0.15);
}

/* ==========================================================================
   Theme Transition
   ========================================================================== */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ==========================================================================
   Base Reset & Defaults
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) var(--bg-deep);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #5eb8f7);
  box-shadow: var(--shadow-glow-blue);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-medium);
}

.btn-gold {
  background: linear-gradient(135deg, var(--accent-gold), #e6b84a);
  color: #12161c;
  box-shadow: 0 2px 12px rgba(201, 162, 39, 0.3);
}
.btn-gold:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green), #4ade80);
  box-shadow: 0 2px 12px rgba(52, 211, 153, 0.3);
  color: #022c22;
}
.btn-success:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 95, 95, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 95, 95, 0.3);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239, 95, 95, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-input);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

/* Light mode button overrides - deeper gold for higher contrast (research: 23% more clicks) */
[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #b8942d, #d4a63a);
  box-shadow: 0 3px 14px rgba(184, 148, 45, 0.35);
  color: #ffffff;
  font-weight: 600;
}
[data-theme="light"] .btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #a6852a, #c49a35);
  box-shadow: 0 5px 20px rgba(184, 148, 45, 0.45);
}

[data-theme="light"] .btn-gold {
  background: linear-gradient(135deg, #b8942d, #d4a63a);
  color: #ffffff;
  box-shadow: 0 3px 14px rgba(184, 148, 45, 0.35);
  font-weight: 600;
}
[data-theme="light"] .btn-gold:hover:not(:disabled) {
  background: linear-gradient(135deg, #a6852a, #c49a35);
  box-shadow: 0 5px 20px rgba(184, 148, 45, 0.45);
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
  color: #1e3a5f;
  border: 2px solid #1e3a5f;
  font-weight: 500;
}
[data-theme="light"] .btn-secondary:hover:not(:disabled) {
  background: #1e3a5f;
  color: #ffffff;
  border-color: #1e3a5f;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: linear-gradient(145deg, #1a202a, #141a24);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.03);
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

[data-theme="light"] .card {
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(30, 58, 95, 0.06), 0 1px 3px rgba(30, 58, 95, 0.04);
  border: 1px solid rgba(30, 58, 95, 0.08);
}

/* ==========================================================================
   Form Elements
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  transition: all 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.1);
}

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

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-section {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.form-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-gold);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  overflow-y: auto;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}

.modal.wide {
  max-width: 800px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 10;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 20px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  max-width: 400px;
}

.toast.success {
  border-color: var(--accent-green);
  background: linear-gradient(135deg, var(--bg-elevated), rgba(52, 211, 153, 0.1));
}

.toast.error {
  border-color: var(--accent-red);
  background: linear-gradient(135deg, var(--bg-elevated), rgba(248, 113, 113, 0.1));
}

.toast.warning {
  border-color: var(--accent-orange);
  background: linear-gradient(135deg, var(--bg-elevated), rgba(251, 146, 60, 0.1));
}

.toast.info {
  border-color: var(--accent-blue);
  background: linear-gradient(135deg, var(--bg-elevated), rgba(56, 189, 248, 0.1));
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ==========================================================================
   Skeleton Loaders
   ========================================================================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-elevated) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 12px;
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-elevated) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-meta {
  height: 16px;
  width: 80%;
  margin-bottom: 16px;
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-elevated) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-button {
  height: 36px;
  width: 120px;
  margin-top: auto;
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-elevated) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-stat {
  height: 100px;
  border-radius: var(--radius-lg);
}

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

/* ==========================================================================
   Status Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-success {
  background: var(--accent-green-soft);
  color: var(--accent-green);
}

.badge-warning {
  background: var(--accent-orange-soft);
  color: var(--accent-orange);
}

.badge-danger {
  background: var(--accent-red-soft);
  color: var(--accent-red);
}

.badge-info {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
}

.badge-gold {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

/* ==========================================================================
   Stat Cards
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: linear-gradient(145deg, #1a202a, #141a24);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.03);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-blue));
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.stat-icon.blue { background: linear-gradient(135deg, rgba(100,181,246,0.2), rgba(100,181,246,0.1)); }
.stat-icon.gold { background: linear-gradient(135deg, rgba(212,168,85,0.2), rgba(212,168,85,0.1)); }
.stat-icon.green { background: linear-gradient(135deg, rgba(129,199,132,0.2), rgba(129,199,132,0.1)); }
.stat-icon.orange { background: linear-gradient(135deg, rgba(255,183,77,0.2), rgba(255,183,77,0.1)); }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

[data-theme="light"] .stat-card {
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(30, 58, 95, 0.06), 0 1px 3px rgba(30, 58, 95, 0.04);
  border: 1px solid rgba(30, 58, 95, 0.08);
}

[data-theme="light"] .stat-card:hover {
  box-shadow: 0 6px 24px rgba(30, 58, 95, 0.1);
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

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

.tab.active {
  color: var(--accent-gold);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gold);
}

/* ==========================================================================
   Empty States
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ==========================================================================
   Theme Toggle Button
   ========================================================================== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.2rem;
}

.theme-toggle:hover {
  background: var(--accent-gold-soft);
  border-color: var(--accent-gold);
  transform: scale(1.05);
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
  background: var(--accent-gold-soft);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(201, 162, 39, 0.2);
}

.theme-icon-dark, .theme-icon-light {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

@keyframes flashlight {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); filter: drop-shadow(0 0 8px #ffd700); }
}

[data-theme="dark"] .theme-toggle-btn:hover .theme-icon-dark {
  animation: flashlight 0.5s ease;
}

.theme-label { font-weight: 500; }

/* Header Theme Toggle (compact icon button for navbar) */
.header-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  height: 38px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}

.header-theme-toggle:hover {
  background: var(--accent-gold-soft);
  border-color: var(--accent-gold);
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.25);
}

.header-theme-toggle .theme-icon-sun,
.header-theme-toggle .theme-icon-moon {
  transition: transform 0.3s ease;
}

[data-theme="dark"] .header-theme-toggle .theme-icon-sun { display: inline; }
[data-theme="dark"] .header-theme-toggle .theme-icon-moon { display: none; }
[data-theme="light"] .header-theme-toggle .theme-icon-sun { display: none; }
[data-theme="light"] .header-theme-toggle .theme-icon-moon { display: inline; }

/* Desktop Header - Theme Toggle for main content area */
.desktop-header {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 901px) {
  .desktop-header {
    display: flex;
  }
}

/* ==========================================================================
   Ambient Background & Noise
   ========================================================================== */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(212, 168, 85, 0.06), transparent 50%),
    radial-gradient(ellipse 60% 60% at 80% 80%, rgba(74, 124, 255, 0.05), transparent 50%),
    radial-gradient(ellipse 100% 100% at 50% 100%, rgba(74, 124, 255, 0.03), transparent 60%);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

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

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

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

/* ==========================================================================
   Micro-interactions & Visual Feedback
   ========================================================================== */

/* Button press effect */
.btn:active,
button:active,
[role="button"]:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Ripple effect on buttons */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
  opacity: 1;
  transition: 0s;
}

/* Smooth card hover lift */
.card:hover,
.stat-card:hover,
.onboarding-step:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Success animation for completed actions */
@keyframes successPulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.success-pulse {
  animation: successPulse 0.6s ease-out;
}

/* Error shake animation */
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.error-shake {
  animation: errorShake 0.5s ease-in-out;
}

/* Loading spinner for buttons */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpinner 0.6s linear infinite;
}

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

/* Smooth page fade-in */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-enter {
  animation: pageFadeIn 0.3s ease-out;
}

/* Section slide-in for dashboard tabs */
@keyframes sectionSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-enter {
  animation: sectionSlideIn 0.25s ease-out;
}

/* ==========================================================================
   Error Recovery & Friendly Messages
   ========================================================================== */

/* Error banner for network/API issues */
.error-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 9999;
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.error-banner.visible {
  transform: translateY(0);
}

.error-banner .error-banner-action {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s ease;
}

.error-banner .error-banner-action:hover {
  background: rgba(255, 255, 255, 0.3);
}

.error-banner .error-banner-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  line-height: 1;
}

/* Offline indicator */
.offline-indicator {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  border: 1px solid var(--accent-orange);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9998;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  font-size: 0.9rem;
}

.offline-indicator.visible {
  transform: translateX(-50%) translateY(0);
}

.offline-indicator .offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-orange);
  animation: offlinePulse 2s infinite;
}

@keyframes offlinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Empty state / no data styling */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--accent-gold);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.empty-state-action:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-gold);
}

/* ==========================================================================
   Progress Indicators for Multi-step Flows
   ========================================================================== */

.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px 0;
}

.step-progress-item {
  display: flex;
  align-items: center;
  gap: 0;
}

.step-progress-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  border: 2px solid var(--border-medium);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.step-progress-item.active .step-progress-circle {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
  color: #000;
  box-shadow: 0 0 0 4px var(--accent-gold-soft);
}

.step-progress-item.completed .step-progress-circle {
  border-color: var(--accent-green);
  background: var(--accent-green);
  color: #fff;
}

.step-progress-line {
  width: 40px;
  height: 2px;
  background: var(--border-medium);
  transition: background 0.3s ease;
}

.step-progress-item.completed + .step-progress-item .step-progress-line,
.step-progress-item.completed .step-progress-line {
  background: var(--accent-green);
}

.step-progress-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  max-width: 80px;
}

.step-progress-item.active .step-progress-label {
  color: var(--accent-gold);
  font-weight: 600;
}

.step-progress-item.completed .step-progress-label {
  color: var(--accent-green);
}

/* ==========================================================================
   Onboarding Tooltips
   ========================================================================== */

.onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9990;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.onboarding-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-tooltip {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 20px;
  max-width: 320px;
  z-index: 9991;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 2px var(--accent-gold-soft);
  animation: tooltipFadeIn 0.3s ease;
}

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

.onboarding-tooltip-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.onboarding-tooltip-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.onboarding-tooltip-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.onboarding-tooltip-progress {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.onboarding-tooltip-actions {
  display: flex;
  gap: 8px;
}

.onboarding-tooltip-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.onboarding-tooltip-next {
  background: var(--accent-gold);
  color: #000;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.onboarding-tooltip-next:hover {
  transform: translateY(-1px);
}

.onboarding-highlight {
  position: relative;
  z-index: 9991;
  box-shadow: 0 0 0 4px var(--accent-gold), 0 0 0 8px var(--accent-gold-soft);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Mobile Bottom Navigation
   ========================================================================== */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  z-index: 9000;
  padding: 0 0 env(safe-area-inset-bottom, 0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mobile-bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
  padding: 0 8px;
}

.mobile-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
  border: none;
  background: none;
  min-width: 56px;
}

.mobile-bottom-nav-item .nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.mobile-bottom-nav-item.active {
  color: var(--accent-gold);
}

.mobile-bottom-nav-item:active {
  transform: scale(0.92);
  transition: transform 0.1s ease;
}

/* Add bottom padding to pages when bottom nav is visible */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: block;
  }
  
  body.has-bottom-nav {
    padding-bottom: 72px;
  }
  
  /* Hide sidebar on mobile when bottom nav is present */
  body.has-bottom-nav .sidebar.hide-on-mobile {
    display: none;
  }
}

/* ==========================================================================
   Touch Interaction Improvements
   ========================================================================== */

/* Prevent tap highlight on interactive elements */
button, a, input, select, textarea, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Touch-friendly minimum sizes */
@media (max-width: 768px) {
  button, .btn, [role="button"], a.nav-link {
    min-height: 44px;
    min-width: 44px;
  }
  
  input, select, textarea {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
  
  /* Larger touch targets for checkboxes and radio buttons */
  input[type="checkbox"],
  input[type="radio"] {
    min-width: 22px;
    min-height: 22px;
  }
}

/* Pull-to-refresh indicator */
.pull-refresh-indicator {
  position: fixed;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: top 0.2s ease;
  box-shadow: var(--shadow-md);
}

.pull-refresh-indicator.pulling {
  top: 12px;
}

.pull-refresh-indicator .refresh-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: btnSpinner 0.6s linear infinite;
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-row.three {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .modal {
    max-height: 95vh;
    margin: 12px;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px 20px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
  
  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }
  
  .toast {
    max-width: 100%;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--accent-gold); }
.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Skip to content link - hidden until focused */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-gold);
  color: #000;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  z-index: 10000;
  transition: top 0.2s ease;
  text-decoration: none;
}

.skip-to-content:focus {
  top: 12px;
  outline: 3px solid var(--accent-teal);
  outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 3px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 3px;
}

/* ARIA live region styling */
[aria-live="polite"],
[aria-live="assertive"],
[role="status"],
[role="alert"] {
  /* These are often visually hidden but announced by screen readers */
}

.aria-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
