/* ═══════════════════════════════════════════════════════════════
   WINDOW — Global Styles
   Shared across every page
═══════════════════════════════════════════════════════════════ */

/* ─── GOOGLE FONTS ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── CSS VARIABLES ────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-primary:    #0D0D14;
  --bg-secondary:  #14141E;
  --bg-elevated:   #1A1A2E;
  --bg-card:       #111119;

  --accent-cyan:   #00D4FF;
  --accent-purple: #6C3FF5;
  --accent-grad:   linear-gradient(135deg, #00D4FF 0%, #6C3FF5 100%);
  --accent-grad-r: linear-gradient(135deg, #6C3FF5 0%, #00D4FF 100%);

  --text-primary:  #F0F0F5;
  --text-secondary:#8A8A9A;
  --text-muted:    #4A4A5A;

  --border:        #1E1E2E;
  --border-light:  #2A2A3E;
  --border-accent: rgba(0, 212, 255, 0.2);

  --success:       #00D4A1;
  --warning:       #FFB800;
  --error:         #FF4757;

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

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 48px rgba(0,0,0,0.5);
  --shadow-cyan: 0 0 24px rgba(0,212,255,0.15);
  --shadow-card: 0 2px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;

  /* Nav height */
  --nav-height: 64px;
  --nav-bg: rgba(13,13,20,0.9);
}

/* ─── LIGHT THEME ──────────────────────────────────────────────
   Activated by <html data-theme="light">. Toggled + persisted by
   the Theme module in main.js. All the same variables, so every
   component that already uses var(--bg-primary) etc. just works.
═══════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  --nav-bg: rgba(255,255,255,0.9);
  --bg-primary:    #FFFFFF;
  --bg-secondary:  #F4F5F9;
  --bg-elevated:   #E8EAF1;
  --bg-card:       #FFFFFF;

  --accent-cyan:   #0099CC;
  --accent-purple: #6C3FF5;
  --accent-grad:   linear-gradient(135deg, #0099CC 0%, #6C3FF5 100%);
  --accent-grad-r: linear-gradient(135deg, #6C3FF5 0%, #0099CC 100%);

  --text-primary:  #14141E;
  --text-secondary:#5A5A6E;
  --text-muted:    #9393A3;

  --border:        #E4E6ED;
  --border-light:  #D5D8E2;
  --border-accent: rgba(0, 153, 204, 0.25);

  --success:       #00966F;
  --warning:       #B9820A;
  --error:         #D6304A;

  --shadow-sm:   0 2px 8px rgba(20,20,30,0.06);
  --shadow-md:   0 4px 24px rgba(20,20,30,0.08);
  --shadow-lg:   0 8px 48px rgba(20,20,30,0.10);
  --shadow-cyan: 0 0 24px rgba(0,153,204,0.12);
  --shadow-card: 0 2px 16px rgba(20,20,30,0.06), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* Smooth, non-jarring transition when switching themes */
