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

html {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: #1f2933;
}

/* Sur mobile, on réduit la taille racine : les dimensions en rem (textes,
   espacements, boutons, padding) se réduisent proportionnellement. */
@media (max-width: 600px) {
    html {
        font-size: 87.5%;
    }
}

body {
    margin: 0;
    /* Photo de fond + voile blanc translucide pour préserver la lisibilité
       du contenu posé par-dessus (calendrier, formulaires). */
    background: url('/assets/images/breskens.jpg') center / cover no-repeat fixed;
    min-height: 100vh;
    /* Compense la hauteur de la topbar fixée en haut. */
    padding-top: var(--topbar-height, 56px);
}

a {
    color: #2c5282;
}

/* --- Layout général --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #1a365ddd;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.topbar .brand {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.logout-form {
    margin: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    line-height: 0;
}

.btn-icon:hover,
.btn-icon:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    outline: none;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-size: 0.9rem;
}

.session-identity {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    line-height: 1.2;
}

.session-email {
    opacity: 0.85;
}

.badge-admin {
    background: #c05621;
    color: #fff;
    border-radius: 3px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

/* --- Boutons / liens --- */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-link {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border-radius: 4px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
}

.btn-primary {
    background: #2c5282;
    color: #fff;
    border-color: #2c5282;
}

.btn-primary:hover {
    background: #1a365d;
}

.btn-secondary {
    background: #fff;
    color: #2c5282;
    border-color: #cbd5e0;
}

.btn-secondary:hover {
    background: #edf2f7;
    border-color: #2c5282;
}

.btn-danger {
    background: #c53030;
    color: #fff;
    border-color: #c53030;
}

