:root {
    --yellow: #ffd100;
    --yellow-dark: #e6b800;
    --dark: #1a1a2e;
    --dark-light: #16213e;
    --text: #2d3748;
    --text-muted: #718096;
    --bg: #f7fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --success: #38a169;
    --error: #e53e3e;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--dark-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.site-header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-pattern {
    position: absolute;
    inset: 0;
    background: url('/images/hero-cycling.svg') center/cover no-repeat;
    opacity: 0.08;
    pointer-events: none;
}

.logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    position: relative;
    z-index: 1;
    white-space: nowrap;
    flex-shrink: 0;
}
.logo-mark { flex-shrink: 0; }
.logo span { color: var(--yellow); }

.main-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: nowrap;
}

.main-nav a {
    color: rgba(255,255,255,.85);
    font-size: .85rem;
    font-weight: 500;
    padding: .35rem .45rem;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}
.main-nav a:hover { background: rgba(255,255,255,.1); color: var(--white); text-decoration: none; }
.admin-link { color: var(--yellow) !important; }

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: .75rem;
    position: relative;
    z-index: 1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    flex-shrink: 0;
}

.lang-switch {
    display: flex;
    gap: .25rem;
    margin-left: .25rem;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.lang-switch a {
    padding: .25rem .55rem !important;
    font-size: .75rem !important;
    font-weight: 700;
    border-radius: 0 !important;
}
.lang-switch a.active {
    background: var(--yellow);
    color: var(--dark) !important;
}

/* Hero */
.hero {
    position: relative;
    background: linear-gradient(135deg, var(--dark) 0%, #0f3460 50%, var(--dark-light) 100%);
    color: white;
    padding: 3rem 1.25rem;
    margin-bottom: 0;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    inset: 0;
    opacity: 0.35;
}
.hero-illustration {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    z-index: 1;
}
.hero h1 {
    color: white;
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: .75rem;
}
.hero p {
    color: rgba(255,255,255,.85);
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto 1.5rem;
}
.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.hero-btn-light {
    border-color: rgba(255,255,255,.5) !important;
    color: white !important;
}
.hero-btn-light:hover {
    background: rgba(255,255,255,.1) !important;
    border-color: white !important;
}
.jersey-icons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}
.jersey-icons img {
    width: 40px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.3));
    transition: transform .2s;
}
.jersey-icons img:hover { transform: translateY(-4px) scale(1.05); }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
}
.sidebar-header h3 { margin: 0; }

.auth-card-graphic { position: relative; overflow: hidden; }
.auth-graphic {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 64px;
    opacity: 0.25;
    transform: rotate(12deg);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
}
.footer-logo { opacity: 0.7; }

.page-header-icon {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.page-header-icon img { width: 36px; }

.stage-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.stage-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--yellow);
    transition: transform .15s, box-shadow .15s;
}
.stage-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.stage-card .stage-num {
    display: inline-block;
    background: var(--yellow);
    color: var(--dark);
    font-weight: 800;
    font-size: .8rem;
    padding: .2rem .6rem;
    border-radius: 20px;
    margin-bottom: .5rem;
}


.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: .35rem .5rem;
    line-height: 1;
    z-index: 2;
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    padding: 2rem 1.25rem;
    align-items: start;
}

.content { min-width: 0; }

/* Sidebar */
.sidebar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}

.sidebar h3 {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: .75rem;
}

.participant-list { list-style: none; }
.participant-list li {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: .25rem .5rem;
    padding: .4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    align-items: center;
}
.participant-list .rank { color: var(--text-muted); font-weight: 600; }
.participant-list .points { font-weight: 600; color: var(--dark); }
.participant-list .daily { color: var(--success); font-size: .75rem; grid-column: 3; }

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

h1 { font-size: 1.75rem; margin-bottom: 1.25rem; color: var(--dark); }
h2 { font-size: 1.15rem; margin-bottom: .75rem; color: var(--dark); }

/* Buttons */
.btn {
    display: inline-block;
    padding: .55rem 1.1rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.btn-primary { background: var(--yellow); color: var(--dark); border-color: var(--yellow); }
.btn-primary:hover { background: var(--yellow-dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--dark); border-color: var(--border); }
.btn-outline:hover { border-color: var(--dark); text-decoration: none; }
.btn-danger { background: var(--error); color: white; border-color: var(--error); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; text-align: center; }

/* Forms */
label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    margin-bottom: 1rem;
    background: var(--white);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px rgba(255,209,0,.25);
}

fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
legend { font-weight: 600; padding: 0 .5rem; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; align-items: end; }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: .65rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--bg); }
.data-table tr:hover td { background: #fafafa; }

/* Messages */
.messages { display: flex; flex-direction: column; gap: 1rem; }
.message header, .reply header { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: .35rem; }
.message time, .reply time { color: var(--text-muted); }
.reply { margin: .75rem 0 .75rem 1.25rem; padding: .75rem; background: var(--bg); border-radius: 8px; border-left: 3px solid var(--yellow); }
.reply-form { margin-top: .75rem; }
.reply-form textarea { margin-bottom: .5rem; }

/* Alerts */
.alert { padding: .85rem 1rem; border-radius: 8px; margin: 1rem 0; font-size: .9rem; }
.alert-success { background: #f0fff4; color: #22543d; border: 1px solid #9ae6b4; }
.alert-error { background: #fff5f5; color: #742a2a; border: 1px solid #feb2b2; }

.hint { color: var(--text-muted); font-size: .9rem; }
.badge { font-size: .85rem; background: var(--yellow); color: var(--dark); padding: .2rem .6rem; border-radius: 20px; font-weight: 600; }
.badge-success { background: #22c55e; color: white; }
.race-badge { font-size: .8rem; color: var(--yellow); font-weight: 600; white-space: nowrap; }
.race-badge--mobile { display: none; }
.admin-race-switch { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,.15); }
.admin-race-switch label { display: block; font-size: .75rem; color: rgba(255,255,255,.6); margin-bottom: .25rem; }
.admin-race-switch select { width: 100%; padding: .4rem; border-radius: 6px; border: none; font-size: .85rem; }
.admin-race-banner { background: #fef9c3; color: #713f12; padding: .5rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.row-active { background: rgba(255, 215, 0, .12); }
.checkbox-label { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; }
.text-muted { color: var(--muted); font-size: .9rem; }

/* Auth */
.auth-page { display: flex; justify-content: center; padding: 3rem 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-forgot { margin: -.25rem 0 .75rem; text-align: right; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.rider-list { list-style: none; }
.rider-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rider-list small { color: var(--text-muted); flex: 1; }
.rider-list.compact li { font-size: .875rem; }

.pagination { display: flex; gap: .5rem; margin-top: 1rem; }
.pagination a { padding: .4rem .75rem; border-radius: 6px; background: var(--white); border: 1px solid var(--border); text-decoration: none; }
.pagination a.active { background: var(--yellow); border-color: var(--yellow); font-weight: 600; }

.cms-content { line-height: 1.8; }

/* Footer */
.site-footer { background: var(--dark); color: rgba(255,255,255,.6); text-align: center; padding: 1.5rem; margin-top: 2rem; font-size: .85rem; }

/* Admin */
.admin-body { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--dark); color: white; padding: 1.5rem 1rem; }
.admin-sidebar .logo { display: block; margin-bottom: 1.5rem; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: .25rem; }
.admin-sidebar a { color: rgba(255,255,255,.8); padding: .5rem .75rem; border-radius: 6px; text-decoration: none; font-size: .9rem; }
.admin-sidebar a:hover { background: rgba(255,255,255,.1); color: white; text-decoration: none; }
.admin-main { padding: 2rem; background: var(--bg); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: white; border-radius: var(--radius); padding: 1.25rem; text-align: center; box-shadow: var(--shadow); }
.stat-num { display: block; font-size: 1.75rem; font-weight: 700; color: var(--dark); }
.stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; }

/* Responsive */
@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; order: -1; }
    .grid-2 { grid-template-columns: 1fr; }
    .admin-body { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
}

.main-nav .btn { padding: .4rem .75rem; font-size: .85rem; white-space: nowrap; }

/* Wide desktop: slightly roomier nav */
@media (min-width: 1280px) {
    .main-nav { gap: .65rem; }
    .main-nav a { font-size: .9rem; padding: .35rem .5rem; }
}

/* Collapse nav into hamburger before items wrap (Dutch labels are longer) */
@media (max-width: 1200px) {
    .nav-toggle { display: block; margin-left: auto; }
    .race-badge:not(.race-badge--mobile) { display: none; }
    .race-badge--mobile {
        display: block;
        padding-bottom: .5rem;
        margin-bottom: .25rem;
        border-bottom: 1px solid rgba(255,255,255,.15);
    }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--dark);
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        padding: 1rem;
        gap: .25rem;
        z-index: 200;
        box-shadow: 0 8px 24px rgba(0,0,0,.25);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
    }
    .main-nav a,
    .main-nav .btn {
        font-size: .95rem;
        padding: .55rem .75rem;
        white-space: normal;
    }
    .main-nav .lang-switch {
        margin-left: 0;
        margin-top: .5rem;
        align-self: flex-start;
    }
    body.nav-open .main-nav { display: flex; }
    body.nav-open { overflow: hidden; }
}
