/**
 * Morphient AI Platform Manager v1.0.0
 * Copyright 2026 Morphient AI. All Rights Reserved.
 *
 * Module: Core v1.0.0
 * File: aura-base.css
 *
 * Aura Design System — shared foundation for all AdminPanel pages and modules.
 * Load this BEFORE any module-specific stylesheet.
 */

/* ═══════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Aura Palette */
  --accent: #a855f7;
  --accent-alt: #22d3ee;
  --highlight: #fde047;
  --primary: #a855f7;

  /* Semantic Colors */
  --ink: #e0e0e0;
  --muted: #aaaaaa;
  --text-dim: #aaa;
  --danger: #f87171;
  --ok: #34d399;
  --success: #34d399;
  --warning: #fbbf24;

  /* Glass System */
  --bg: transparent;
  --bg-color: #0a0a1a;
  --panel: rgba(30, 30, 50, 0.35);
  --panel-strong: rgba(30, 30, 50, 0.55);
  --panel-bg: rgba(30, 30, 50, 0.35);
  --glass: rgba(255, 255, 255, 0.1);
  --border-glass: rgba(255, 255, 255, 0.1);
  --blur: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.37);

  /* Layout */
  --radius: 12px;
  --border-radius: 12px;
  --radius-sm: 8px;

  /* Typography */
  --font: 'Inter', system-ui, sans-serif;

  /* Transitions */
  --transition: all 0.3s ease;
}


/* ═══════════════════════════════════════════════════════════════════
   2. BASE RESET
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

body, body.bg {
  background: transparent !important;
  color: var(--ink);
  margin: 0;
  padding-top: 12px;
  font: 15px/1.5 var(--font);
}

html { background: transparent !important; }


/* ═══════════════════════════════════════════════════════════════════
   3. TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════ */

.title {
  margin: 0 0 4px;
  font-size: 28px;
  color: var(--ink);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); }

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-alt));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-alt {
  background: linear-gradient(135deg, var(--accent-alt), var(--highlight));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ═══════════════════════════════════════════════════════════════════
   4. LAYOUT
   ═══════════════════════════════════════════════════════════════════ */

.page {
  max-width: none;
  margin: 20px auto;
  padding: 0 20px;
  position: relative;
  z-index: 10;
  background: transparent !important;
}

.hstack {
  display: flex;
  gap: 8px;
  align-items: center;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 8px 0;
}


/* ═══════════════════════════════════════════════════════════════════
   5. GLASS CARD
   ═══════════════════════════════════════════════════════════════════ */

.card, .glass-panel {
  position: relative;
  background: var(--panel);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--glass);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
  color: var(--ink);
  overflow: hidden;
}

/* Blackout: the ambient video is stopped by BackgroundSlider.php (html.ap-blackout, same flag) —
   this is the other half, making the surfaces that actually hold dialogues and forms solid/legible
   instead of their normal 35-55% translucent panel fill. Scoped to content surfaces only: :not(.cp-nav)
   excludes the shell's own nav sidebar, which also carries the shared .card class for its own glass
   styling but is chrome, not a dialog/form area — it (and the empty canvas) are left untouched.
   (Redefining --panel/--panel-strong directly instead was tried and reverted: .cp-nav reads the same
   --panel token via its own .card class, so the variable can't be scoped away from it the way a
   selector can — and it didn't even reach modules whose own CSS hardcodes a colour instead of the
   token, e.g. SiteGallery's cards. A module with a hand-rolled surface that should also darken under
   blackout needs its own small rule keyed off html.ap-blackout, same as this one.) */
html.ap-blackout .card:not(.cp-nav),
html.ap-blackout .glass-panel,
html.ap-blackout .custom-modal-dialog {
  background: rgba(10, 10, 18, 0.96) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Aurora shimmer on hover */
.card::before, .glass-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.12), transparent);
  transform: skewX(-25deg);
  transition: left 0.7s ease-in-out;
  pointer-events: none;
  z-index: 0;
}

.card:hover::before, .glass-panel:hover::before {
  left: 150%;
}

.card > *, .glass-panel > * {
  position: relative;
  z-index: 1;
}


/* ═══════════════════════════════════════════════════════════════════
   6. BUTTONS
   ═══════════════════════════════════════════════════════════════════ */

.btn {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--glass);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(8px);
  font: 500 14px/1.3 var(--font);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn:hover {
  background: var(--panel-strong);
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.15);
  text-decoration: none;
}

.btn-alt, .btn-primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #fff;
  text-decoration: none;
}

