/* =====================================================================================
   CareerLens themes. Chosen on Settings → Appearance, stored per browser (localStorage).
   <html data-theme="…" data-mode="light|dark">. Background effects live in body::before /
   body::after, fixed behind the page, and switch off for people who prefer reduced motion.
   ===================================================================================== */

body::before, body::after { content: none; position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* ---------- 2. Waves: soft layered waves rolling along the bottom ---------- */
[data-theme=waves] { --bg: #f1f6ff; --tint: #e6efff; --surface: rgba(255, 255, 255, .90); }
[data-theme=waves] .card, [data-theme=waves] .stat { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
[data-theme=waves] body::before,
[data-theme=waves] body::after {
    content: ""; top: auto; height: 300px;
    background-repeat: repeat-x; background-size: 1440px 300px; background-position: 0 bottom;
    animation: wave-x 28s linear infinite;
}
[data-theme=waves] body::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 240' preserveAspectRatio='none'%3E%3Cpath fill='%23003bf9' fill-opacity='0.13' d='M0 140 C 240 80 480 200 720 140 C 960 80 1200 200 1440 140 L1440 240 L0 240 Z'/%3E%3C/svg%3E");
}
[data-theme=waves] body::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 240' preserveAspectRatio='none'%3E%3Cpath fill='%2300b3c7' fill-opacity='0.15' d='M0 170 C 360 120 360 220 720 170 C 1080 120 1080 220 1440 170 L1440 240 L0 240 Z'/%3E%3C/svg%3E");
    animation-duration: 18s; animation-direction: reverse;
}
@keyframes wave-x { to { background-position: 1440px bottom; } }

/* ---------- 3. Dots: drifting dotted grid ---------- */
[data-theme=dots] { --bg: #f6f7fb; }
[data-theme=dots] body::before {
    content: "";
    background-image: radial-gradient(rgba(0, 59, 249, .32) 1.6px, transparent 1.9px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.35) 100%);
            mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.35) 100%);
    animation: drift 40s linear infinite;
}
@keyframes drift { to { background-position: 22px 44px; } }

