/* ==========================================================================
   AuraBoard Studio - Main Global Styles & Design System
   ========================================================================== */

:root {
  /* Color Palette - Premium Slate & Neon Accents */
  --bg-primary: #0a0d14;
  --bg-secondary: #121824;
  --bg-tertiary: #1a2233;
  --bg-card: rgba(22, 30, 46, 0.75);
  --bg-card-hover: rgba(30, 41, 62, 0.9);
  --bg-glass: rgba(18, 24, 36, 0.82);
  --bg-input: #0f1523;

  /* Accent Colors */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  --accent-glow: 0 0 25px rgba(99, 102, 241, 0.45);
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Typography */
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);
  --border-card: rgba(255, 255, 255, 0.07);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  /* Layout & Metrics */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Light / White Theme Variables (Whiteboard Pro)
   ========================================================================== */
body.theme-light,
.theme-light {
  /* Color Palette - Clean Professional White & Slate */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.94);
  --bg-input: #ffffff;

  /* Accent Colors */
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-secondary: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(124, 58, 237, 0.08));
  --accent-glow: 0 0 20px rgba(79, 70, 229, 0.25);

  /* Typography Colors - High Contrast Crisp Dark */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Borders & Shadows */
  --border-subtle: rgba(15, 23, 42, 0.1);
  --border-focus: rgba(79, 70, 229, 0.6);
  --border-card: rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.08);
}

/* ==========================================================================
   Ganesh Chaturthi Festive Theme Variables (Divine Saffron & Royal Temple Gold)
   ========================================================================== */
body.theme-ganesh,
.theme-ganesh {
  /* Color Palette - Auspicious Sandalwood, Deep Maroon & Festive Gold */
  --bg-primary: #120904;
  --bg-secondary: #1a0e07;
  --bg-tertiary: #27140a;
  --bg-card: rgba(39, 20, 10, 0.85);
  --bg-card-hover: rgba(53, 27, 13, 0.95);
  --bg-glass: rgba(26, 14, 7, 0.9);
  --bg-input: #190d06;

  /* Accent Colors - Auspicious Saffron, Marigold Gold & Sindoor Vermilion */
  --accent-primary: #f59e0b;
  --accent-primary-hover: #d97706;
  --accent-secondary: #ea580c;
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 50%, #dc2626 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(234, 88, 12, 0.16));
  --accent-glow: 0 0 25px rgba(245, 158, 11, 0.55);
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #fbbf24;
  --accent-rose: #f43f5e;

  /* Typography Colors - Divine Warm Ivory & Sandalwood Gold */
  --text-primary: #fffbeb;
  --text-secondary: #fed7aa;
  --text-muted: #b48560;
  --text-inverse: #170802;

  /* Borders & Shadows - Golden Festive Luster */
  --border-subtle: rgba(245, 158, 11, 0.16);
  --border-focus: rgba(245, 158, 11, 0.7);
  --border-card: rgba(245, 158, 11, 0.22);
  --shadow-sm: 0 2px 8px rgba(18, 9, 4, 0.45);
  --shadow-md: 0 8px 24px rgba(18, 9, 4, 0.6);
  --shadow-lg: 0 16px 40px rgba(18, 9, 4, 0.75);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.65);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family-base);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* App Container and View Router */
.app-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  transform: scale(0.99);
}

.view.active-view {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: scale(1);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family-base);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  outline: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  filter: brightness(1.08);
}

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

.btn-glow {
  position: relative;
}

.btn-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--accent-gradient);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  filter: blur(8px);
  transition: opacity var(--transition-normal);
}

.btn-glow:hover::after {
  opacity: 0.6;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

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

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

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

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: #f43f5e;
  color: #fff;
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  transition: opacity var(--transition-normal);
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 28px;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.modal-card.modal-sm {
  max-width: 420px;
}

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

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient-subtle);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.modal-title-wrap h3 {
  font-size: 20px;
  color: var(--text-primary);
}

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

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

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--font-family-base);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Template Selector Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.template-option {
  cursor: pointer;
  position: relative;
}

.template-option input {
  position: absolute;
  opacity: 0;
}

.template-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition-fast);
}

.template-card-icon {
  font-size: 20px;
  color: var(--accent-primary);
  margin-bottom: 2px;
}

.template-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.template-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.template-option input:checked + .template-card {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.template-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Background Radios */
.bg-radio-group {
  display: flex;
  gap: 12px;
}

.bg-radio-option {
  flex: 1;
  cursor: pointer;
}

.bg-radio-option input {
  position: absolute;
  opacity: 0;
}

.bg-radio-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.bg-radio-option input:checked + span {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* Export Dialog & 3 Category Cards */
.export-modal-card {
  max-width: 880px;
  width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
}

.export-settings-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.export-setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-setting-item label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.export-setting-item label i {
  color: #a855f7;
}

.export-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

@media (max-width: 820px) {
  .export-options-grid {
    grid-template-columns: 1fr;
  }
}

.export-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-normal);
  color: inherit;
  font-family: inherit;
  overflow: hidden;
}

.export-card:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: #a855f7;
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 20px rgba(168, 85, 247, 0.2);
}

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

.export-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.export-card-transparent .export-card-icon {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.export-card-json .export-card-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.export-badge {
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.export-badge.transparent-badge {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.3);
}

.export-badge.json-badge {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.export-card h4 {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.export-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.export-card-action {
  margin-top: auto;
  padding-top: 10px;
}

.export-card-action span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #c084fc;
  transition: all var(--transition-fast);
  width: 100%;
  justify-content: center;
}

.export-card:hover .export-card-action span {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-color: #c084fc;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.4);
}

/* Shortcuts Dialog */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}

kbd {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-family-mono);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Storage Dialog */
.storage-info-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.storage-meter-box {
  background: var(--bg-input);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.meter-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.meter-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.meter-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.storage-actions-grid {
  display: flex;
  gap: 12px;
}

.storage-actions-grid > * {
  flex: 1;
}

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

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 360px;
}

.toast.toast-success {
  border-left-color: var(--accent-emerald);
}

.toast.toast-error {
  border-left-color: var(--accent-rose);
}

.toast.toast-info {
  border-left-color: var(--accent-cyan);
}

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

.toast.toast-fade-out {
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.25s ease;
}

/* Utility Helpers */
.hidden {
  display: none !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}
