/* Theme "Chalet QcWeed" - meme famille que le site principal, ambiance chaleureuse/conviviale */

:root {
    --bg: #171310;
    --bg-panel: #201a15;
    --bg-card: #251e18;
    --border: #3a2f26;
    --text: #f2ece3;
    --text-dim: #b5a495;
    --wood: #c97b3d;
    --wood-dark: #8f5527;
    --accent: #7ed957;
    --danger: #d9534f;
    --radius: 12px;
    --shadow: 0 4px 18px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--wood); }

.ch-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

.ch-topbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.ch-brand {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--wood);
    white-space: nowrap;
}

.ch-nav-links {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ch-nav-link {
    color: var(--text-dim);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
}
.ch-nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); text-decoration: none; }
.ch-nav-link.active { color: var(--wood); background: rgba(201,123,61,0.14); font-weight: 700; }

.ch-topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
    flex-wrap: wrap;
}

.ch-user-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    white-space: nowrap;
}
.ch-user-chip:hover { text-decoration: underline; }

.ch-admin-badge {
    font-size: 0.7rem;
    background: rgba(126,217,87,0.15);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 4px;
}

.ch-unread-badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 20px;
    padding: 1px 7px;
    min-width: 18px;
    text-align: center;
    display: inline-block;
}

.ch-topbar a.ch-back { color: var(--text-dim); font-size: 0.9rem; text-decoration: none; }
.ch-topbar a.ch-back:hover { color: var(--text); }

.ch-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.85rem;
}
.ch-logout:hover { border-color: var(--danger); color: var(--danger); }

/* Login */
.ch-login-wrap {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ch-login-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
    text-align: center;
}

.ch-login-card h1 {
    font-size: 1.6rem;
    margin: 0 0 6px;
    color: var(--wood);
}

.ch-login-card p.ch-sub {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: 0 0 26px;
}

.ch-field { text-align: left; margin-bottom: 16px; }
.ch-field label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 6px; }
.ch-field input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}
.ch-field input:focus { outline: none; border-color: var(--wood); }

.ch-btn {
    background: var(--wood);
    color: #1a1310;
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
    width: 100%;
}
.ch-btn:hover { background: var(--wood-dark); color: white; }

.ch-error {
    background: rgba(217,83,79,0.15);
    color: #ff9d9a;
    border: 1px solid rgba(217,83,79,0.4);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* Dashboard */
.ch-hero {
    padding: 36px 20px 10px;
    text-align: center;
}
.ch-hero h1 { font-size: 2rem; margin: 0 0 6px; color: var(--wood); }
.ch-hero p { color: var(--text-dim); margin: 0; }

.ch-grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 24px;
}

@media (max-width: 860px) {
    .ch-grid-layout { grid-template-columns: 1fr; }
}

.ch-grid-layout .ch-panel-wide { grid-column: 1 / -1; }

/* Bouton Messages du tableau de bord - s'allume en rouge des qu'il y a des non-lus */
.ch-msg-btn-alert {
    background: var(--danger) !important;
    color: white !important;
    animation: ch-msg-pulse 1.1s ease-in-out infinite;
}
.ch-msg-btn-count {
    background: white;
    color: var(--danger);
    font-weight: 800;
    font-size: 0.85rem;
    border-radius: 20px;
    padding: 1px 9px;
    margin-left: 8px;
}
@keyframes ch-msg-pulse {
    from { box-shadow: 0 0 0 0 rgba(217,83,79,0.6); }
    to   { box-shadow: 0 0 0 10px rgba(217,83,79,0); }
}

.ch-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.ch-panel h2 {
    font-size: 1.15rem;
    margin: 0 0 16px;
    color: var(--wood);
}

#calendar { background: var(--bg-panel); border-radius: 8px; padding: 10px; }

.ch-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.ch-legend-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-dim);
}

/* FullCalendar dark-mode overrides */
.fc { color: var(--text); }
.fc .fc-toolbar-title { color: var(--text); }
.fc .fc-toolbar { flex-wrap: wrap; gap: 10px; }
.fc .fc-button {
    background: var(--wood) !important;
    border: none !important;
    color: #1a1310 !important;
    text-transform: capitalize;
}
.fc .fc-button:hover { background: var(--wood-dark) !important; color: white !important; }
.fc .fc-button-active { background: var(--wood-dark) !important; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border); }
.fc-daygrid-day-number { color: var(--text-dim); }
.fc .fc-day-today { background: rgba(126,217,87,0.08) !important; }
.fc-day:hover { background: rgba(255,255,255,0.035); cursor: pointer; }
.fc-event {
    border: none !important;
    cursor: pointer;
    padding: 1px 4px;
    font-size: 0.82rem;
    transition: filter 0.12s ease, transform 0.12s ease;
}
.fc-event:hover { filter: brightness(1.15); transform: translateY(-1px); }
.fc-daygrid-event-dot { display: none; }
.fc-list-event:hover td { background: rgba(255,255,255,0.05) !important; }
.fc-list-day-cushion { background: var(--bg-card) !important; color: var(--wood) !important; }