/* ---------- 4. Blueprint: engineering grid paper ---------- */
[data-theme=blueprint] { --bg: #eef4ff; --sidebar-bg: #f7faff; --line: #d7e2fa; --tint: #e3ecff; }
[data-theme=blueprint] body::before {
    content: "";
    background-image:
        linear-gradient(rgba(0, 59, 249, .17) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 59, 249, .17) 1px, transparent 1px),
        linear-gradient(rgba(0, 59, 249, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 59, 249, .05) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}
[data-theme=blueprint] body::after {
    content: ""; height: 140px;
    background: linear-gradient(to bottom, transparent, rgba(0, 59, 249, .12), transparent);
    animation: scan 9s ease-in-out infinite;
}
@keyframes scan { 0% { transform: translateY(-140px); } 100% { transform: translateY(100vh); } }

/* ---------- 5. Aurora: slow-moving coloured light ---------- */
[data-theme=aurora] { --bg: #f5f7ff; --surface: rgba(255, 255, 255, .80); --surface-2: rgba(248, 250, 255, .75); --sidebar-bg: rgba(255, 255, 255, .78); }
[data-theme=aurora] .card, [data-theme=aurora] .stat, [data-theme=aurora] .sidebar { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
[data-theme=aurora] body::before {
    content: ""; inset: -20%;
    background:
        radial-gradient(38% 32% at 20% 30%, rgba(0, 179, 199, .50), transparent 70%),
        radial-gradient(34% 30% at 80% 20%, rgba(0, 59, 249, .40), transparent 70%),
        radial-gradient(40% 34% at 60% 85%, rgba(168, 85, 247, .38), transparent 70%);
    filter: blur(30px);
    animation: aurora 26s ease-in-out infinite alternate;
}
@keyframes aurora {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    50% { transform: translate(4%, -3%) rotate(8deg) scale(1.08); }
    100% { transform: translate(-4%, 3%) rotate(-6deg) scale(1.02); }
}

/* ---------- 6. Glass: frosted panels over a colourful background ---------- */
[data-theme=glass] {
    --bg: #dfe8ff; --surface: rgba(255, 255, 255, .62); --surface-2: rgba(255, 255, 255, .5);
    --sidebar-bg: rgba(255, 255, 255, .55); --line: rgba(255, 255, 255, .7); --tint: rgba(232, 238, 255, .7);
}
[data-theme=glass] body { background: linear-gradient(135deg, #d7e3ff 0%, #ead9ff 50%, #cff3f6 100%) fixed; }
[data-theme=glass] body::before {
    content: ""; inset: -10%;
    background:
        radial-gradient(30% 30% at 15% 20%, rgba(0, 59, 249, .35), transparent 70%),
        radial-gradient(28% 28% at 85% 30%, rgba(236, 72, 153, .28), transparent 70%),
        radial-gradient(32% 32% at 50% 90%, rgba(0, 179, 199, .32), transparent 70%);
    filter: blur(20px);
    animation: aurora 34s ease-in-out infinite alternate;
}
[data-theme=glass] .card, [data-theme=glass] .stat, [data-theme=glass] .sidebar,
[data-theme=glass] .tabs, [data-theme=glass] .empty, [data-theme=glass] .modal {
    -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
}
[data-theme=glass] .input { background: rgba(255, 255, 255, .75); }

/* ---------- 7. Sunset: warm palette with a glowing sun and turning rays ---------- */
[data-theme=sunset] {
    --bg: #fff6ef; --primary: #e8590c; --primary-2: #f43f5e; --primary-soft: #ffeadb; --brand-blue: #e8590c;
    --tint: #ffefe3; --line: #f3e1d3; --sidebar-bg: #fffaf6;
}
[data-theme=sunset] body::before {
    content: ""; inset: auto -120px auto auto; top: -160px; width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, .55), rgba(244, 63, 94, .25) 55%, transparent 70%);
}
[data-theme=sunset] body::after {
    content: ""; inset: auto -420px auto auto; top: -460px; width: 1120px; height: 1120px;
    background: repeating-conic-gradient(from 0deg, rgba(251, 146, 60, .10) 0deg 6deg, transparent 6deg 18deg);
    -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 62%);
            mask-image: radial-gradient(circle, #000 20%, transparent 62%);
    animation: spin-slow 120s linear infinite;
}
[data-theme=sunset] .hero {
    background: radial-gradient(80% 120% at 100% 0%, rgba(251, 191, 36, .55), transparent 60%),
                radial-gradient(70% 110% at 0% 100%, rgba(244, 63, 94, .65), transparent 60%), #3b0d2e;
}
[data-theme=sunset] .hero .btn-primary { color: #e8590c; }
@keyframes spin-slow { to { transform: rotate(360deg); } }

/* ---------- 8. Paper: warm paper texture, serif headings, calm ---------- */
[data-theme=paper] {
    --bg: #f5efe3; --surface: #fffdf8; --surface-2: #faf5ea; --line: #e7dcc8; --line-strong: #d8c9ad;
    --ink: #2b2620; --ink-2: #4a4237; --muted: #7a6f5f; --primary: #1f3a8a; --primary-2: #2f4fb0;
    --primary-soft: #ebe9f5; --sidebar-bg: #fbf6ec; --tint: #f3ecdd; --row-hover: #fbf6ec;
    --shadow: 0 1px 2px rgba(60, 40, 10, .06);
}
[data-theme=paper] body::before {
    content: "";
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.09'/%3E%3C/svg%3E");
}
[data-theme=paper] h1, [data-theme=paper] h2, [data-theme=paper] h3 { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0; }

/* ---------- 9. Midnight (dark): deep navy with twinkling stars ---------- */
[data-theme=midnight] {
    --bg: #070b1a; --surface: #0f1630; --surface-2: #131c3b; --sidebar-bg: #0b1124;
    --primary: #5b8cff; --primary-2: #7c9dff; --brand-blue: #5b8cff;
}
[data-theme=midnight] body::before {
    content: "";
    background-image:
        radial-gradient(1.2px 1.2px at 20px 30px, #fff, transparent),
        radial-gradient(1px 1px at 120px 80px, rgba(255,255,255,.8), transparent),
        radial-gradient(1.4px 1.4px at 200px 160px, rgba(180,200,255,.9), transparent),
        radial-gradient(1px 1px at 60px 190px, rgba(255,255,255,.7), transparent),
        radial-gradient(1.2px 1.2px at 260px 40px, rgba(255,255,255,.85), transparent);
    background-size: 300px 220px; opacity: .55;
}
[data-theme=midnight] body::after {
    content: "";
    background-image:
        radial-gradient(1.6px 1.6px at 90px 120px, #fff, transparent),
        radial-gradient(1.3px 1.3px at 230px 200px, rgba(200,220,255,.9), transparent),
        radial-gradient(1.5px 1.5px at 330px 60px, #fff, transparent);
    background-size: 420px 260px;
    animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .15; } to { opacity: .85; } }

/* ---------- 10. Neon (dark): synthwave grid and glowing edges ---------- */
[data-theme=neon] {
    --bg: #05060d; --surface: #0c0e1c; --surface-2: #111427; --sidebar-bg: #080a16;
    --primary: #22d3ee; --primary-2: #a855f7; --brand-blue: #22d3ee; --line: #1d2140;
    --accent: #f472b6;
}
[data-theme=neon] body::before {
    content: ""; top: auto; height: 55vh;
    background-image:
        linear-gradient(rgba(34, 211, 238, .45) 1px, transparent 1px),
        linear-gradient(90deg, rgba(168, 85, 247, .45) 1px, transparent 1px);
    background-size: 56px 56px;
    transform: perspective(500px) rotateX(62deg); transform-origin: bottom;
    -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 90%);
            mask-image: linear-gradient(to top, #000 10%, transparent 90%);
    animation: grid-run 3s linear infinite;
}
[data-theme=neon] body::after {
    content: "";
    background: radial-gradient(60% 40% at 50% 100%, rgba(168, 85, 247, .22), transparent 70%);
}
@keyframes grid-run { to { background-position: 0 56px, 0 0; } }
[data-theme=neon] .card, [data-theme=neon] .stat {
    border-color: rgba(34, 211, 238, .28);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, .06), 0 0 24px -8px rgba(34, 211, 238, .35);
}
[data-theme=neon] h1 { text-shadow: 0 0 18px rgba(34, 211, 238, .45); }
[data-theme=neon] .btn-primary { box-shadow: 0 0 18px -2px rgba(168, 85, 247, .7); }

/* ---------- Shared dark-mode adjustments (Midnight, Neon) ---------- */
[data-mode=dark] {
    color-scheme: dark;
    --ink: #e7ecff; --ink-2: #c3cbe6; --muted: #8e99bd; --line: #1f2a4d; --line-strong: #2c3a66;
    --primary-soft: #16224a; --tint: #16224a; --row-hover: #141d3a; --track: #1d2850; --nav-label: #6f7ca6;
    --success: #4ade80; --success-soft: #0f2e1f; --warn: #fbbf24; --warn-soft: #33270b;
    --danger: #f87171; --danger-soft: #3a1515;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
}
[data-mode=dark] .brand-logo { background: #fff; padding: 6px 10px; border-radius: 10px; box-sizing: content-box; width: 180px; }
[data-mode=dark] .brand-product strong { color: var(--ink); }
[data-mode=dark] .imp-essential { background: #1b2a5c; color: #a9c0ff; }
[data-mode=dark] .imp-important { background: #0f2d40; color: #7dd3fc; }
[data-mode=dark] .imp-desirable, [data-mode=dark] .prio-low { background: #1c2340; color: #a5afcf; }
[data-mode=dark] .src-declared { border-color: #2c3d7a; background: #141f45; }
[data-mode=dark] .src-project { border-color: #164b66; background: #0e2433; }
[data-mode=dark] .src-experience { border-color: #1d5a3a; background: #0f2a1d; }
[data-mode=dark] .src-certification { border-color: #6b5313; background: #2a220c; }
[data-mode=dark] .tag-gap { border-color: #5c2222; color: #fca5a5; }
[data-mode=dark] .alert-info { background: #0f1f45; border-color: #24407f; color: #bcd0ff; }
[data-mode=dark] .alert-warn { border-color: #6b5313; color: #fcd34d; }
[data-mode=dark] .alert-danger { border-color: #6b2525; color: #fecaca; }
[data-mode=dark] .alert-success { border-color: #1d5a3a; color: #bbf7d0; }
[data-mode=dark] .btn-danger-ghost { border-color: #6b2525; }
[data-mode=dark] .stars button { color: #3a456b; }
[data-mode=dark] .summary { color: var(--ink); }
[data-mode=dark] .input::placeholder { color: #5f6b92; }
[data-mode=dark] .score-card h2, [data-mode=dark] .counts strong { color: var(--ink); }
[data-mode=dark] .site-footer img { filter: brightness(1.2); }

/* ---------- Accessibility: no moving backgrounds if the user asked for reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    body::before, body::after { animation: none !important; }
}

/* =====================================================================================
   Theme picker (Settings → Appearance)
   ===================================================================================== */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; }
.theme-option {
    display: flex; flex-direction: column; gap: .5rem; text-align: left; cursor: pointer; font: inherit; color: var(--ink);
    padding: .6rem; border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.theme-option:hover { transform: translateY(-2px); border-color: var(--line-strong, #cfd4e2); }
.theme-option.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-option strong { font-size: .92rem; display: flex; justify-content: space-between; align-items: center; }
.theme-option small { color: var(--muted); font-size: .76rem; line-height: 1.35; }
.theme-option .fx { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); }
.theme-swatch { position: relative; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(0,0,0,.06); }
.theme-swatch .sw-side { position: absolute; inset: 0 auto 0 0; width: 26%; }
.theme-swatch .sw-card { position: absolute; left: 34%; right: 8%; top: 18%; height: 30%; border-radius: 6px; }
.theme-swatch .sw-card + .sw-card { top: 56%; right: 30%; }
.theme-swatch .sw-dot { position: absolute; left: 7%; top: 12%; width: 12%; aspect-ratio: 1; border-radius: 4px; }

.sw-classic { background: #f4f6fc; } .sw-classic .sw-side { background: #fff; border-right: 1px solid #e3e8f4; } .sw-classic .sw-card { background: #fff; box-shadow: 0 2px 6px rgba(0,15,57,.08); } .sw-classic .sw-dot { background: #003bf9; }
.sw-waves { background: #f1f6ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 60' preserveAspectRatio='none'%3E%3Cpath fill='%23003bf9' fill-opacity='0.12' d='M0 30 C 50 10 100 50 150 30 C 175 20 190 25 200 30 L200 60 L0 60 Z'/%3E%3C/svg%3E") bottom / 100% 55% no-repeat; } .sw-waves .sw-side { background: #fff; } .sw-waves .sw-card { background: #fff; } .sw-waves .sw-dot { background: #003bf9; }
.sw-dots { background: #f6f7fb radial-gradient(rgba(0,59,249,.3) 1px, transparent 1.3px) 0 0 / 8px 8px; } .sw-dots .sw-side { background: #fff; } .sw-dots .sw-card { background: #fff; } .sw-dots .sw-dot { background: #003bf9; }
.sw-blueprint { background: #eef4ff linear-gradient(rgba(0,59,249,.14) 1px, transparent 1px) 0 0 / 12px 12px, linear-gradient(90deg, rgba(0,59,249,.14) 1px, transparent 1px) 0 0 / 12px 12px; } .sw-blueprint .sw-side { background: #f7faff; } .sw-blueprint .sw-card { background: #fff; } .sw-blueprint .sw-dot { background: #003bf9; }
.sw-aurora { background: radial-gradient(60% 60% at 20% 30%, rgba(0,179,199,.45), transparent 70%), radial-gradient(60% 60% at 80% 20%, rgba(0,59,249,.35), transparent 70%), radial-gradient(60% 60% at 60% 90%, rgba(168,85,247,.35), transparent 70%), #f5f7ff; } .sw-aurora .sw-side { background: rgba(255,255,255,.85); } .sw-aurora .sw-card { background: #fff; } .sw-aurora .sw-dot { background: #003bf9; }
.sw-glass { background: radial-gradient(50% 60% at 20% 20%, rgba(0,59,249,.45), transparent 70%), radial-gradient(50% 60% at 85% 40%, rgba(236,72,153,.4), transparent 70%), linear-gradient(135deg, #d7e3ff, #ead9ff 50%, #cff3f6); } .sw-glass .sw-side { background: rgba(255,255,255,.45); } .sw-glass .sw-card { background: rgba(255,255,255,.6); border: 1px solid rgba(255,255,255,.8); } .sw-glass .sw-dot { background: #003bf9; }
.sw-sunset { background: radial-gradient(circle at 92% 0%, rgba(251,191,36,.7), rgba(244,63,94,.3) 35%, transparent 55%), #fff6ef; } .sw-sunset .sw-side { background: #fffaf6; } .sw-sunset .sw-card { background: #fff; } .sw-sunset .sw-dot { background: #e8590c; }
.sw-paper { background: #f5efe3; } .sw-paper .sw-side { background: #fbf6ec; border-right: 1px solid #e7dcc8; } .sw-paper .sw-card { background: #fffdf8; border: 1px solid #e7dcc8; } .sw-paper .sw-dot { background: #1f3a8a; }
.sw-midnight { background: radial-gradient(1px 1px at 30% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 60%, #fff, transparent), radial-gradient(1px 1px at 50% 85%, #cdd9ff, transparent), #070b1a; } .sw-midnight .sw-side { background: #0b1124; } .sw-midnight .sw-card { background: #0f1630; border: 1px solid #1f2a4d; } .sw-midnight .sw-dot { background: #5b8cff; }
.sw-neon { background: linear-gradient(rgba(34,211,238,.5) 1px, transparent 1px) 0 100% / 14px 14px, linear-gradient(90deg, rgba(168,85,247,.5) 1px, transparent 1px) 0 100% / 14px 14px, #05060d; } .sw-neon .sw-side { background: #080a16; } .sw-neon .sw-card { background: #0c0e1c; border: 1px solid rgba(34,211,238,.5); box-shadow: 0 0 8px rgba(34,211,238,.4); } .sw-neon .sw-dot { background: #22d3ee; }

/* =====================================================================================
   See-through sidebar: in every theme except Classic, the background effect continues
   under the side panel. A blur keeps the menu text readable over waves, dots, stars, etc.
   ===================================================================================== */
[data-theme=waves]     { --sidebar-bg: rgba(255, 255, 255, .55); }
[data-theme=dots]      { --sidebar-bg: rgba(255, 255, 255, .62); }
[data-theme=blueprint] { --sidebar-bg: rgba(247, 250, 255, .58); }
[data-theme=aurora]    { --sidebar-bg: rgba(255, 255, 255, .50); }
[data-theme=glass]     { --sidebar-bg: rgba(255, 255, 255, .40); }
[data-theme=sunset]    { --sidebar-bg: rgba(255, 250, 246, .55); }
[data-theme=paper]     { --sidebar-bg: rgba(251, 246, 236, .60); }
[data-theme=midnight]  { --sidebar-bg: rgba(11, 17, 36, .55); }
[data-theme=neon]      { --sidebar-bg: rgba(8, 10, 22, .50); }

[data-theme]:not([data-theme=classic]) .sidebar {
    -webkit-backdrop-filter: blur(10px) saturate(1.3);
            backdrop-filter: blur(10px) saturate(1.3);
}
/* The status card at the bottom of the sidebar gets the same frosted look. */
[data-theme]:not([data-theme=classic]) .engine-card {
    background: color-mix(in srgb, var(--surface) 70%, transparent);
}