.btn-link {
    background: transparent;
    color: #2c5282;
    border-color: transparent;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Variante carrée pour les boutons "icône" (chevrons de navigation). */
.btn-icon {
    padding: 0.5rem 0.75rem;
    font-size: 1.1rem;
    line-height: 1;
}

/* --- Flash messages --- */
.flash {
    margin: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    background: #e6fffa;
    color: #234e52;
    border: 1px solid #38b2ac;
}

.flash-success {
    background: #f0fff4;
    color: #22543d;
    border-color: #38a169;
}

/* --- Formulaires --- */
.field {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.field > span {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.field input {
    padding: 0.5rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font: inherit;
}

.field-row {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .field-row {
        grid-template-columns: 1fr 1fr;
    }
}

.field-error {
    color: #c53030;
    margin-top: 0.25rem;
}

.form-error {
    background: #fff5f5;
    color: #742a2a;
    border: 1px solid #fc8181;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.form-error--conflict {
    border-color: #c53030;
    background: #fed7d7;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* --- Auth page --- */
.auth {
    max-width: 420px;
    margin: 2rem auto;
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* --- Cartes de page (formulaire de réservation, confirmation, page créée) --- */
.reservation-form-page,
.reservation-created,
.confirm-delete-page,
.error-page {
    max-width: 720px;
    margin: 1.5rem auto;
    background: #fff;
    padding: 1.5rem 1.75rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.lede {
    color: #4a5568;
}

/* --- Page card surface (calendar, reservation form, created, delete confirm) --- */
.calendar-page,
.reservation-form-page,
.reservation-created,
.confirm-delete-page {
    background: #ffffffee;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem 1rem;
}

/* --- Calendar header --- */
.calendar-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-header h1 {
    margin: 0;
    flex: 1 1 100%;
    text-transform: capitalize;
    font-size: 1.25rem;
}

@media (min-width: 720px) {
    .calendar-header h1 {
        flex: 0 0 auto;
        text-align: center;
    }
}

/* Mobile : titre du mois sur sa propre ligne, navigation + Réserver
   alignées sur une seule ligne en dessous (max 2 lignes au total). */
@media (max-width: 600px) {
    .calendar-header h1 {
        order: -1;
        text-align: center;
        font-size: 1.1rem;
    }
}

/* --- Month grid --- */
.month-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #e2e8f0;
    border-radius: 6px;
    padding: 4px;
}

.month-grid-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #4a5568;
    text-align: center;
    padding-bottom: 4px;
}

.month-grid-week {
    position: relative;
    background: #fff;
    border-radius: 4px;
    padding: 2px;
}

.month-grid-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.day-cell {
    display: block;
    background: #ffffffee;
    border-radius: 4px;
    padding: 0.25rem;
    min-height: 5em;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.day-cell:hover {
    background: #edf2f7;
}

.day-cell--selecting {
    background: #bee3f8;
    user-select: none;
}

.day-cell--selecting:hover {
    background: #90cdf4;
}

.day-cell--out {
    background: #edf2f7;
    color: #a0aec0;
}

.day-cell--weekend {
    background: #fef6e4;
}

.day-cell--weekend.day-cell--out {
    background: #f5ecd9;
}

.day-cell--weekend:hover {
    background: #fbe8c2;
}

.day-cell--weekend.day-cell--selecting {
    background: #bee3f8;
}

.day-cell--weekend.day-cell--selecting:hover {
    background: #90cdf4;
}

.day-cell--today {
    outline: 2px solid #2c5282;
}

.day-number {
    display: inline-block;
    font-weight: 600;
}

.month-grid-bands {
    position: absolute;
    inset: 26px 2px 4px 2px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 22px;
    gap: 2px;
    pointer-events: none;
}

.band {
    pointer-events: auto;
    background: #2c5282;
    color: #fff;
    border-radius: 3px;
    padding: 0 0.4rem;
    font-size: 0.8rem;
    line-height: 22px;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.band:hover {
    background: #1a365d;
}

.band--continues-left {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.band--continues-right {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.band--slot-1 { background: #2b6cb0; }
.band--slot-2 { background: #3182ce; }
.band--slot-3 { background: #4299e1; }


/* --- Mobile : grille 7 colonnes conservée, bandes réduites à des barres
       colorées sans texte (le tap reste actif pour ouvrir la réservation). --- */
@media (max-width: 600px) {
    .month-grid {
        gap: 2px;
        padding: 2px;
    }

    .month-grid-weekdays {
        font-size: 0.65rem;
        padding-bottom: 2px;
    }

    .month-grid-week {
        padding: 1px;
    }

    .month-grid-days {
        gap: 1px;
    }

    .day-cell {
        padding: 2px 3px;
        min-height: 48px;
        font-size: 0.75rem;
    }

    .day-number {
        font-size: 0.8rem;
    }

    .month-grid-bands {
        inset: 20px 1px 2px 1px;
        grid-auto-rows: 1fr;
        gap: 0;
    }

    .band {
        font-size: 0.6rem;
        line-height: 1.2;
        padding: 0 2px;
        border-radius: 2px;
        display: flex;
        align-items: center;
    }
}

/* --- Audit panel --- */
.audit {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 6px;
    background: #ffffffee;
    border: 1px solid #e2e8f0;
}

.audit dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 0.75rem;
    margin: 0;
}

.audit dt {
    font-weight: 600;
    color: #4a5568;
}

.audit dd {
    margin: 0;
}

.reservation-summary {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 0.75rem;
    margin-bottom: 1rem;
}

.reservation-summary dt {
    font-weight: 600;
}

/* --- Calendar shell (page column + upcoming aside) --- */
.calendar-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calendar-shell > .calendar-page {
    min-width: 0;
}

@media (min-width: 900px) {
    .calendar-shell {
        flex-direction: row;
        align-items: flex-start;
    }

    .calendar-shell > .calendar-page {
        flex: 1 1 auto;
    }

    .calendar-shell > .upcoming,
    .calendar-shell > .calendar-side {
        flex: 0 0 300px;
    }
}

.calendar-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* --- Upcoming reservations --- */
.upcoming {
    background: #ffffffee;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem 1rem;
}

.upcoming h2 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: #2d3748;
}

.upcoming__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upcoming__item {
    margin: 0;
}

.upcoming__empty {
    margin: 0;
    color: #718096;
    font-style: italic;
}

.upcoming-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.6rem 0.75rem;
    background: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
}

.upcoming-card:hover,
.upcoming-card:focus-visible {
    border-color: #3182ce;
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.25);
    outline: none;
}

.upcoming-card--in-progress {
    border-color: #38a169;
    background: #f0fff4;
}

.upcoming-card__name {
    font-weight: 600;
}

.upcoming-card__dates {
    font-size: 0.9rem;
    color: #4a5568;
}

.upcoming-card__badge {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #38a169;
    color: #ffffff;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

/* --- Weather card --- */
.weather-card {
    background: #ffffffee;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem 1rem;
}

.weather-card h2 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    color: #2d3748;
}

.weather-card__location {
    margin: 0 0 0.5rem;
    color: #4a5568;
    font-size: 0.9rem;
}

.weather-card__body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.weather-card__icon {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-card__icon svg {
    display: block;
}

.weather-card__temp {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1;
}

.weather-card__temp-unit {
    font-size: 1rem;
    font-weight: 500;
    color: #4a5568;
}

.weather-card__condition {
    margin: 0.5rem 0 0;
    color: #4a5568;
    font-size: 0.9rem;
}

.weather-card__stale,
.weather-card__message {
    margin: 0.5rem 0 0;
    color: #718096;
    font-size: 0.85rem;
    font-style: italic;
}

.weather-card--stale .weather-card__body {
    opacity: 0.75;
}

.weather-card--unavailable,
.weather-card--misconfigured {
    background: #ffffffee;
}