/* Grille annuelle personnalisee (remplace la vue multiMonthYear de FullCalendar, qui restait
   trop compacte/illisible peu importe le reglage) - mois en lignes, jours 1-31 en colonnes. */
.ch-year-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 10px;
}
.ch-year-nav #year-grid-label {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--wood);
    min-width: 60px;
    text-align: center;
}
.ch-year-grid-scroll { overflow-x: auto; }
.ch-year-grid {
    border-collapse: collapse;
    width: 100%;
}
.ch-year-grid th, .ch-year-grid td {
    border: 1px solid var(--border);
    text-align: center;
}
.ch-year-grid thead th {
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 2px;
    background: var(--bg-panel);
}
.ch-year-grid tbody th {
    color: var(--wood);
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0 10px;
    white-space: nowrap;
    background: var(--bg-panel);
    text-align: left;
}
.ch-yg-day {
    width: 26px;
    height: 26px;
    padding: 0;
}
.ch-yg-empty {
    background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 4px, var(--bg-panel) 4px, var(--bg-panel) 8px);
    border-color: var(--border);
}
.ch-yg-filled {
    cursor: pointer;
    transition: filter 0.12s ease, transform 0.12s ease;
}
.ch-yg-filled:hover {
    filter: brightness(1.2);
    transform: scale(1.15);
    position: relative;
    z-index: 2;
}
.ch-event-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 5px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}

/* Glow anime sur la selection de dates dans le calendrier (feedback visuel a la selection).
   --glow-r/g/b sont fixes par la page (dashboard.php) a la couleur du proprietaire connecte -
   defaut vert (accent) si la page ne les definit pas. */
:root { --glow-r: 126; --glow-g: 217; --glow-b: 87; }
.fc-highlight {
    background: rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.32) !important;
    box-shadow:
        0 0 10px 2px rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.5),
        inset 0 0 0 1px rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.7);
    animation: ch-select-glow 1.1s ease-in-out infinite alternate;
}
@keyframes ch-select-glow {
    from {
        box-shadow:
            0 0 6px 1px rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.35),
            inset 0 0 0 1px rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.5);
    }
    to {
        box-shadow:
            0 0 18px 5px rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.8),
            inset 0 0 0 1px rgba(var(--glow-r), var(--glow-g), var(--glow-b), 0.9);
    }
}

.ch-reservation-list { list-style: none; margin: 0; padding: 0; }
.ch-reservation-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 1.02rem;
}
.ch-reservation-list li:last-child { border-bottom: none; }
.ch-reservation-list .ch-r-owners { font-weight: 700; }
.ch-reservation-list .ch-r-dates { color: var(--text-dim); display: block; font-size: 0.9rem; }
.ch-reservation-list .ch-r-cost { color: var(--accent); font-weight: 700; }

.ch-swatch {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.ch-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.ch-summary-row:last-child { border-bottom: none; font-weight: 700; color: var(--accent); }

.ch-empty { color: var(--text-dim); font-size: 0.9rem; text-align: center; padding: 20px 0; }

/* Modal de reservation */
.ch-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    z-index: 100;
    /* Defile si le contenu de la modale depasse la hauteur de l'ecran (surtout mobile en
       portrait, avec le clavier tactile qui reduit encore la place) - sinon le bouton
       Confirmer ou le titre devient inaccessible. */
    overflow-y: auto;
    padding: 20px 16px;
    -webkit-overflow-scrolling: touch;
}
.ch-modal-backdrop.open { display: flex; }

.ch-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    width: 100%;
    max-width: 420px;
    max-height: 100%;
    overflow-y: auto;
    box-shadow: var(--shadow);
    margin: auto;
}

@media (max-width: 480px) {
    .ch-modal { padding: 18px; }
}
.ch-modal h3 { margin: 0 0 4px; color: var(--wood); display: flex; align-items: center; }
.ch-modal h3 .ch-swatch { width: 12px; height: 12px; margin-right: 8px; }
.ch-modal p.ch-modal-dates { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 18px; }
.ch-modal-cost {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 16px 0;
    font-size: 0.9rem;
}
.ch-modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.ch-modal-actions .ch-btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 11px 20px;
    border-radius: 8px;
    cursor: pointer;
    flex: 1;
}
.ch-modal-actions .ch-btn { flex: 1; }
