/* =========================================================
   ROOT + GLOBAL
========================================================= */

:root {
    --clr-bg: #f5f5f5;
    --clr-border: #d0d0d0;
    --clr-text: #222;
    --clr-muted: #666;

    --clr-prokart-sprint: #ffc400;
    --clr-prokart-endu:   #ff7043;
    --clr-id:             #2196f3;
    --clr-rocky:          #4caf50;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text);
}

/* =========================================================
   HEADER
========================================================= */

.site-header {
    background: #fff;
    border-bottom: 3px solid #000;
}

.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .8rem 1rem;
}

.site-title-area {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.site-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.site-subtitle {
    font-size: .85rem;
    color: var(--clr-muted);
}

.site-logo img {
    height: 60px;
}

/* =========================================================
   NAVIGATIE
========================================================= */

.site-nav {
    background: #111;
    color: #fff;
    border-top: 1px solid var(--clr-border);
	padding: 20px 50px 20px 50px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    padding: .5rem 1rem;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0 .5rem;
    gap: 2rem;
	text-align:center;
}

.nav-list li a {
    display: block;             /* zorgt dat het hele vlak klikbaar wordt */
    padding: 8px 12px;          /* ruimte toevoegen */
    border-radius: 6px;         /* mooi afgerond (optioneel) */
    color: #fff;
    text-decoration: none;
    font-size: .9rem;
    text-align: center;
    transition: background .2s;
}


.nav-list li a:hover { background: #333; }

/* MOBIEL MENU */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-list { display: none; flex-direction: column; }
    body.nav-open .nav-list { display: flex; }
}

/* =========================================================
   PAGE + FOOTER
========================================================= */

.page-content { padding: 1rem; }

.site-footer {
    text-align: center;
    padding: .8rem;
    color: #777;
}

/* =========================================================
   DASHBOARD
========================================================= */

.dashboard-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.dash-item {
    background: white;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #222;
    display: block;
    transition: .2s;
}

.dash-item:hover {
    transform: scale(1.02);
    border-color: #000;
}

/* =========================================================
   TUSSENSTAND TABEL
========================================================= */

.standings-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: .5rem;
    font-size: .9rem;
}

.standings-table th,
.standings-table td {
    border: 1px solid #ddd;
    padding: .35rem .5rem;
}

.standings-table th {
    background: #eee;
    text-align: left;
}

/* =========================================================
   STARTGRID – FORM + LAYOUT (F2-STIJL)
========================================================= */

.grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-bottom: 1rem;
    align-items: center;
}
.grid-toolbar label { font-size: .85rem; }
.grid-toolbar select,
.grid-toolbar button { font-size: .85rem; }

.startgrid-wrapper {
    background: #ffffff;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
    margin-bottom: 1rem;
}

.startgrid-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .75rem;
    border-bottom: 3px solid #000;
    padding-bottom: .25rem;
}

.startgrid-title {
    font-weight: 700;
    font-size: .95rem;
    text-transform: uppercase;
}

.startgrid-subtitle {
    font-size: .8rem;
    color: var(--clr-muted);
}

.startgrid-note {
    font-size: .75rem;
    color: var(--clr-muted);
    margin-top: .5rem;
}

/* kleurstrip per klasse */
.startgrid-wrapper.prokart-sprint .startgrid-header { border-color: var(--clr-prokart-sprint); }
.startgrid-wrapper.prokart-endu   .startgrid-header { border-color: var(--clr-prokart-endu);   }
.startgrid-wrapper.id-class       .startgrid-header { border-color: var(--clr-id);            }
.startgrid-wrapper.rocky-class    .startgrid-header { border-color: var(--clr-rocky);         }

/* GRID (2 kolommen zoals F2) */
.startgrid-rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: .5rem 1rem;
}

@media (max-width: 768px) {
    .startgrid-rows { grid-template-columns: 1fr; }
}

/* GRID BLOCK */
.grid-row {
    display: flex;
    align-items: stretch;
    background: #f2f2f2;
    border-radius: 4px;
    overflow: hidden;
}

