/* =========================================================
   PiggyTask theme tokens
   <html data-theme="piggy|emerald" data-mode="dark|light">
   Add a new theme = add one block per mode below.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --font: 'Outfit', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-w: 260px;
  --header-h: 64px;
  --bottomnav-h: 66px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Piggy · dark (current look) ---------- */
[data-theme="piggy"][data-mode="dark"] {
  --brand-1: #f062a4;
  --brand-2: #9b5cf0;
  --brand-grad: linear-gradient(135deg, #f062a4, #9b5cf0);
  --bg: #0d0b14;
  --bg-glow-1: rgba(240, 98, 164, .18);
  --bg-glow-2: rgba(155, 92, 240, .16);
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .07);
  --surface-solid: #16131f;
  --border: rgba(255, 255, 255, .08);
  --text: #f4f1fa;
  --text-muted: #a49cb8;
  --on-brand: #ffffff;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/* ---------- Piggy · light ---------- */
[data-theme="piggy"][data-mode="light"] {
  --brand-1: #e64a93;
  --brand-2: #8445e6;
  --brand-grad: linear-gradient(135deg, #e64a93, #8445e6);
  --bg: #faf7fd;
  --bg-glow-1: rgba(230, 74, 147, .10);
  --bg-glow-2: rgba(132, 69, 230, .08);
  --surface: #ffffff;
  --surface-2: #f3eef9;
  --surface-solid: #ffffff;
  --border: #ebe4f3;
  --text: #1d1530;
  --text-muted: #6e6485;
  --on-brand: #ffffff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(60, 30, 100, .08);
}

/* ---------- Emerald · light (green & white) ---------- */
[data-theme="emerald"][data-mode="light"] {
  --brand-1: #10b981;
  --brand-2: #059669;
  --brand-grad: linear-gradient(135deg, #22c55e, #059669);
  --bg: #f6fbf8;
  --bg-glow-1: rgba(16, 185, 129, .10);
  --bg-glow-2: rgba(34, 197, 94, .07);
  --surface: #ffffff;
  --surface-2: #ecf8f2;
  --surface-solid: #ffffff;
  --border: #dcefe5;
  --text: #0f2a1e;
  --text-muted: #5b7468;
  --on-brand: #ffffff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(6, 78, 59, .08);
}

/* ---------- Emerald · dark ---------- */
[data-theme="emerald"][data-mode="dark"] {
  --brand-1: #34d399;
  --brand-2: #10b981;
  --brand-grad: linear-gradient(135deg, #34d399, #059669);
  --bg: #07130e;
  --bg-glow-1: rgba(52, 211, 153, .14);
  --bg-glow-2: rgba(16, 185, 129, .10);
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .07);
  --surface-solid: #0e1f17;
  --border: rgba(255, 255, 255, .08);
  --text: #ecfdf5;
  --text-muted: #94b8a8;
  --on-brand: #04130c;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/* =========================================================
   Base + shared components (used by user AND admin)
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px circle at 0% 0%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px circle at 100% 100%, var(--bg-glow-2), transparent 60%);
}
a { color: var(--brand-1); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.icon { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--text); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-grad); display: grid; place-items: center; font-size: 1.15rem; box-shadow: 0 6px 18px var(--bg-glow-1); }
.brand-text span { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(14px); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px; border: 1px solid transparent; font: 600 .95rem var(--font); cursor: pointer; transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand-grad); color: var(--on-brand); box-shadow: 0 8px 22px var(--bg-glow-1); }
.btn-primary:hover { box-shadow: 0 10px 28px var(--bg-glow-1); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand-1); }

.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; transition: border-color .2s, transform .15s; }
.icon-btn:hover { border-color: var(--brand-1); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface-solid); }

/* theme toggle icon swap */
[data-mode="dark"] .when-light, [data-mode="light"] .when-dark { display: none; }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--text-muted); }
.badge-brand { background: var(--brand-grad); color: var(--on-brand); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px; }
.alert-success { border-color: var(--success); color: var(--success); }
.alert-danger { border-color: var(--danger); color: var(--danger); }

/* ---------- Shared shell layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface-solid); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
  transition: transform .3s var(--ease);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 18px; }
.sidebar-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 850; color: var(--text-muted); padding: 14px 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text-muted); font-size: .92rem; font-weight: 600; transition: background .2s, color .2s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--brand-1); }
.nav-link.active .icon { color: var(--brand-1); }
.nav-link .badge { margin-left: auto; }
.nav-link.locked { opacity: .55; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 10px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 800; font-size: 1.15rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { flex: 1; padding: 24px; width: 100%; max-width: 1240px; margin: 0 auto; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.65rem; }
.page-head p { margin: 0; color: var(--text-muted); font-size: .94rem; }

.site-footer { padding: 18px 24px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--brand-1); }

.avatar { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-grad); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; overflow: hidden; }
.avatar:has(img),
.avatar.has-img { background: transparent !important; box-shadow: none !important; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.user-chip small { display: block; color: var(--text-muted); font-size: .80rem; }

.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .3s; }
.menu-btn { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .backdrop { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px; }
  .hide-mobile { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Light-mode card visibility ---------- */
/* In light mode --surface is #fff and bg is #faf7fd - cards need a shadow to stand out */
[data-mode="light"] .card,
[data-mode="light"] .stat-card,
[data-mode="light"] .level-card,
[data-mode="light"] .streak-card,
[data-mode="light"] .earn-card,
[data-mode="light"] .activity-card,
[data-mode="light"] .ref-card {
  box-shadow: 0 2px 12px rgba(60,30,100,.09), 0 1px 3px rgba(60,30,100,.06);
  border-color: #e0d8f0;
}
[data-mode="light"] .stat-card:hover {
  box-shadow: 0 8px 32px rgba(60,30,100,.14), 0 2px 8px rgba(60,30,100,.08) !important;
}

/* ---------- Google Translate UI Suppression ---------- */
.goog-te-banner-frame,
iframe.goog-te-banner-frame,
iframe[class*="goog-te-banner-frame"],
.skiptranslate > iframe,
.VIpgJd-ZVi9od-ORHb-Oxf5td,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  border: none !important;
}

body {
  top: 0px !important;
  position: static !important;
}

body.translated-ltr,
body.translated-rtl {
  margin-top: 0px !important;
  top: 0px !important;
}

#goog-gt-tt,
.goog-te-balloon-frame {
  display: none !important;
}

.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}
