/* =========================================================
   1. DESIGN TOKENS (Variables)
========================================================= */
:root {
    /* Kleurenpalet */
    --gov-blue: #154273;
    --gov-blue-2: #01689b;
    --gov-blue-dark: #0b2f57;
    --justice: #b00068;
    --green: #218838;
    --red: #c62828;
    --amber: #b26a00;
    
    /* Neutrale kleuren & UI */
    --bg: #f3f6f9;
    --surface: #fff;
    --text: #1f2937;
    --muted: #667085;
    --border: #d9e1ea;
    --border-soft: #edf1f5;
    
    /* Vormgeving */
    --shadow: 0 10px 30px rgba(21, 66, 115, .10);
    --shadow-hover: 0 24px 70px rgba(21, 66, 115, .14);
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 22px;
    
    /* Transities */
    --transition-fast: 0.18s ease;
    --transition-base: 0.22s ease;
}

/* =========================================================
   2. RESET, BASE & ACCESSIBILITY
========================================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--gov-blue-2);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--gov-blue-dark);
}

/* Screenreader only - Cruciaal voor toegankelijkheid */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Focus staten voor toetsenbord navigatie (A11y) */
:focus-visible {
    outline: 3px solid var(--gov-blue-2);
    outline-offset: 2px;
    border-radius: 2px;
}

/* =========================================================
   3. LAYOUT & STRUCTUUR
========================================================= */
.content {
    width: min(100%, 1480px);
    margin: 0 auto;
    padding: 22px 26px 48px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 18px;
    align-items: start;
}

.dashboard-main, 
.dashboard-side {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.gov-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

/* =========================================================
   4. HOOFDNAVIGATIE & TOPBAR
========================================================= */
.gov-topbar {
    min-height: 88px;
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 34px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 1px 0 rgba(16, 24, 40, .02);
}

.gov-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 315px;
}

.gov-brand img, 
.brand img, 
img[src*="logo"] {
    width: 58px;
    height: 58px;
    object-fit: contain;
    display: block;
}

.brand img {
    width: 72px;
    height: 72px;
}

.gov-brand strong, 
.brand strong {
    display: block;
    color: var(--gov-blue);
    font-size: 20px;
    line-height: 1.1;
}

.gov-brand span, 
.brand span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

/* Zoekbalk */
.gov-search {
    display: flex;
    align-items: center;
    max-width: 430px;
    flex: 1;
    margin-left: auto;
    border: 1px solid #c5d0dd;
    border-radius: var(--radius-md);
    background: var(--surface);
    height: 46px;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.gov-search:focus-within {
    border-color: var(--gov-blue-2);
    box-shadow: 0 0 0 3px rgba(1, 104, 155, 0.1);
}

.gov-search input {
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 0 14px;
    outline: none;
    flex: 1;
}

.gov-search button {
    height: 100%;
    width: 52px;
    border: 0;
    background: transparent;
    color: var(--gov-blue);
    font-size: 26px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.gov-search button:hover {
    background: var(--border-soft);
}

/* Navigatie balk */
.gov-nav {
    min-height: 56px;
    background: var(--gov-blue);
    display: flex;
    align-items: center;
    padding: 0 34px;
    position: sticky;
    top: 88px;
    z-index: 29;
    box-shadow: 0 2px 9px rgba(0, 0, 0, .12);
    overflow-x: auto;
}

.gov-nav a {
    color: #fff;
    padding: 17px 18px;
    display: flex;
    align-items: center;
    min-height: 56px;
    font-weight: 700;
    border-left: 1px solid rgba(255, 255, 255, .08);
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.gov-nav a:hover, 
.gov-nav a.active {
    background: var(--surface);
    color: var(--gov-blue);
}

.gov-nav .nav-job {
    margin-left: auto;
    background: rgba(255, 255, 255, .15);
}

/* =========================================================
   5. COMPONENTEN (Cards, Buttons, Badges, Tables)
========================================================= */
/* Cards & Tiles */
.card, .tile, .stat, .hero, .gov-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.card {
    padding: 24px;
}

.gov-card {
    overflow: hidden;
}

.tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
    padding: 20px;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(21, 66, 115, .15);
}

.tile-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e6f2fb;
    color: var(--gov-blue);
    font-weight: 900;
    font-size: 26px;
    flex-shrink: 0;
}

/* Knoppen (Buttons) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    background: var(--gov-blue-2);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    line-height: 1.2;
    transition: background var(--transition-fast), transform 0.1s ease;
}

.btn:hover {
    background: var(--gov-blue-dark);
    color: #fff;
}

.btn:active {
    transform: scale(0.98);
}

.btn.ghost {
    background: var(--surface);
    color: var(--gov-blue);
    border-color: var(--border);
}

.btn.ghost:hover {
    background: var(--bg);
}

.btn-danger {
    background: #b42318;
}
.btn-danger:hover {
    background: #901b12;
}

/* Formulieren */
form, .stack-form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-weight: 700;
}