.grid-pos {
    min-width: 46px;
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.grid-body {
    flex: 1;
    padding: .25rem .5rem;
    display: flex;
    flex-direction: column;
}

.grid-name select {
    width: 100%;
    font-size: .8rem;
}

/* =========================================================
   DEELNEMERSLIJST
========================================================= */

.competitor-controls { margin-bottom: 1rem; }

.competitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.competitor-table th,
.competitor-table td {
    border: 1px solid #ddd;
    padding: .45rem .7rem;
}
.competitor-table th {
    background: #eee;
    cursor: pointer;
}
.competitor-table tr:nth-child(even) { background: #fafafa; }
.competitor-table tr:hover { background: #f0f0f0; }

/* =========================================================
   MODAL
========================================================= */

.modal {
    display:none;
    position:fixed;
    left:0; top:0;
    width:100%; height:100%;
    background:rgba(0,0,0,0.5);
    justify-content:center;
    align-items:center;
}

.modal-content {
    background:white;
    padding:20px;
    width:350px;
    border-radius:8px;
}

.modal input {
    width:100%;
    padding:.5rem;
    margin-bottom:.8rem;
}

/* =========================================================
   MELDINGEN
========================================================= */

.error-message {
    background: #ffdddd;
    color: #a30000;
    padding: .7rem 1rem;
    border-left: 4px solid #a30000;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.success-message {
    background: #ddffdd;
    color: #006600;
    padding: .7rem 1rem;
    border-left: 4px solid #006600;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.wa-btn {
    margin-left: 8px;
    font-size: 1.2rem;
    color: #25D366;
    text-decoration: none;
}

.wa-btn:hover {
    color: #1ebe5b;
}


/* =========================================================
   PRINT LAYOUT (GEUNIFIEERD)
========================================================= */

@media print {

    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    /* Alles verbergen behalve startgrid */
    .site-header,
    .site-footer,
    .grid-toolbar,
    nav,
    header,
    .nav-list,
    .nav-toggle,
    .competitor-controls,
    .competitor-table button,
    button,
    input[type=button],
    input[type=submit],
    a.btn,
    .btn {
        display: none !important;
        visibility: hidden !important;
    }

    /* Wrapper */
    .startgrid-wrapper {
        box-shadow: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding-top: 1.5cm !important;
        padding-left: 1cm !important;
        padding-right: 1cm !important;
        width: 100% !important;
    }

    /* Titelblok print */
    .print-header {
        display: flex !important;
        justify-content: center !important;
        align-items: center;
        position: relative;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 3px solid #000;
        text-align: center;
    }

    .print-header img {
        position: absolute;
        left: 0;
        height: 70px;
    }

    .print-header-title {
        font-size: 30px !important;
        font-weight: 800 !important;
        text-transform: uppercase;
    }

    /* Verberg subtitels / hints */
    .startgrid-header,.startgrid-subtitle,
    .startgrid-note {
        display: none !important;
    }

    /* PRINT GRID */
    .startgrid-rows {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px 20px !important;
        margin-top: 20px;
        page-break-inside: avoid !important;
    }

    .grid-row {
        display: flex !important;
        background: #f2f2f2 !important;
        border-radius: 6px;
        border: 2px solid #000;
        min-height: 80px;
        page-break-inside: avoid !important;
    }

    /* Page break: 12 posities */
    .grid-row:nth-child(17) {
        page-break-before: always !important;
    }

    .grid-pos {
        background: #000 !important;
        color: #fff !important;
        font-size: 32px !important;
        width: 65px !important;
    }

    select.driver-select {
        display: none !important;
        visibility: hidden !important;
    }

    .driver-print-value {
        display: inline-block !important;
        font-size: 18px;
        font-weight: bold;
        padding-left: 4px;
    }

    .grid-row.hide-print {
        display: none !important;
    }
	
select.driver-select {
    display: none !important;
}
}

.onb-edit.saved {
    border: 2px solid #28a745 !important;
    background: #eaffea !important;
    transition: all .2s ease-in-out;
}

.onb-saved-check {
    color: #28a745;
    font-weight: bold;
    margin-left: 6px;
    opacity: 0;
    transition: opacity .2s ease-in-out;
}

.onb-saved-check.visible {
    opacity: 1;
}

/* ===========================
   PRINT LAYOUT – FORMULIEREN
=========================== */

.print-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin: 15px 0;
}

table.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    font-size: 14px;
}

table.print-table th,
table.print-table td {
    border: 1px solid #000;
    padding: 4px 6px;
    height: 22px;
}

/*********** PRINT FIXES ***********/
@media print {

    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    /* Geen interface, geen kop, geen knoppen */
    .no-print,
    nav, header, .site-header, .site-footer,
    button, .btn, .grid-toolbar,
    h1:first-of-type {
        display: none !important;
        visibility: hidden !important;
    }

    /* 1 formulier per bladzijde */
    .print-section {
        page-break-after: always !important;
        break-after: page !important;
    }

    /* Compactere titels & tabellen zodat alles op 1 blad past */
    .print-title {
        font-size: 18px !important;
        margin: 5px 0 10px 0 !important;
    }

    table.print-table {
        font-size: 12px !important;
    }

    table.print-table th,
    table.print-table td {
        padding: 2px 4px !important;
        height: 18px !important;
    }
}

@media print {
    table.print-table tbody tr:nth-child(odd) {
        background: #f2f2f2 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