html, body, .nav, .card, .btn, input, select, textarea {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.theme-toggle-btn-floating {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 998;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; font-family: var(--font); }
input, textarea, select { font-family: var(--font); outline: none; }
ul, ol { list-style: none; }

/* ─── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── SELECTION ─────────────────────────────────────────────── */
::selection { background: rgba(0,212,255,0.2); color: var(--text-primary); }

/* ─── TYPOGRAPHY ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { color: var(--text-secondary); line-height: 1.7; }

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

.text-sm  { font-size: 0.875rem; }
.text-xs  { font-size: 0.75rem; }
.text-lg  { font-size: 1.125rem; }
.text-xl  { font-size: 1.25rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-cyan      { color: var(--accent-cyan); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-error     { color: var(--error); }

/* ─── NAVIGATION ────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  z-index: 1000;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.nav-logo-img {
  width: 30px !important;
  height: 30px !important;
  max-width: 30px;
  max-height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated);
  display: block;
}

.nav-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
  position: relative;
}

.nav-link:hover,
.nav-link.active { color: var(--text-primary); }

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent-grad);
  border-radius: var(--radius-full);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,212,255,0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,212,255,0.3);
}

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

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

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}

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

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-danger {
  background: rgba(255,71,87,0.1);
  color: var(--error);
  border: 1px solid rgba(255,71,87,0.2);
}

.btn-danger:hover { background: rgba(255,71,87,0.2); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* .btn-loading is defined further down in the WINDOW BRANDED LOADER section */

/* ─── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-glow:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-cyan);
}

.card-flat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

/* ─── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-new      { background: rgba(0,212,255,0.12); color: var(--accent-cyan); border: 1px solid rgba(0,212,255,0.2); }
.badge-hot      { background: rgba(255,184,0,0.12); color: var(--warning); border: 1px solid rgba(255,184,0,0.2); }
.badge-rising   { background: rgba(0,212,161,0.12); color: var(--success); border: 1px solid rgba(0,212,161,0.2); }
.badge-premium  { background: rgba(108,63,245,0.15); color: #A78BFA; border: 1px solid rgba(108,63,245,0.25); }
.badge-early    { background: rgba(255,71,87,0.12); color: var(--error); border: 1px solid rgba(255,71,87,0.2); }

/* ─── FORM ELEMENTS ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }

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

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition);
  width: 100%;
}

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

.form-input:focus {
  border-color: var(--accent-cyan);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}

.form-input.error { border-color: var(--error); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(255,71,87,0.1); }

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint { font-size: 0.8rem; color: var(--text-muted); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238A8A9A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ─── DIVIDER ───────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── AVATAR ────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }

/* ─── SKELETON LOADER ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-light) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 70%; }
.skeleton-title { height: 20px; margin-bottom: 12px; }
.skeleton-card { height: 180px; border-radius: var(--radius-lg); }

/* ─── TOAST NOTIFICATIONS ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  animation: slideInRight 0.3s ease;
  max-width: 320px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--error); }
.toast-info    { border-left: 3px solid var(--accent-cyan); }
.toast-warning { border-left: 3px solid var(--warning); }

.toast.removing { animation: slideOutRight 0.3s ease forwards; }

/* ─── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }

/* ─── PROGRESS BAR ──────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-grad);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ─── TAGS ──────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.tag:hover, .tag.active {
  background: rgba(0,212,255,0.08);
  border-color: var(--border-accent);
  color: var(--accent-cyan);
}

/* ─── PAGE WRAPPER ──────────────────────────────────────────── */
.page {
  min-height: 100vh;
  padding-top: var(--nav-height);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.container-sm {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.container-md {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* ─── GRID ──────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

/* ─── FLEX UTILITIES ────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.gap-xl  { gap: var(--space-xl); }
.flex-1  { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* ─── SPACING UTILITIES ─────────────────────────────────────── */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* ─── PREMIUM GLOW ELEMENTS ─────────────────────────────────── */
.glow-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan), 0 0 12px rgba(0,212,255,0.4);
  animation: pulse 2s ease-in-out infinite;
}

.gradient-border {
  position: relative;
  border-radius: var(--radius-lg);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--accent-grad);
  z-index: -1;
}

/* ─── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.empty-state h3 { color: var(--text-secondary); font-weight: 600; }
.empty-state p  { color: var(--text-muted); font-size: 0.9rem; max-width: 280px; }

/* ─── PREMIUM LOCK OVERLAY ──────────────────────────────────── */
.premium-lock {
  position: relative;
  overflow: hidden;
}

.premium-lock::after {
  content: '🔒 Premium';
  position: absolute;
  inset: 0;
  background: rgba(13,13,20,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

/* ─── ANIMATIONS ────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.9); }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

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

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

@keyframes window-pulse-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.08); }
}

/* ─── WINDOW BRANDED LOADER ─────────────────────────────────────
   A two-ring orbiting spinner in the brand gradient, used for
   full-page loads and any async action (login, signup, refresh).
   Usage: <div class="window-loader window-loader-md"></div>
═══════════════════════════════════════════════════════════════ */
.window-loader {
  --wl-size: 44px;
  width: var(--wl-size);
  height: var(--wl-size);
  position: relative;
  display: inline-block;
}

.window-loader::before,
.window-loader::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}

.window-loader::before {
  border-top-color: var(--accent-cyan);
  border-right-color: var(--accent-cyan);
  animation: window-spin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.window-loader::after {
  inset: 7px;
  border-bottom-color: var(--accent-purple);
  border-left-color: var(--accent-purple);
  animation: window-spin-reverse 1.3s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.window-loader-sm  { --wl-size: 20px; }
.window-loader-md  { --wl-size: 44px; }
.window-loader-lg  { --wl-size: 72px; }

/* ─── FULL-PAGE LOADER OVERLAY ──────────────────────────────────
   Shown briefly on page load / navigation / refresh so users never
   see a blank white/plain screen. Auto-injected by main.js.
═══════════════════════════════════════════════════════════════ */
#window-page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-lg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#window-page-loader.window-loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.window-page-loader-mark {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.window-page-loader-mark::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent-grad);
  filter: blur(14px);
  animation: window-pulse-glow 1.6s ease-in-out infinite;
}

.window-page-loader-brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── BUTTON LOADER (replaces label text with the spinner) ────── */
.btn-loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-right-color: #fff;
  border-radius: 50%;
  animation: window-spin 0.6s linear infinite;
}

.btn-secondary.btn-loading::after,
.btn-ghost.btn-loading::after {
  border: 2.5px solid rgba(0,212,255,0.2);
  border-top-color: var(--accent-cyan);
  border-right-color: var(--accent-purple);
}

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  .container,
  .container-sm,
  .container-md { padding: 0 var(--space-md); }

  .nav { padding: 0 var(--space-md); }

  .nav-links { display: none; }

  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  .toast-container {
    bottom: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
  }

  .toast { max-width: 100%; }

  .modal { padding: var(--space-lg); }
}

@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }

  .btn-lg { padding: 12px 20px; font-size: 0.95rem; }
}

/* ─── DARK NOISE TEXTURE ────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  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)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

body > * { position: relative; z-index: 1; }
