/* ADMIN PANEL STORE - shared theme layer.
   Loaded after each page's inline theme block. Holds the new component classes
   (sidebar, top bar, footer, stat cards, auth split layout) plus global table and focus styles.
   Palette variables live in the inline :root / .dark blocks, so they stay in one place per page. */

/* ---------- Sidebar (logged-in shell) ---------- */
.px-sidebar {
  background: linear-gradient(180deg, #0D0A1B 0%, #05040B 100%);
  border-color: rgba(139, 92, 246, 0.22);
}
.px-nav-link {
  position: relative;
  color: #A1A1AA;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.px-nav-link i { color: #8B5CF6; transition: color .2s ease; }
.px-nav-link:hover {
  color: #F8FAFC;
  background-color: rgba(139, 92, 246, 0.10);
}
.px-nav-link:hover i { color: #C084FC; }
.px-nav-link.is-active {
  color: #F8FAFC;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.28), rgba(139, 92, 246, 0.04));
  box-shadow: inset 3px 0 0 #A855F7, 0 0 18px rgba(139, 92, 246, 0.20);
}
.px-nav-link.is-active i { color: #C084FC; }

/* ---------- Top bar and footer ---------- */
.px-topbar {
  background-color: rgba(5, 4, 11, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(139, 92, 246, 0.18);
}
.px-footer {
  background-color: rgba(10, 8, 21, 0.9);
  border-color: rgba(139, 92, 246, 0.18);
}

/* ---------- Statistic cards ---------- */
.px-stat {
  background: #0D0A1B;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 16px;
  box-shadow: 0 8px 24px -14px rgba(15, 23, 42, 0.25);
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.dark .px-stat {
  background: linear-gradient(145deg, rgba(13, 10, 27, 0.92), rgba(5, 4, 11, 0.85));
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.px-stat:hover {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.18);
  transform: translateY(-2px);
}

/* Glass cards get the same purple hover as stat cards. Hover selector is deliberately more specific
   than the inline .dark .glass-card rule so it wins regardless of stylesheet order. */
.dark .glass-card:hover {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.18);
}

/* ---------- Tables (dark) ---------- */
.dark table thead th {
  color: #A1A1AA;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 700;
  border-bottom: 1px solid rgba(139, 92, 246, 0.25);
}
.dark table tbody tr {
  border-bottom: 1px solid rgba(139, 92, 246, 0.10);
  transition: background-color .2s ease;
}
.dark table tbody tr:hover { background-color: rgba(139, 92, 246, 0.08); }

/* ---------- Split-screen auth layout (login / register) ---------- */
.px-auth { display: flex; flex-direction: column; min-height: 100vh; width: 100%; }
.px-auth-art {
  display: none;
  position: relative;
  overflow: hidden;
  flex: 1 1 50%;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(168, 85, 247, 0.45), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(139, 92, 246, 0.35), transparent 50%),
    linear-gradient(160deg, #0D0A1B, #05040B);
  border-right: 1px solid rgba(139, 92, 246, 0.2);
}
.px-auth-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.10) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.px-auth-art-inner { position: relative; z-index: 1; padding: 3rem; max-width: 520px; }
.px-auth-mark {
  width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #8B5CF6, #A855F7);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.45);
  color: #fff; font-size: 28px; margin-bottom: 1.5rem;
}
.px-auth-art-title {
  font-size: clamp(2.25rem, 4vw, 3.75rem);
  font-weight: 900; line-height: 1.05; letter-spacing: -.02em;
  background: linear-gradient(90deg, #F8FAFC 0%, #C084FC 60%, #A855F7 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.px-auth-art-copy { margin-top: 1rem; color: #A1A1AA; font-size: 1rem; line-height: 1.6; }
.px-auth-panel {
  flex: 1 1 50%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
@media (min-width: 1024px) {
  .px-auth { flex-direction: row; }
  .px-auth-art { display: flex; }
}

/* ---------- Focus and motion ---------- */
:focus-visible { outline: 2px solid #A855F7; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Brand tokens ----------
   The pages load the Tailwind CDN, which ignores the Tailwind v4 @theme block in input.css,
   so the --color-brand-* names used by inline styles are defined here. */
:root {
  --color-brand-primary: #8B5CF6;
  --color-brand-secondary: #A855F7;
  --color-brand-bg: #05040B;
  --color-brand-surface: #0D0A1B;
  --color-brand-border: rgba(139, 92, 246, 0.35);
  --color-brand-text: #F8FAFC;
  --color-brand-muted: #A1A1AA;
  --color-brand-success: #22C55E;
  --color-brand-warning: #F59E0B;
  --color-brand-error: #EF4444;
}

/* ---------- Dark canvas (dashboard dark fix) ----------
   Fallback values keep the page dark even if a brand variable fails to resolve,
   so an undefined variable can no longer expose the browser's white canvas. */
html { background-color: #05040B; color-scheme: dark; }
body { background-color: var(--brand-bg, #05040B); color: var(--brand-text, #F8FAFC); }
select option { background-color: var(--brand-surface, #0D0A1B); color: var(--brand-text, #F8FAFC); }

/* ---------- Form controls default to the dark palette ----------
   Element selectors have lower specificity than Tailwind utility classes,
   so any input that sets its own background still uses that class. */
input, select, textarea {
  background-color: var(--brand-surface, #0D0A1B);
  color: var(--brand-text, #F8FAFC);
  border-color: var(--brand-border, #392768);
}
input::placeholder, textarea::placeholder { color: #6B6880; }



/* ==========================================================
   ADMIN PANEL STORE — 2026 premium dark design system
   Shared overrides intentionally apply to legacy pages too.
   ========================================================== */
:root {
  --aps-bg: #08090D;
  --aps-panel: #0D1017;
  --aps-card: #121620;
  --aps-raised: #181E2A;
  --aps-border: rgba(148, 163, 184, .16);
  --aps-border-strong: rgba(139, 92, 246, .34);
  --aps-purple: #8B5CF6;
  --aps-purple-2: #A855F7;
  --aps-text: #F8FAFC;
  --aps-muted: #94A3B8;
  --aps-shadow: 0 18px 48px rgba(0,0,0,.22);
}
html, body { background: var(--aps-bg) !important; color: var(--aps-text); }
body {
  background-image: radial-gradient(ellipse at 12% 0%, rgba(139,92,246,.075), transparent 34%),
                    radial-gradient(ellipse at 95% 100%, rgba(168,85,247,.045), transparent 28%) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.008em;
}
::selection { background: rgba(139,92,246,.35); color: #fff; }
a { transition: color .18s ease, background-color .18s ease, border-color .18s ease; }
button, input, select, textarea { font: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }

/* Application frame */
#application-sidebar, .px-sidebar {
  background: linear-gradient(180deg, #10131D 0%, #0A0C12 100%) !important;
  border-color: var(--aps-border) !important;
  box-shadow: 12px 0 36px rgba(0,0,0,.12);
}
.px-topbar {
  background: rgba(8,9,13,.88) !important;
  border-color: var(--aps-border) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.px-footer { background: rgba(8,9,13,.8) !important; border-color: var(--aps-border) !important; }
#application-sidebar nav a, .px-nav-link {
  border-radius: 10px;
  margin: 2px 8px;
  min-height: 42px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
#application-sidebar nav a:hover, .px-nav-link:hover {
  background: rgba(139,92,246,.10) !important;
  color: #fff !important;
}
.px-nav-link.is-active, #application-sidebar nav a.is-active {
  background: linear-gradient(100deg, rgba(139,92,246,.22), rgba(139,92,246,.07)) !important;
  box-shadow: inset 3px 0 0 var(--aps-purple);
  color: #fff !important;
}
header, nav { border-color: var(--aps-border); }
main, #content, .main-content { min-width: 0; }

/* Consistent cards and content surfaces */
.glass-card, .glass-panel, .px-stat,
[class*="rounded-"][class*="border"][class*="bg-white"],
[class*="rounded-"][class*="shadow"] {
  border-color: var(--aps-border) !important;
}
.glass-card, .glass-panel {
  background: linear-gradient(145deg, rgba(18,22,32,.96), rgba(13,16,23,.96)) !important;
  box-shadow: var(--aps-shadow);
  border-radius: 16px;
}
.px-stat {
  background: linear-gradient(145deg, #151A26, #10131B) !important;
  border: 1px solid var(--aps-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 26px rgba(0,0,0,.16) !important;
}
.px-stat:hover, .glass-card:hover {
  border-color: rgba(139,92,246,.42) !important;
  box-shadow: 0 14px 34px rgba(0,0,0,.22), 0 0 0 1px rgba(139,92,246,.05) !important;
  transform: translateY(-1px);
}
/* Legacy white utility classes are normalized across the app. */
.bg-white, .dark .bg-white,
[class~="bg-gray-50"], [class~="bg-gray-100"],
.dark [class~="bg-gray-50"], .dark [class~="bg-gray-100"] {
  background-color: var(--aps-card) !important;
}
.text-gray-900, .text-gray-800, .text-black { color: var(--aps-text) !important; }
.text-gray-700, .text-gray-600, .text-gray-500 { color: var(--aps-muted) !important; }
.border-gray-100, .border-gray-200, .border-gray-300 { border-color: var(--aps-border) !important; }

/* Typography and page hierarchy */
h1, h2, h3, h4 { color: var(--aps-text); letter-spacing: -.035em; }
h1 { font-weight: 750; }
p { line-height: 1.6; }
.text-brand-muted { color: var(--aps-muted) !important; }
.text-brand-primary { color: #B9A0FF !important; }
.bg-brand-primary { background-color: var(--aps-purple) !important; }
.bg-brand-primary\/10 { background-color: rgba(139,92,246,.12) !important; }

/* Form controls: dark, readable, consistent */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select, textarea {
  background-color: #0B0E15 !important;
  color: var(--aps-text) !important;
  border: 1px solid rgba(148,163,184,.22) !important;
  border-radius: 10px;
  min-height: 42px;
  box-shadow: none;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus {
  outline: none;
  border-color: rgba(139,92,246,.8) !important;
  box-shadow: 0 0 0 3px rgba(139,92,246,.14) !important;
}
input::placeholder, textarea::placeholder { color: #687386 !important; opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--aps-purple); }
select option { background: #121620 !important; color: #F8FAFC !important; }
label { color: #CBD5E1; }

/* Buttons and actions */
button, .btn, a.btn, input[type="submit"] { transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
button:disabled, input[type="submit"]:disabled { opacity: .65; cursor: wait; }
.btn-primary, .bg-brand-primary {
  box-shadow: 0 5px 16px rgba(139,92,246,.16);
}
button:hover:not(:disabled), .btn:hover, input[type="submit"]:hover:not(:disabled) { filter: brightness(1.07); }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
:focus-visible { outline: 2px solid #A78BFA !important; outline-offset: 3px; }

/* Tables and data lists */
table { border-collapse: separate; border-spacing: 0; width: 100%; }
table thead th {
  background: #10141D !important;
  color: #94A3B8 !important;
  border-bottom: 1px solid var(--aps-border) !important;
  padding-top: 13px !important;
  padding-bottom: 13px !important;
}
table tbody td { border-color: rgba(148,163,184,.10) !important; }
table tbody tr:hover { background: rgba(139,92,246,.055) !important; }
.overflow-x-auto { max-width: 100%; }
hr { border-color: var(--aps-border) !important; }

/* Status pills and dialogs */
dialog, [role="dialog"], .modal-content {
  background: #121620;
  color: var(--aps-text);
  border: 1px solid var(--aps-border);
  border-radius: 16px;
}
.alert, [role="alert"] { border-radius: 12px; }
#loadingOverlay {
  background: rgba(8,9,13,.88) !important;
  color: var(--aps-text) !important;
  backdrop-filter: blur(12px);
}
.spinner, .spinner-border { border-color: rgba(139,92,246,.22); border-top-color: var(--aps-purple); }

/* Auth pages */
.px-auth-panel { background: rgba(8,9,13,.72); }
.px-auth-art {
  background: radial-gradient(circle at 30% 20%, rgba(139,92,246,.24), transparent 52%),
              linear-gradient(145deg, #111522, #08090D) !important;
  border-color: var(--aps-border) !important;
}
.px-auth-mark { border-radius: 16px; box-shadow: 0 12px 30px rgba(139,92,246,.22); }
.px-auth-art-title { background: linear-gradient(100deg,#fff 5%,#C4B5FD 62%,#A78BFA); -webkit-background-clip:text; background-clip:text; }
.px-auth-art-copy { color: #A6B0C1; }
form .text-red-500, form .text-red-600 { color: #FCA5A5 !important; }

/* Landing page surfaces */
section, article { scroll-margin-top: 88px; }
@media (max-width: 1023px) {
  #application-sidebar { max-width: 86vw !important; }
  .px-topbar { padding-top: 12px !important; padding-bottom: 12px !important; }
}
@media (max-width: 640px) {
  body { background-image: radial-gradient(ellipse at 50% 0%, rgba(139,92,246,.07), transparent 42%) !important; }
  .px-stat, .glass-card, .glass-panel { border-radius: 13px !important; }
  table { min-width: 640px; }
  .overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  h1 { font-size: clamp(1.55rem, 6vw, 2rem); }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