.btn-alt:hover, .btn-primary:hover {
  background: linear-gradient(135deg, #c084fc, var(--accent));
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
  text-decoration: none;
}

.btn-danger {
  background: linear-gradient(135deg, #f87171, #dc2626);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fff;
  text-decoration: none;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #fca5a5, #f87171);
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
  text-decoration: none;
}


/* ═══════════════════════════════════════════════════════════════════
   7. FORM INPUTS
   ═══════════════════════════════════════════════════════════════════ */

label {
  display: block;
  color: var(--ink);
  margin: 2px 0 6px;
  font-weight: 500;
}

input[type=text],
input[type=number],
input[type=email],
input[type=password],
input[type=url],
select,
textarea {
  padding: 10px 12px;
  border: 1px solid var(--glass);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  outline: none;
  backdrop-filter: blur(8px);
  font: 14px/1.4 var(--font);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type=text]:focus,
input[type=number]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=url]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

input[type=text]::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input[type=range] {
  width: 120px;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

input[type=range]:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

.chk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  color: var(--ink);
}


/* ═══════════════════════════════════════════════════════════════════
   8. TABS
   ═══════════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tab {
  background: var(--panel);
  border: 1px solid var(--glass);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  font: 500 13px/1.3 var(--font);
  transition: var(--transition);
}

.tab:hover {
  background: var(--panel-strong);
  border-color: rgba(168, 85, 247, 0.3);
}

.tab.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(124, 58, 237, 0.25));
  border-color: rgba(168, 85, 247, 0.5);
  color: #fff;
}

.panel { display: none; margin-top: 12px; }
.panel.active { display: block; }


/* ═══════════════════════════════════════════════════════════════════
   9. SPINNER
   ═══════════════════════════════════════════════════════════════════ */

.bm-spinner.hidden { display: none; }

.bm-spinner {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
}

.bm-spinner-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.bm-spinner-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid rgba(168, 85, 247, 0.25);
  border-top-color: var(--accent);
  animation: aura-spin 0.8s linear infinite;
}

.bm-spinner-text {
  position: absolute;
  top: 58%;
  color: var(--ink);
  font-size: 14px;
}

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


/* ═══════════════════════════════════════════════════════════════════
   10. TOASTS
   ═══════════════════════════════════════════════════════════════════ */

.bm-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100000;
  display: grid;
  gap: 8px;
  max-width: 360px;
}

.bm-toast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: var(--panel-strong);
  color: var(--ink);
  border: 1px solid var(--glass);
  box-shadow: var(--shadow);
  border-radius: var(--border-radius);
  padding: 10px 14px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(var(--blur));
}

.bm-toast.show { opacity: 1; transform: translateY(0); }
.bm-toast.success { border-left: 4px solid var(--ok); }
.bm-toast.warn { border-left: 4px solid var(--warning); }
.bm-toast.error { border-left: 4px solid var(--danger); }

.bm-toast .bm-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

.bm-toast .bm-close:hover { color: var(--ink); }


/* ═══════════════════════════════════════════════════════════════════
   11. MODAL
   ═══════════════════════════════════════════════════════════════════ */

.bm-modal {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: grid;
  place-items: center;
}

.bm-modal.hidden { display: none; }

.bm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.bm-modal-dialog {
  position: relative;
  background: var(--panel-strong);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass);
  border-radius: var(--border-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  padding: 24px 28px;
  min-width: 320px;
  max-width: 420px;
  animation: aura-modal-in 0.2s ease-out;
}

@keyframes aura-modal-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bm-modal-title { margin: 0 0 12px; font-size: 20px; color: var(--ink); }
.bm-modal-message { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.bm-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.bm-modal-actions .btn { min-width: 90px; }


/* ═══════════════════════════════════════════════════════════════════
   12. THEME TOGGLE
   ═══════════════════════════════════════════════════════════════════ */

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 1%;
  z-index: 100001;
}

.theme-toggle button {
  border: 1px solid var(--glass);
  border-radius: var(--radius-sm);
  width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font: 500 10px/1.3 var(--font);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: var(--shadow);
  padding: 10px;
  margin: 10px;
  background: var(--panel-strong);
  backdrop-filter: blur(var(--blur));
}

.theme-toggle button:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.4);
}


/* ═══════════════════════════════════════════════════════════════════
   13. SCROLLBAR
   ═══════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, 0.5); }


/* ═══════════════════════════════════════════════════════════════════
   14. UTILITIES
   ═══════════════════════════════════════════════════════════════════ */

.right { float: right; }

.footnote {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.grow { min-height: 200px; }
.side { min-height: 200px; }
.hidden { display: none !important; }


/* ═══════════════════════════════════════════════════════════════════
   15. LIGHT THEME
   ═══════════════════════════════════════════════════════════════════ */

[data-theme="light"] {
  --bg: transparent;
  --panel: rgba(255, 255, 255, 0.35);
  --panel-strong: rgba(255, 255, 255, 0.55);
  --panel-bg: rgba(255, 255, 255, 0.35);
  --glass: rgba(0, 0, 0, 0.08);
  --border-glass: rgba(0, 0, 0, 0.08);
  --ink: #1a1a2e;
  --muted: #555;
  --text-dim: #777;
  --accent: #7c3aed;
  --primary: #7c3aed;
  --danger: #dc2626;
  --ok: #16a34a;
  --success: #16a34a;
  --warning: #d97706;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .card,
[data-theme="light"] .glass-panel {
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card::before,
[data-theme="light"] .glass-panel::before {
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.08), transparent);
}

[data-theme="light"] .title,
[data-theme="light"] .subtitle,
[data-theme="light"] label,
[data-theme="light"] .footnote {
  text-shadow: none;
}
