:root {
    --navy: #1a2b48;
    --blue: #0055a4;
    --red: #e62117;
    --gold: #f2a900;
    --white: #ffffff;
    --bg: #f4f4f6;
    --text: #1f2937;
    --muted: #6b7280;
    --radius: 14px;
    --shadow: 0 8px 24px rgba(26, 43, 72, 0.08);
    --font-body: "Source Sans 3", system-ui, sans-serif;
    --font-display: "Fredoka", var(--font-body);
}

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

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--navy); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
    width: min(1100px, calc(100% - 2rem));
    margin-inline: auto;
}

/* Header */
.site-header {
    background: var(--navy);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--white);
    text-decoration: none;
}

.brand:hover { text-decoration: none; color: var(--gold); }

.brand-logo {
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.04em;
}

.brand-text small {
    opacity: 0.85;
    font-size: 0.85rem;
}

.tricolor {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    height: 4px;
}

.tricolor span:nth-child(1) { background: var(--blue); }
.tricolor span:nth-child(2) { background: var(--white); }
.tricolor span:nth-child(3) { background: var(--red); }

.site-nav {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.site-nav a {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    text-decoration: none;
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--white);
    font-size: 1.25rem;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
}

.site-main {
    padding: 2rem 0 3rem;
    min-height: calc(100vh - 180px);
}

.site-footer {
    background: var(--navy);
    color: rgba(255,255,255,0.85);
    padding: 1.5rem 0;
    font-size: 0.95rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-links a { color: var(--gold); }

/* Hero & sections */
.hero {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 5px solid var(--red);
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    margin: 0 0 0.75rem;
    color: var(--navy);
}

.hero .lead {
    font-size: 1.15rem;
    color: var(--muted);
    margin: 0;
}

.page-title {
    font-family: var(--font-display);
    color: var(--navy);
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin: 0 0 1.5rem;
}

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

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.card h2, .card h3 {
    margin-top: 0;
    font-family: var(--font-display);
    color: var(--navy);
}

.badge {
    display: inline-block;
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.badge-green {
    background: #16a34a;
    color: var(--white);
}

.content-block {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
}

.content-block h2 {
    font-family: var(--font-display);
    color: var(--navy);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    background: var(--white);
    border-radius: var(--radius);
    border: 2px dashed #d1d5db;
}

/* Events list */
.event-list { list-style: none; padding: 0; margin: 0; }

.event-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1rem;
    align-items: start;
}

.event-date {
    text-align: center;
    background: var(--navy);
    color: var(--white);
    border-radius: 10px;
    padding: 0.5rem;
    font-weight: 700;
}

.event-date .day { font-size: 1.6rem; line-height: 1; display: block; }
.event-date .month { font-size: 0.85rem; text-transform: uppercase; opacity: 0.9; }

.event-item h3 { margin: 0 0 0.35rem; color: var(--navy); }
.event-meta { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.5rem; }

/* Calendar */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav h2 {
    margin: 0;
    font-family: var(--font-display);
    color: var(--navy);
}

.calendar {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

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

.calendar th, .calendar td {
    text-align: center;
    padding: 0.65rem 0.35rem;
    border: 1px solid #e5e7eb;
}

.calendar th {
    background: var(--navy);
    color: var(--white);
    font-size: 0.85rem;
}

.calendar td {
    height: 72px;
    vertical-align: top;
    font-size: 0.9rem;
}

.calendar .muted-day { color: #9ca3af; background: #fafafa; }
.calendar .today { background: #fff8e6; font-weight: 700; }
.calendar .has-event { background: #e8f1fb; }
.calendar .day-num { font-weight: 600; display: block; margin-bottom: 0.2rem; }
.calendar .event-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
}

/* Gallery */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.album-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}

.album-card:hover { transform: translateY(-3px); }

.album-card a { color: inherit; text-decoration: none; }
.album-cover {
    aspect-ratio: 4/3;
    background: #e5e7eb;
    object-fit: cover;
    width: 100%;
}

.album-card .album-info { padding: 0.85rem 1rem; }
.album-card h3 { margin: 0 0 0.25rem; font-size: 1rem; color: var(--navy); }
.album-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }

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

.photo-grid a {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #e5e7eb;
}

.photo-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.lightbox.open { display: flex; }

.lightbox img {
    max-height: 90vh;
    max-width: 95vw;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--white);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    background: var(--white);
}

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

.btn {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    border: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    background: var(--blue);
    color: var(--white);
}

.btn:hover { background: var(--navy); color: var(--white); text-decoration: none; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #d99600; color: var(--navy); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #c41b12; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.9rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--blue);
    color: var(--blue);
}
.btn-outline:hover { background: var(--blue); color: var(--white); }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }

.hint { font-size: 0.9rem; color: var(--muted); }

/* Admin */
.admin-body { background: #eef1f5; }
.admin-header {
    background: var(--navy);
    color: var(--white);
    padding: 0.75rem 0;
}

.admin-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-brand {
    color: var(--gold);
    font-weight: 700;
    text-decoration: none;
}

.admin-user {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.95rem;
}

.admin-user a { color: var(--white); }

.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    padding: 1.5rem 0 2rem;
}

.admin-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: var(--white);
    border-radius: var(--radius);
    padding: 0.75rem;
    box-shadow: var(--shadow);
}

.admin-sidebar a {
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: #e8f1fb;
    color: var(--blue);
}

