/* ============================================================
   1. BASIS INSTELLINGEN & VARIABELEN
   ============================================================ */
:root {
    --primary: #003366;    /* Donkerblauw (Scouting) */
    --accent: #FF9900;     /* Scouting Oranje */
    --bg-color: #f4f6f8;   /* Achtergrond grijs */
    --text-color: #333;
    --success: #28a745;
    --danger: #dc3545;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    padding-bottom: 50px;
}

/* ============================================================
   2. HEADER & NAVIGATIE
   ============================================================ */
header {
    background-color: var(--primary);
    color: white;
    padding: 0 20px; /* Padding zijkanten */
    height: 70px;    /* Vaste hoogte */
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative; /* Nodig voor mobiel menu positionering */
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Logo */
.brand a {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    height: 40px;
    width: auto;
}

/* Navigatie Desktop */
#main-nav ul {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

#main-nav a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

#main-nav a:hover {
    background: rgba(255,255,255,0.1);
}

/* Hamburger Knop (Standaard verborgen) */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px;
}

/* ============================================================
   3. ALGEMENE LAYOUT CONTAINER
   ============================================================ */
.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    box-sizing: border-box;
}

/* Top Bar (Titel + Knoppen) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 2rem;
    gap: 1rem;
    box-sizing: border-box;
}

.page-title h1 {
    margin: 0;
    color: var(--primary);
    font-size: 1.8rem;
}

.page-title p {
    margin: 5px 0 0 0;
    color: #666;
}

/* ============================================================
   4. KNOPPEN & UI ELEMENTEN
   ============================================================ */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
}

.btn-add {
    background-color: var(--success);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
}

.view-switcher a.active {
    background-color: var(--primary) !important;
    color: white !important;
}

/* ============================================================
   5. KAARTEN (CARDS)
   ============================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.card-content {
    padding: 20px;
    flex-grow: 1;
    position: relative;
}

.card-footer {
    background: #f9f9f9;
    padding: 15px;
    border-top: 1px solid #eee;
}

/* Datum Boxje in Kaart */
.date-box {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f0f4f8;
    padding: 5px 10px;
    border-radius: 8px;
    text-align: center;
    color: var(--primary);
    font-weight: bold;
}
.date-box .day { font-size: 1.4rem; display: block; line-height: 1; }
.date-box .month { font-size: 0.8rem; text-transform: uppercase; }

/* Badges (Tijd/Locatie) */
.meta-info {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    font-size: 0.9rem;
    color: #555;
}

/* ============================================================
   6. TABELLEN (Voor Leiding Desktop)
   ============================================================ */
.table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.scout-table {
    width: 100%;
    border-collapse: collapse;
}

.scout-table th, .scout-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.scout-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

/* ============================================================
   7. FORMULIEREN
   ============================================================ */
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: bold; color: var(--primary); }
input[type="text"], input[type="date"], input[type="time"], textarea, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

/* ============================================================
   8. PRESENTIELIJST BLOKKEN (Grid)
   ============================================================ */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.attendance-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 160px;
}

.attendance-name {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--primary);
    word-wrap: break-word;
}

.btn-presence {
    display: block;
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    margin-top: auto;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-presence.present { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.btn-presence.absent { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ============================================================
   9. HULP KLASSEN VOOR MOBIEL/DESKTOP SWITCH
   ============================================================ */
.mobile-cards { display: none; } /* Verberg mobiele kaarten op desktop */
.desktop-table { display: block; } /* Toon tabel op desktop */
/* --- BULK PRESENTIELIJST STYLING --- */

.attendance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: white;
}

/* Als iemand is afgemeld door ouders, geef rij een kleurtje */
.attendance-row.is-excused {
    background-color: #fff5f5;
}

.att-info {
    flex-grow: 1;
}

.att-name {
    font-weight: bold;
    color: var(--primary);
    font-size: 1rem;
}

/* Ouder info (Standaard zichtbaar op Desktop) */
.att-parent-info {
    color: #666;
    margin-top: 4px;
}

/* --- DE BOLLETJES (Radio Buttons) --- */
.att-actions {
    display: flex;
    gap: 10px;
}

/* Verberg de echte radio button */
.radio-label input[type="radio"] {
    display: none;
}

/* De knop zelf */
.radio-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%; /* Rondje */
    background: #f0f0f0;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

/* -- KLEUREN BIJ SELECTIE -- */

/* Aanwezig (Groen) */
.radio-label.present input:checked + span {
    background-color: #28a745;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 5px #28a745;
}

/* Unknown/Te Laat (Oranje/Geel) */
.radio-label.unknown input:checked + span {
    background-color: #ffc107;
    color: #fff; /* Wit of zwart, wat je mooi vindt */
    transform: scale(1.1);
    box-shadow: 0 0 5px #ffc107;
}
/* Als unknown standaard is geselecteerd, maken we hem grijs-geel zodat hij niet schreeuwt */
.radio-label.unknown input:checked + span {
    background-color: #e0e0e0;
    color: #555;
    border: 2px solid #ffc107;
}

/* Afwezig (Rood) */
.radio-label.absent input:checked + span {
    background-color: #dc3545;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 5px #dc3545;
}


/* --- OPSLAAN BALK (Fixed onderaan) --- */
.save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 999;
}

/* ============================================================
   10. MEDIA QUERIES (MOBIEL)
   ============================================================ */
@media screen and (max-width: 768px) {

    /* HEADER & HAMBURGER */
    .header-container { padding: 0; }
    .hamburger-btn { display: block; } /* Toon knop */
    .attendance-row {
        flex-direction: row; /* Blijf naast elkaar */
        flex-direction: row; /* Blijf naast elkaar */
        align-items: center;
    }

    /* Ouder info verbergen op mobiel (Clean look) */
    .att-parent-info {
        display: none;
    }

    .att-name {
        font-size: 0.95rem;
    }

    /* Knoppen iets kleiner op hele kleine schermen */
    .radio-label span {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .att-actions {
        gap: 5px;
    }
    #main-nav {
        display: none; /* Verberg menu standaard */
        position: absolute;
        top: 70px; /* Precies onder de header */
        left: 0;
        width: 100%;
        background-color: var(--primary);
        padding: 0 0 20px 0;
        box-shadow: 0 5px 10px rgba(0,0,0,0.2);
        z-index: 1000;
    }

    #main-nav.active { display: block; } /* Toon menu als open */

    #main-nav ul {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    #main-nav li { width: 100%; border-bottom: 1px solid rgba(255,255,255,0.1); }
    #main-nav a {
        display: block;
        padding: 15px 20px;
        font-size: 1.1rem;
        border-radius: 0;
    }

    /* AGENDA SWITCH (Tabel weg, Kaarten aan) */
    .desktop-table { display: none !important; }
    .mobile-cards { display: block !important; }

    /* LAYOUT AANPASSINGEN */
    .main-container { padding: 0 15px; margin-top: 20px; }

    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .top-bar > div:first-child {
        text-align: left;
    }

    /* Laat knoppengroepen en actieknoppen de volle breedte pakken op mobiel */
    .top-bar .btn-group,
    .top-bar .btn,
    .top-bar a.btn-primary {
        width: 100%;
        display: flex;
        justify-content: center;
        box-sizing: border-box;
    }

    .view-switcher, .btn-add {
        text-align: center;
        display: block;
    }

    /* PRESENTIELIJST OP MOBIEL */
    .attendance-grid {
        grid-template-columns: 1fr 1fr; /* 2 kolommen */
    }

    /* FORMULIEREN */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important; /* Forceer 1 kolom bij formulieren */
    }
}