/* Basisstijl voor alle pagina's: kleuren, lettertype, bovenbalk en de mascotte */

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap");

/* Alle kleuren van de site op één plek. De andere CSS-bestanden gebruiken deze variabelen. */
:root {
    --groen-primair: #2c771c;
    --groen-donker: #22601a;
    --groen-licht: #ecf7e2;
    --appel-groen: #7cc242;
    --munt-geel: #f6c443;
    --munt-geel-licht: #fff4d6;
    --blos-roze: #f28b7d;
    --achtergrond: #f5f9ef;
    --kaart-wit: #ffffff;
    --tekst-donker: #1f2a17;
    --tekst-grijs: #5b6b52;
    --rand-grijs: #dde6d2;
    --rood-waarschuwing: #b3261e;
    --rood-licht: #fbeceb;
    --tekst-op-groen: #ffffff;
    --balk-donker: #22601a;
    --balk-licht: #2c771c;
    --schaduw: 0 6px 20px rgba(44, 119, 28, 0.08);
    color-scheme: light;
}

/* Donker thema: thema.js zet data-thema="donker" op <html>. De rest van de CSS gebruikt
   alleen variabelen, dus alle pagina's worden vanzelf donker. */
html[data-thema="donker"] {
    --groen-primair: #8fd16a;
    --groen-donker: #a6e07f;
    --groen-licht: #22311a;
    --achtergrond: #121810;
    --kaart-wit: #1d2618;
    --tekst-donker: #eef3e8;
    --tekst-grijs: #b2bfa8;
    --rand-grijs: #34422c;
    --munt-geel-licht: #2a2512;
    --rood-waarschuwing: #ff8a80;
    --rood-licht: #3a1d1b;
    --tekst-op-groen: #10200a;
    --balk-donker: #12330d;
    --balk-licht: #1c4d14;
    --schaduw: 0 6px 20px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

html, body {
    margin: 0;
    padding: 0;
    /* Zelfde lettertype op alle pagina's (zoals bij Welkom bij BudgetBite) */
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Invoervelden en knoppen nemen standaard het lettertype van de pagina niet over */
input, button, select, textarea {
    font-family: inherit;
}

/* Zachte achtergrond met een groene en een gele gloed */
body {
    min-height: 100vh;
    font-family: "Nunito", "Segoe UI", Arial, sans-serif;
    color: var(--tekst-donker);
    background-color: var(--achtergrond);
    background-image:
        radial-gradient(circle at 0% 0%, var(--groen-licht) 0, transparent 40%),
        radial-gradient(circle at 100% 100%, var(--munt-geel-licht) 0, transparent 35%);
    background-attachment: fixed;
}

h1, h2, h3 {
    font-weight: 800;
}

/* Knoppen en velden nemen anders het lettertype niet over, en steken soms buiten hun kaart */
button, input, select, textarea {
    font-family: inherit;
    box-sizing: border-box;
}

/* =========================
   BOVENBALK
   ========================= */

.bovenbalk {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--balk-donker), var(--balk-licht));
    border-bottom: 4px solid var(--munt-geel);
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    /* Balk blijft bovenaan staan als je scrolt */
    position: sticky;
    top: 0;
    z-index: 20;
}

.bovenbalk h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    color: white;
    letter-spacing: 0.5px;
}

/* De titel is een link naar home, met het spaarappeltje ervoor */
.bovenbalk h1 a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
}

/* Ook op pagina's waar de titel geen link is (inloggen, registreren) */
.bovenbalk h1 a::before,
.bovenbalk h1:not(:has(a))::before {
    content: "";
    width: 48px;
    height: 48px;
    background: url("../img/spaarappel.svg") center / contain no-repeat;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.navigatie {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navigatie a {
    display: block;
    padding: 8px 16px;
    border-radius: 999px;
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    transition: background-color 0.15s ease;
}

.navigatie a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Velden zonder eigen achtergrond zijn in het donkere thema anders standaard grijs */
html[data-thema="donker"] input,
html[data-thema="donker"] select,
html[data-thema="donker"] textarea {
    background-color: var(--achtergrond);
    border-color: var(--rand-grijs);
    color: var(--tekst-donker);
}

/* Rustige overgang bij het wisselen van thema */
body,
.voorkeuren-groep,
.card,
.panel,
section.inloggen,
section.registreren {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* =========================
   KAARTEN
   ========================= */

/* Een <legend> staat standaard half boven de rand van de kaart. Met float komt hij
   er netjes in te staan, als kopje met een groen bolletje ervoor. */
.voorkeuren-groep > legend,
.budget-groep > legend {
    float: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 12px 0;
    font-size: 15px;
    font-weight: 800;
}

.voorkeuren-groep > legend::before,
.budget-groep > legend::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--appel-groen);
    box-shadow: 0 0 0 3px var(--groen-licht);
}

/* Alles na het kopje begint op een nieuwe regel */
.voorkeuren-groep > legend + *,
.budget-groep > legend + * {
    clear: both;
}

/* =========================
   TIP VAN HET SPAARAPPELTJE
   ========================= */

/* Het appeltje met een tekstballon, onderaan de smallere pagina's */
.mascotte-tip {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-top: 28px;
}

.mascotte-tip img {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 4px 6px rgba(44, 119, 28, 0.2));
}

.mascotte-tip p {
    position: relative;
    margin: 0 0 20px 0;
    padding: 14px 16px;
    background-color: var(--munt-geel-licht);
    border: 2px solid var(--munt-geel);
    border-radius: 18px 18px 18px 4px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--tekst-donker);
}

.mascotte-tip strong {
    display: block;
    margin-bottom: 2px;
    color: var(--groen-primair);
}

/* =========================
   MASCOTTE OP INLOGGEN EN REGISTREREN
   ========================= */

section.inloggen,
section.registreren {
    position: relative;
    box-sizing: border-box;
    width: calc(100% - 32px);
    margin-top: 90px;
    padding-top: 60px;
}

/* Het appeltje staat bovenop de kaart en wiebelt een beetje */
section.inloggen::before,
section.registreren::before {
    content: "";
    position: absolute;
    top: -55px;
    left: 50%;
    width: 100px;
    height: 100px;
    margin-left: -50px;
    background: url("../img/spaarappel.svg") center / contain no-repeat;
    filter: drop-shadow(0 6px 8px rgba(44, 119, 28, 0.25));
    animation: wiebel 3s ease-in-out infinite;
}

@keyframes wiebel {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-6px) rotate(3deg); }
}

/* Geen beweging voor wie dat in de systeeminstellingen heeft uitgezet */
@media (prefers-reduced-motion: reduce) {
    section.inloggen::before,
    section.registreren::before {
        animation: none;
    }
}

/* Duidelijke focusrand voor wie met het toetsenbord werkt */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--munt-geel);
    outline-offset: 2px;
}

/* Smalle schermen: kleinere naam en navigatie */
@media (max-width: 600px) {
    .bovenbalk h1 {
        font-size: 24px;
    }

    .bovenbalk h1::before {
        width: 36px;
        height: 36px;
    }

    .navigatie a {
        font-size: 15px;
        padding: 6px 12px;
    }
}