.admin-main {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    min-height: 400px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.admin-table th, .admin-table td {
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.admin-table th { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; }

.admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.admin-photo-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

.admin-photo-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.admin-photo-card .photo-actions {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.stat-card strong {
    display: block;
    font-size: 1.8rem;
    color: var(--navy);
}

/* WYSIWYG admin */
.wysiwyg-editor {
    background: var(--white);
    border-radius: 8px;
}

.wysiwyg-editor .ql-toolbar {
    border-radius: 8px 8px 0 0;
    border-color: #d1d5db;
    background: #f8fafc;
}

.wysiwyg-editor .ql-container {
    border-radius: 0 0 8px 8px;
    border-color: #d1d5db;
    font-family: var(--font-body);
    font-size: 1rem;
}

.wysiwyg-editor .ql-editor {
    min-height: 160px;
}

.wysiwyg-editor .ql-editor.ql-blank::before {
    color: #9ca3af;
    font-style: normal;
}

/* Loading modal admin */
body.admin-loading-active {
    overflow: hidden;
}

.admin-loading-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.admin-loading-modal.open {
    display: flex;
}

.admin-loading-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 43, 72, 0.72);
}

.admin-loading-box {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem 2.25rem;
    text-align: center;
    width: min(320px, 100%);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.admin-loading-logo {
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    border: 3px solid var(--gold);
}

.admin-loading-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 1rem;
    border: 4px solid #e5e7eb;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: admin-spin 0.8s linear infinite;
}

@keyframes admin-spin {
    to { transform: rotate(360deg); }
}

.admin-loading-upload {
    margin-bottom: 0.75rem;
}

.admin-progress-track {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.admin-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--blue), var(--gold));
    border-radius: 999px;
    transition: width 0.15s ease;
}

.admin-progress-text {
    margin: 0;
    font-weight: 700;
    color: var(--navy);
    font-size: 0.95rem;
}

.admin-loading-message {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.admin-loading-success {
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #dcfce7;
    color: #166534;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 52px;
    text-align: center;
}

.admin-loading-modal.is-success .admin-loading-message {
    color: #166534;
}

.admin-loading-modal.is-success .admin-loading-logo {
    border-color: #86efac;
}

.form-row-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.gps-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.gps-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.event-map-link {
    font-weight: 600;
}

.flatpickr-input[readonly] {
    cursor: pointer;
    background: var(--white);
}

.hidden { display: none !important; }

/* Nav Live */
.nav-live-on { color: var(--gold) !important; }
.nav-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    margin-left: 4px;
    animation: live-pulse 1.2s ease infinite;
    vertical-align: middle;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* Page Live */
.live-hero {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 1rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--red);
}
.live-hero-off { border-left-color: var(--muted); }
.live-badge {
    display: inline-block;
    background: #ef4444;
    color: var(--white);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    animation: live-pulse 1.2s ease infinite;
}
.live-badge-off { background: var(--muted); animation: none; }
.live-meta { color: var(--muted); font-size: 1.1rem; margin: 0; }
.live-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.live-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}
.live-panel-wide { grid-column: 1 / -1; }
.live-panel h2 { margin-top: 0; font-family: var(--font-display); color: var(--navy); font-size: 1.2rem; }
.live-count { color: var(--gold); font-size: 1rem; }
.live-form { margin-bottom: 1rem; }
.live-checkbox { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; font-size: 0.95rem; }
.live-checkin-list, .live-vote-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}
.live-checkin-list li, .live-vote-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.live-feed { display: flex; flex-direction: column; gap: 0.75rem; max-height: 500px; overflow-y: auto; }
.live-feed-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--blue);
}
.live-feed-item header { margin-bottom: 0.35rem; }
.live-feed-item p { margin: 0; }
.live-feed-photo {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    margin-top: 0.5rem;
    object-fit: cover;
}
.live-map { height: 320px; border-radius: 10px; background: #e5e7eb; z-index: 1; }
.live-map-pin { background: transparent; border: none; font-size: 1.1rem; text-align: center; }
.live-map-pin-event { font-size: 1.4rem; }
.live-vote-counts { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.live-vote-chip {
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}
.live-vote-oui { background: #dcfce7; color: #166534; }
.live-vote-peut { background: #fef9c3; color: #854d0e; }
.live-vote-non { background: #fee2e2; color: #991b1b; }
.live-vote-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.live-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy);
    color: var(--white);
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    z-index: 3000;
    box-shadow: var(--shadow);
}
.live-toast-error { background: var(--red); }
.admin-form-narrow { max-width: 560px; margin-bottom: 2rem; }

.live-venue-photo {
    max-width: 100%;
    width: min(420px, 100%);
    margin: 1rem auto 0;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: block;
}
.live-venue-address { margin-top: 0.5rem; }
.venue-preview {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 10px;
}
.venue-preview-photo {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 8px;
}
.venue-preview-address { margin: 0.5rem 0 0; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--navy);
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    width: min(400px, calc(100% - 2rem));
    box-shadow: var(--shadow);
}

.login-box h1 {
    margin-top: 0;
    font-family: var(--font-display);
    color: var(--navy);
    text-align: center;
}

.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.contact-form {
    margin-top: 2rem;
    max-width: 36rem;
    position: relative;
}

.contact-flash { margin-top: 1.5rem; }

.contact-hint { margin-top: 0.75rem; }

.required { color: var(--red); font-weight: 700; }

@media (max-width: 768px) {
    .nav-toggle { display: block; }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--navy);
        flex-direction: column;
        padding: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .site-nav.open { display: flex; }

    .site-header { position: relative; }

    .header-inner { position: relative; }

    .event-item { grid-template-columns: 1fr; }
    .admin-layout { grid-template-columns: 1fr; }
    .form-row-dates { grid-template-columns: 1fr; }
    .gps-row { grid-template-columns: 1fr; }
    .live-grid { grid-template-columns: 1fr; }
}
