* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f4f5f7;
    color: #1a1a2e;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: min(960px, 92%);
    margin: 0 auto;
}

/* Header */
.ugent-header {
    background: #003DA5;
    color: #fff;
    padding: 1.2rem 0;
}
.ugent-header .container {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.ugent-logo {
    height: 44px;
    filter: brightness(0) invert(1);
}
.ugent-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}
.subtitle {
    margin: .2rem 0 0;
    font-size: .85rem;
    opacity: .85;
}

/* Nav */
.ugent-nav {
    background: #002d7a;
}
.ugent-nav .container {
    display: flex;
    gap: .25rem;
}
.ugent-nav a {
    color: #cdd9f0;
    text-decoration: none;
    padding: .65rem 1.1rem;
    font-size: .9rem;
}
.ugent-nav a:hover { color: #fff; }
.ugent-nav a.active {
    color: #fff;
    border-bottom: 3px solid #ffd200;
}

main.container {
    flex: 1;
    padding: 1.5rem 0 3rem;
}

/* Cards */
.card, .results {
    background: #fff;
    border: 1px solid #e3e5ea;
    border-radius: 10px;
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.4rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.card h2 { margin-top: 0; font-size: 1.25rem; }
.hint { color: #666; font-size: .9rem; }
.count { color: #888; font-weight: 400; font-size: .9em; }
.error {
    background: #fdecea;
    border: 1px solid #f5c6c0;
    color: #a33;
    padding: .7rem 1rem;
    border-radius: 6px;
}

/* Forms */
.calc-form {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    align-items: flex-end;
}
.field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    flex: 1;
    min-width: 180px;
}
.field label {
    font-size: .8rem;
    font-weight: 600;
    color: #444;
}
input, select {
    padding: .55rem .7rem;
    border: 1px solid #c9ccd4;
    border-radius: 6px;
    font-size: .95rem;
    width: 100%;
}
input:focus, select:focus {
    outline: 2px solid #003DA5;
    border-color: #003DA5;
}
button, .btn-secondary {
    padding: .55rem 1.3rem;
    border: none;
    border-radius: 6px;
    background: #003DA5;
    color: #fff;
    font-size: .95rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn-secondary:hover { background: #002d7a; }

/* Tom Select — UGent-stijl */
.ts-control, .ts-control input {
    font-size: .95rem;
    font-family: inherit;
}
.ts-control {
    border: 1px solid #c9ccd4;
    border-radius: 6px;
    padding: .45rem .7rem;
    min-height: auto;
}
.ts-control.focus {
    border-color: #003DA5;
    box-shadow: 0 0 0 2px rgba(0,61,165,.25);
}
.ts-dropdown {
    border: 1px solid #c9ccd4;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.ts-dropdown .option { padding: .5rem .7rem; }
.ts-dropdown .active {
    background: #eef1f7;
    color: #003DA5;
}
.ts-dropdown .selected { background: #003DA5; color: #fff; }
.ts-wrapper.single .ts-control::after { border-color: #003DA5 transparent transparent transparent; }
.btn-secondary {
    background: #eef1f7;
    color: #003DA5;
    border: 1px solid #c9d4ec;
}
.btn-secondary:hover { background: #dde5f5; }

.search-form {
    display: flex;
    gap: .6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.search-form input[type="search"] { flex: 1; min-width: 220px; }

/* Results */
.route-labels p { margin: .25rem 0; font-size: .95rem; }
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.2rem 0;
}
.result-card {
    border-radius: 10px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.result-card .mode { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.result-card .distance { font-size: 1.6rem; font-weight: 700; }
.result-card .duration { font-size: .95rem; opacity: .8; }
.mode-walking { background: #e8f5e9; color: #1b5e20; }
.mode-cycling { background: #e3f2fd; color: #0d47a1; }
.mode-driving { background: #fff3e0; color: #e65100; }
.result-card { cursor: pointer; transition: outline .15s, transform .15s; }
.result-card:hover { transform: translateY(-2px); }
.result-card.active {
    outline: 3px solid #003DA5;
    outline-offset: 2px;
}
.result-card.active::after {
    content: "✓ route op kaart";
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .7;
    margin-top: .3rem;
}

/* Map */
#map {
    height: 420px;
    border-radius: 10px;
    border: 1px solid #d5d8de;
    margin-top: 1rem;
}

.map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #a33;
    background: #fdecea;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

/* Sticky kaart op de gebouwenlijst (boven de sticky tabelkop) */
#map.map-sticky {
    position: sticky;
    top: 0;
    z-index: 500;
    background: #fff;
}

/* Tabelkop van de gebouwenlijst plakt onder de sticky kaart (hoogte 420px) */
#gebouwen-table thead th,
#bereik-table thead th {
    top: 420px;
    z-index: 10;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    margin-top: 1rem;
}
.data-table th {
    text-align: left;
    background: #003DA5;
    color: #fff;
    padding: .55rem .7rem;
    position: sticky;
    top: 0;
}
.data-table td {
    padding: .5rem .7rem;
    border-bottom: 1px solid #e8eaef;
}
.data-table tr:hover td { background: #f4f7fd; }

/* Gebouwenlijst-selectie */
.map-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.map-bar .hint { margin: 0; }
#sel-count { font-weight: 600; color: #003DA5; }
#gebouwen-table tbody tr,
#bereik-table tbody tr { cursor: pointer; }
#gebouwen-table tbody tr.no-coords { cursor: default; opacity: .55; }
tr.row-selected td { background: #e8f0fd !important; }
.gebouw-check { width: 1rem; height: 1rem; cursor: pointer; }
.gebouw-check:disabled { cursor: not-allowed; }

/* Admin */
.admin-form .field { margin-bottom: .8rem; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.field-row .field { flex: 1; min-width: 8rem; }
.field-row .field-narrow { flex: 0 0 9rem; }
.notice { background: #e8f0fd; border-left: 4px solid #003DA5; padding: .6rem .9rem; border-radius: 6px; }
.form-errors { background: #fdecea; border-left: 4px solid #c0392b; color: #a33; padding: .6rem .9rem .6rem 1.8rem; border-radius: 6px; }
.admin-actions { white-space: nowrap; }
.admin-actions a { margin-right: .6rem; }
.inline-form { display: inline; margin: 0; }
.link-danger { background: none; border: none; color: #c0392b; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.no-coords { color: #a33; }
.nav-admin { margin-left: auto; opacity: .8; }
code { background: #eef1f6; padding: .1rem .3rem; border-radius: 4px; }

/* Footer */
.ugent-footer {
    background: #003DA5;
    color: #cdd9f0;
    text-align: center;
    padding: .8rem 0;
    font-size: .85rem;
}