input, select, textarea, .form-control {
    width: 100%;
    border: 1px solid #c5d0dd;
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    padding: 12px 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gov-blue-2);
    box-shadow: 0 0 0 3px rgba(1, 104, 155, 0.1);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

/* =========================================================
   6. PORTAALKEUZE (Overheid / Mijn Utopia)
========================================================= */
.auth-body, 
body.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 20%, rgba(1, 104, 155, .10), transparent 32%),
        radial-gradient(circle at 80% 10%, rgba(21, 66, 115, .12), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, #f3f6f9 100%);
    display: grid;
    place-items: center;
    padding: 24px;
}

.portal-choice-shell {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 10px 0 4px;
}

.portal-choice-intro {
    text-align: center;
    margin-bottom: 26px;
    animation: portalFadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.portal-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.portal-choice-card {
    position: relative;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    color: #0f172a;
    overflow: hidden;
    isolation: isolate;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-base);
    animation: portalFadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.portal-choice-card:nth-child(2) {
    animation-delay: 0.08s;
}

.portal-choice-card:hover {
    transform: translateY(-6px);
    border-color: #99c2df;
    box-shadow: var(--shadow-hover);
    background: var(--surface);
}

.portal-choice-card.government { border-top: 6px solid var(--gov-blue); }
.portal-choice-card.citizen { border-top: 6px solid var(--gov-blue-2); }

/* Blocked States voor Portaalkeuze */
.portal-choice-card.is-disabled,
.portal-choice-card[aria-disabled="true"] {
    opacity: 0.62;
    cursor: not-allowed;
    filter: grayscale(0.25);
    pointer-events: none; /* Voorkomt clicks op de hele kaart indien disabled */
}

/* =========================================================
   7. ANIMATIES
========================================================= */
@keyframes portalFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================================
   8. MEDIA QUERIES (Responsiveness)
========================================================= */
@media(max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-side { grid-template-columns: 1fr 1fr; }
    .gov-tile-grid { grid-template-columns: repeat(2, 1fr); }
}

@media(max-width: 900px) {
    .onboarding-steps { grid-template-columns: 1fr; }
    .gov-nav.dropdown-nav { overflow-x: auto; overflow-y: visible; }
}

@media(max-width: 850px) {
    .gov-topbar {
        height: auto;
        position: relative;
        flex-wrap: wrap;
        padding: 18px;
    }
    .gov-search {
        order: 3;
        flex-basis: 100%;
        max-width: none;
        margin-left: 0;
        margin-top: 14px;
    }
    .dashboard-side, .gov-tile-grid, .form-grid {
        grid-template-columns: 1fr;
    }
    .portal-choice-grid {
        grid-template-columns: 1fr;
    }
}

@media(max-width: 520px) {
    .portal-choice-card {
        border-radius: 16px;
        min-height: auto;
        padding: 24px;
    }
}