/* public/theme.css — shared theme: dark default + light override */

/* Dark defaults */
:root {
  --bg: #3b82f6;
  --bg-2: #2563eb;

  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #334155;
  --card: #0b1220;
  --page: #0a0f1a;

  --glow1: #1d2a46;
  --glow2: #2a1f3e;

  --green: #22c55e;
  --danger: #ef4444;
  --amber: #f59e0b;

  --shadow: 0 10px 30px rgba(2,8,23,.35),
            0 2px 8px rgba(2,8,23,.45);

  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --radius: 12px;
  --control-h: 44px;
}

/* Light override */
[data-theme="light"] {
  --bg: #2563eb;
  --bg-2: #1e40af;

  --text: #111827;
  --muted: #64748b;
  --border: #d8dee7;
  --card: #ffffff;
  --page: #f3f5f9;

  --glow1: #e8f0ff;
  --glow2: #f3e8ff;

  --green: #10b981;
  --danger: #b91c1c;
  --amber: #b45309;

  --shadow: 0 10px 30px rgba(2,8,23,.08),
            0 2px 8px rgba(2,8,23,.06);
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 20% -10%, var(--glow1) 0%, transparent 55%),
    radial-gradient(1000px 500px at 120% 10%, var(--glow2) 0%, transparent 60%),
    var(--page);
  min-width: 320px;
}

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 90ms ease-out both page-out; }
::view-transition-new(root) { animation: 110ms ease-out both page-in; }
@keyframes page-out { to { opacity: 0.92; } }
@keyframes page-in { from { opacity: 0.92; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

button, input, select { font: inherit; }
a { color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* Smooth transitions */
a, .toggle, .btn, .brand .logo {
  transition:
    color .15s ease,
    background-color .15s ease,
    border-color .15s ease,
    box-shadow .20s ease,
    transform .12s ease;
}

/* Shared nav */
.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--s-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display:flex; align-items:center; gap:var(--s-3); min-width: 0; }
.brand .logo {
  width:32px; height:32px; border-radius:10px;
  background:linear-gradient(135deg,var(--bg),var(--bg-2));
  color:#fff; display:grid; place-items:center; box-shadow:var(--shadow);
  font-size: 0;
  text-decoration: none;
}
.brand .logo:focus-visible {
  outline: 2px solid var(--bg);
  outline-offset: 3px;
}
.brand .logo::before {
  content: "S";
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.03em;
}
.brandName { font-weight: 800; color:var(--text); text-decoration:none; }
.brandName:hover { color: color-mix(in oklab, var(--text) 75%, var(--bg) 25%); }

.navActions { position: relative; display:flex; gap:12px; align-items:center; }
.mobileNavButton {
  display: none;
  width: var(--control-h);
  height: var(--control-h);
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.mobileNavButton svg { width: 20px; height: 20px; }
.mobileNavMenu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1000;
  display: grid;
  width: min(260px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.mobileNavMenu[hidden] { display: none; }
.mobileNavMenu a {
  padding: 12px;
  border-radius: 9px;
  text-decoration: none;
  font-weight: 700;
}
.mobileNavMenu a:hover, .mobileNavMenu a:focus-visible {
  outline: none;
  background: color-mix(in oklab, var(--card) 84%, var(--text) 16%);
}

.toggle {
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
}
.toggle:hover {
  border-color:var(--bg);
  box-shadow:0 0 0 3px color-mix(in oklab,var(--bg) 20%,transparent);
}
.toggle:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }

/* Shared Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 var(--s-4);
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  background: var(--bg);
  color: #fff;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(2,8,23,.45),
              0 3px 10px rgba(2,8,23,.5);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }
.btn[disabled] { opacity: .65; cursor: not-allowed; box-shadow: none; }
.btn[disabled]:hover { transform: none; }

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn.secondary:hover {
  background: color-mix(in oklab, var(--card) 88%, var(--text) 12%);
  border-color: color-mix(in oklab, var(--border) 60%, var(--bg) 40%);
}

.btn.warn {
  background: #f97316;
  color: #fff;
}

/* --- Toast Notifications --- */
#toastContainer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 3000;
}

.pageHeader { margin-bottom: var(--s-5); }
.pageHeader h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 36px); }
.pageHeader p { margin: 0; color: var(--muted); line-height: 1.55; }

.stateCard {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 40px 24px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  place-content: center;
}
.stateCard strong { color: var(--text); font-size: 17px; }
.stateCard p { max-width: 420px; margin: 0; line-height: 1.5; }
.stateCard .btn { margin-top: 6px; }

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  transform: translateX(40px);
  opacity: 0;
  animation: toast-in .35s ease forwards;
}

.toast svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ✅ Solid colored backgrounds instead of dark with border */
.toast.success {
  border: 1px solid color-mix(in oklab, var(--green) 38%, var(--border));
  background: color-mix(in oklab, var(--card) 88%, var(--green) 12%);
  color: var(--text);
}
.toast.success svg { color: color-mix(in oklab, var(--green) 72%, var(--text)); }
.toast.success button { color: var(--text); }
.toast.error {
  background: var(--danger);
}
.toast.info {
  background: var(--bg);
}

/* Action buttons (Undo etc.) */
.toast button {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.toast button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Animations */
@keyframes toast-in {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateX(40px); opacity: 0; }
}

@media (max-width: 720px) {
  .nav { padding: 16px; }
  .navActions { gap: 8px; }
  .navActions > .btn.secondary { display: none; }
  .mobileNavButton { display: grid; }
  .toggle { width: var(--control-h); height: var(--control-h); padding: 0; }
  #toastContainer { left: 16px; right: 16px; bottom: 16px; }
  .toast { width: 100%; min-width: 0; max-width: none; }
}

@media (max-width: 370px) {
  .brandName { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
