/* ============================================================
   Ogaal AI — Shared Design System
   Unified dark, enterprise-grade theme tokens + components used
   across index.html, business_suite.html and wizard.html.
   Loaded AFTER the Tailwind CDN script so it can layer on top of
   (and where needed, override) utility classes.
   ============================================================ */

:root {
  /* -------- Brand -------- */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --accent: #8b5cf6;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --gradient-brand: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  --gradient-brand-hover: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
  --gradient-text: linear-gradient(90deg, #eef2ff 0%, #c7d2fe 45%, #a5b4fc 100%);

  /* -------- Surfaces (dark, layered) -------- */
  --bg: #05070d;
  --bg-elevated: #0a0f1d;
  --bg-gradient: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
                 radial-gradient(1000px 500px at 90% 0%, rgba(139, 92, 246, 0.12), transparent 55%),
                 linear-gradient(180deg, #05070d 0%, #0a0f1d 100%);
  --surface: rgba(15, 23, 42, 0.66);
  --surface-solid: #0f172a;
  --surface-hover: rgba(30, 41, 59, 0.8);
  --surface-2: #111827;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --divider: rgba(148, 163, 184, 0.12);

  /* -------- Text -------- */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-brand: #ffffff;

  /* -------- Shape & motion -------- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.25), 0 8px 32px rgba(99, 102, 241, 0.25);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;
  --dur: 250ms;
  --dur-slow: 400ms;

  /* -------- Layout -------- */
  --bottom-nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --topbar-height: 70px;
}

/* ============================================================
   Base
   ============================================================ */
.og-app {
  background: var(--bg-gradient);
  color: var(--text-primary);
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

::selection {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

@keyframes og-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes og-fade-in-right {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes og-pop {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes og-pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.45); }
  100% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
}
@keyframes og-spin { to { transform: rotate(360deg); } }
@keyframes og-shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

.og-animate-in { animation: og-fade-in var(--dur-slow) var(--ease) both; }

/* ============================================================
   Glass cards, buttons, badges, inputs — reusable primitives
   ============================================================ */
.og-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.og-card-hover { transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.og-card-hover:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }

.og-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.og-btn:active { transform: scale(0.97); }
.og-btn-primary {
  background: var(--gradient-brand);
  color: var(--text-on-brand);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}
.og-btn-primary:hover { background: var(--gradient-brand-hover); box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45); }
.og-btn-outline {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.og-btn-outline:hover { background: rgba(148, 163, 184, 0.16); border-color: rgba(148, 163, 184, 0.5); }
.og-btn-ghost { background: transparent; color: var(--text-secondary); }
.og-btn-ghost:hover { color: var(--text-primary); background: rgba(148, 163, 184, 0.08); }

.og-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
.og-badge-brand { background: rgba(99, 102, 241, 0.16); color: #c7d2fe; border: 1px solid rgba(99, 102, 241, 0.35); }
.og-badge-success { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.og-badge-pending { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.og-badge-danger { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }

.og-input, .og-textarea, .og-select {
  width: 100%;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.og-input::placeholder, .og-textarea::placeholder { color: var(--text-muted); }
.og-input:focus, .og-textarea:focus, .og-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* ============================================================
   Bottom Navigation (mobile) — shared by index.html & business_suite.html
   ============================================================ */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 210;
  display: none;
  align-items: stretch;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
}

.bottom-nav-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item i, .bottom-nav-item svg {
  font-size: 1.15rem;
  width: 22px;
  height: 22px;
  margin-bottom: 1px;
  transition: transform var(--dur-fast) var(--ease);
}
.bottom-nav-item.active { color: var(--primary-light); }
.bottom-nav-item.active i, .bottom-nav-item.active svg { transform: translateY(-1px); }
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 2px;
  width: 28px;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
}
.bottom-nav-item:active { color: var(--primary-light); }

.bottom-nav-more-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 220;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  background: var(--surface-solid);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.25rem 1.25rem calc(1.25rem + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.bottom-nav-more-sheet.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.bottom-nav-more-sheet .sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  margin: 0 auto 1rem;
}
.bottom-nav-more-sheet .sheet-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.5rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--divider);
  text-decoration: none;
  cursor: pointer;
}
.bottom-nav-more-sheet .sheet-item:last-child { border-bottom: none; }
.bottom-nav-more-sheet .sheet-item i { width: 20px; color: var(--primary-light); }

.bottom-nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 215;
  background: rgba(2, 6, 23, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.bottom-nav-scrim.open { opacity: 1; pointer-events: auto; }

@media (max-width: 992px) {
  .bottom-nav { display: flex; }
  body.has-bottom-nav .og-scroll-pad,
  body.has-bottom-nav #main-content,
  body.has-bottom-nav #main-content-wrapper > main {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 24px) !important;
  }
}

/* ============================================================
   Scene Timeline / Flow Scene Builder primitives
   (shared shapes used by business_suite.html & wizard.html)
   ============================================================ */
.scene-timeline {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.35rem 0.1rem 1rem;
  scroll-snap-type: x proximity;
}
.scene-timeline::-webkit-scrollbar { height: 6px; }

.scene-chip {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 132px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  position: relative;
}
.scene-chip:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.scene-chip.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22); }
.scene-chip .chip-media {
  height: 76px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(139, 92, 246, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
}
.scene-chip .chip-media video, .scene-chip .chip-media img {
  width: 100%; height: 100%; object-fit: cover;
}
.scene-chip .chip-index {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: rgba(2, 6, 23, 0.7);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scene-chip .chip-status {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: #fff;
}
.scene-chip .chip-status.pending { background: rgba(100, 116, 139, 0.9); }
.scene-chip .chip-status.generating { background: var(--primary); animation: og-pulse-ring 1.6s ease-out infinite; }
.scene-chip .chip-status.completed { background: var(--secondary); }
.scene-chip .chip-status.error { background: var(--danger); }
.scene-chip .chip-body { padding: 0.5rem 0.6rem 0.65rem; }
.scene-chip .chip-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scene-progress-ring {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: og-spin 0.8s linear infinite;
}

/* ============================================================
   Slide-over panel (edit-scene modal, etc.)
   ============================================================ */
.og-slideover-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.og-slideover-backdrop.visible { opacity: 1; pointer-events: auto; }

.og-slideover {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 301;
  width: min(480px, 100vw);
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
  display: flex;
  flex-direction: column;
}
.og-slideover-backdrop.visible .og-slideover { transform: translateX(0); }

@media (max-width: 640px) {
  .og-slideover { width: 100vw; border-radius: var(--radius-xl) var(--radius-xl) 0 0; top: auto; height: 88vh; border-left: none; border-top: 1px solid var(--border); transform: translateY(100%); }
  .og-slideover-backdrop.visible .og-slideover { transform: translateY(0); }
}
