/* =============================================================================
   agenda-shortcuts.css
   Raccourcis temporels, séparateur et en-têtes de groupe — Agenda
   À importer dans agenda.css ou via le prop stylesheets de Layout.
   ============================================================================= */


/* ── 1. Raccourcis temporels ─────────────────────────────────────────────────
   Aujourd'hui · Cette semaine · Par mois · Toutes les dates
   --------------------------------------------------------------------------- */

.agenda-control-label {
    margin: 0 0 0.45rem;
    font-family: var(--font-heading, inherit);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted, #64748b);
}

.agenda-period-block,
.agenda-month-block,
.agenda-theme-block {
    display: grid;
    gap: 0;
}

.agenda-time-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
}

.time-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1.5px solid var(--color-border, #e5e7eb);
    background: var(--color-surface, #fff);
    color: var(--color-text, #374151);
    font-size: 0.83rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
                box-shadow 0.15s ease;
}

/* Icône FontAwesome à l'intérieur */
.time-shortcut i {
    font-size: 0.78rem;
    flex-shrink: 0;
}

/* Hover */
.time-shortcut:hover {
    border-color: var(--color-primary, #1b4332);
    color: var(--color-primary, #1b4332);
    background: var(--color-primary-light, #f0fdf4);
}

/* Focus clavier */
.time-shortcut:focus-visible {
    outline: 2px solid var(--color-primary, #1b4332);
    outline-offset: 2px;
}

/* Actif */
.time-shortcut.is-active,
.time-shortcut[aria-pressed="true"] {
    background: var(--color-primary, #1b4332);
    border-color: var(--color-primary, #1b4332);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(27, 67, 50, 0.25);
}

/* Hover sur le bouton actif */
.time-shortcut.is-active:hover,
.time-shortcut[aria-pressed="true"]:hover {
    background: var(--color-primary-dark, #163d27);
    border-color: var(--color-primary-dark, #163d27);
    color: #fff;
}

/* Indicateur "aujourd'hui" : petit point vert animé */
.time-shortcut[data-timefilter="today"]::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success, #22c55e);
    flex-shrink: 0;
    animation: pulse-dot 2s infinite;
}

.time-shortcut[data-timefilter="today"].is-active::before,
.time-shortcut[data-timefilter="today"][aria-pressed="true"]::before {
    background: #86efac;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(1.3); }
}

@media (prefers-reduced-motion: reduce) {
    .time-shortcut[data-timefilter="today"]::before {
        animation: none;
    }
}


/* ── 2. Séparateur ───────────────────────────────────────────────────────────
   Ligne fine entre les raccourcis/navigation et les filtres catégorie
   --------------------------------------------------------------------------- */

.agenda-divider {
    border: none;
    border-top: 1px solid var(--color-border, #f3f4f6);
    margin: 0;
}


/* ── 3. En-têtes de groupe d'événements ──────────────────────────────────────
   Aujourd'hui / Cette semaine / Juin / Juillet…
   Affichés dans la liste SSR et reproduits par agenda.js côté client
   --------------------------------------------------------------------------- */

.events-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 12px;
    /* Première occurrence : pas de marge haute */
    &:first-child { margin-top: 8px; }
}

/* Ligne décorative avant le titre */
.events-group-header::before {
    content: '';
    display: block;
    width: 4px;
    height: 22px;
    border-radius: 4px;
    background: var(--color-primary, #1b4332);
    flex-shrink: 0;
}

/* Trait horizontal après le titre */
.events-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border, #e5e7eb);
}

.events-group-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary, #1b4332);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    margin: 0;
}

/* Variante "Aujourd'hui" : accent coloré */
.events-group-header[data-group="Aujourd'hui"] .events-group-title {
    color: var(--color-success-dark, #166534);
}

.events-group-header[data-group="Aujourd'hui"]::before {
    background: var(--color-success, #22c55e);
}

/* Variante "Cette semaine" : accent intermédiaire */
.events-group-header[data-group="Cette semaine"] .events-group-title {
    color: var(--color-primary, #1b4332);
}


/* ── 4. Message noscript ──────────────────────────────────────────────────── */

.agenda-noscript {
    font-size: 0.82rem;
    color: var(--color-text-muted, #6b7280);
    background: var(--color-warning-light, #fefce8);
    border: 1px solid var(--color-warning-border, #fde68a);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 4px;
}


/* ── 5. Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
    .agenda-time-shortcuts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .time-shortcut {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    .events-group-title {
        font-size: 0.8rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANNEAU ADMIN — agenda-admin-panel.js
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables locales ───────────────────────────────────────────────────── */
:root {
    --adm-green:    #1b4332;
    --adm-green-lt: #2d6a4f;
    --adm-accent:   #52b788;
    --adm-bg:       #f8fafc;
    --adm-border:   #e2e8f0;
    --adm-text:     #0f172a;
    --adm-muted:    #64748b;
    --adm-radius:   10px;
    --adm-shadow:   0 -8px 40px rgba(0,0,0,0.12), 0 -2px 8px rgba(0,0,0,0.06);
}

/* ── Masquage strict des éléments cachés (priorité sur display: flex) ───── */
.csh-admin-overlay[hidden],
.csh-admin-panel[hidden] {
    display: none !important;
}

/* ── Overlay mot de passe ────────────────────────────────────────────────── */
.csh-admin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    animation: csh-fade-in 0.2s ease;
}
@keyframes csh-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.csh-admin-login {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.08);
    position: relative;
    text-align: center;
    animation: csh-slide-up 0.25s ease;
}
@keyframes csh-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.csh-admin-login__close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    color: var(--adm-muted);
    font-size: 0.95rem;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.csh-admin-login__close:hover {
    background: #e2e8f0;
    color: var(--adm-text);
    transform: rotate(90deg);
}

.csh-admin-login__icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--adm-green), var(--adm-green-lt));
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(27,67,50,0.3);
}

.csh-admin-login__title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--adm-text);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.csh-admin-login__desc {
    font-size: 0.84rem;
    color: var(--adm-muted);
    margin-bottom: 12px;
    line-height: 1.6;
}
.csh-admin-login__desc code {
    font-size: 0.78rem;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: var(--adm-bg);
    color: var(--adm-text);
}
.csh-admin-login__hint {
    font-size: 0.78rem;
    color: var(--adm-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}
.csh-admin-login__hint kbd {
    font-size: 0.72rem;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    border: 1px solid var(--adm-border);
    background: var(--adm-bg);
}

.csh-login-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--adm-border);
    border-radius: var(--adm-radius);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 10px;
    background: var(--adm-bg);
    color: var(--adm-text);
    text-align: center;
    letter-spacing: 0.1em;
}
.csh-login-input:focus {
    border-color: var(--adm-accent);
    box-shadow: 0 0 0 3px rgba(82,183,136,0.15);
    background: #fff;
}

.csh-login-error {
    font-size: 0.82rem;
    color: #ef4444;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 6px;
    border-left: 3px solid #ef4444;
    text-align: left;
}

.csh-login-submit {
    width: 100%;
    margin-top: 4px;
    background: linear-gradient(135deg, var(--adm-green), var(--adm-green-lt)) !important;
    border: none !important;
    padding: 12px !important;
    border-radius: var(--adm-radius) !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    transition: opacity 0.2s, transform 0.15s !important;
}
.csh-login-submit:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* ── Panneau admin flottant ──────────────────────────────────────────────── */
.csh-admin-panel {
    position: fixed;
    bottom: 0;
    right: 24px;
    width: 440px;
    max-width: calc(100vw - 32px);
    max-height: 90vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--adm-shadow);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1.5px solid var(--adm-border);
    border-bottom: none;
    animation: csh-panel-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes csh-panel-in {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Barre de poignée en haut */
.csh-admin-panel::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
    position: absolute;
    top: 10px; left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.csh-admin-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    background: linear-gradient(135deg, var(--adm-green) 0%, var(--adm-green-lt) 100%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    gap: 8px;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}
.csh-admin-panel__header > span {
    display: flex;
    align-items: center;
    gap: 8px;
}
.csh-admin-panel__header > span i {
    font-size: 1rem;
    opacity: 0.9;
}

/* Badge "Admin" dans le header */
.csh-admin-panel__header::after {
    content: 'ADMIN';
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: rgba(255,255,255,0.2);
    padding: 2px 7px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
    margin-left: 4px;
}

.csh-admin-panel__close {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 8px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, transform 0.2s;
    flex-shrink: 0;
}
.csh-admin-panel__close:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(2px);
}

.csh-admin-panel__body {
    padding: 18px 20px 8px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--adm-border) transparent;
}

/* ── Sections du formulaire ──────────────────────────────────────────────── */
.csh-form-section {
    background: var(--adm-bg);
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 14px 14px 10px;
    margin-bottom: 12px;
}
.csh-form-section__label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--adm-accent);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── Champs ──────────────────────────────────────────────────────────────── */
.csh-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
    flex: 1;
    min-width: 0;
}
.csh-field:last-child { margin-bottom: 0; }

.csh-field label {
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--adm-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.csh-field input,
.csh-field select,
.csh-field textarea {
    padding: 9px 12px;
    border: 1.5px solid var(--adm-border);
    border-radius: 8px;
    font-size: 0.87rem;
    color: var(--adm-text);
    outline: none;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}
.csh-field textarea {
    resize: vertical;
    min-height: 4.5rem;
    line-height: 1.45;
    font-family: inherit;
}
.csh-field input::placeholder,
.csh-field textarea::placeholder { color: #b0bec5; }
.csh-field input:focus,
.csh-field select:focus,
.csh-field textarea:focus {
    border-color: var(--adm-accent);
    box-shadow: 0 0 0 3px rgba(82,183,136,0.12);
}

.csh-field-row {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}

/* Champ pleine largeur dans une row */
.csh-field--grow { flex: 2; }

/* ── Bouton soumettre ────────────────────────────────────────────────────── */
.csh-submit-btn {
    width: 100%;
    margin-top: 14px;
    padding: 13px !important;
    background: linear-gradient(135deg, var(--adm-green), var(--adm-green-lt)) !important;
    border: none !important;
    border-radius: var(--adm-radius) !important;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s !important;
    box-shadow: 0 4px 14px rgba(27,67,50,0.25) !important;
}
.csh-submit-btn:hover {
    opacity: 0.93;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(27,67,50,0.3) !important;
}
.csh-submit-btn i {
    transition: transform 0.3s;
}
.csh-submit-btn:hover i {
    transform: translateX(3px);
}

/* ── Zone de sortie (après génération) ──────────────────────────────────── */
.csh-output {
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
    animation: csh-fade-in 0.2s ease;
}
/* ── Label zone de sortie ────────────────────────────────────────────────── */
.csh-output__label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #166534;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.csh-output__text {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #86efac;
    border-radius: 8px;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    color: #166534;
    background: #fff;
    resize: none;
    margin-bottom: 12px;
    line-height: 1.5;
}
.csh-output__actions {
    display: flex;
    gap: 8px;
}
.csh-output__actions .btn {
    flex: 1;
}
.csh-copy-confirm {
    font-size: 0.8rem;
    color: #16a34a;
    font-weight: 700;
    text-align: center;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ── Footer / Verrouiller ────────────────────────────────────────────────── */
.csh-admin-panel__footer {
    padding: 10px 20px 16px;
    border-top: 1px solid var(--adm-border);
    flex-shrink: 0;
    background: var(--adm-bg);
}
.csh-lock-btn {
    background: #fff;
    border: 1.5px solid var(--adm-border);
    border-radius: 8px;
    color: var(--adm-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    width: 100%;
    letter-spacing: 0.01em;
}
.csh-lock-btn:hover {
    border-color: #fca5a5;
    color: #ef4444;
    background: #fef2f2;
}
.csh-lock-btn i { font-size: 0.75rem; }

/* ── Onglets formulaire / liste ──────────────────────────────────────────── */
.csh-admin-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 16px 0;
    background: var(--adm-bg);
    border-bottom: 1px solid var(--adm-border);
    flex-shrink: 0;
}
.csh-admin-tab {
    flex: 1;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 8px 8px 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--adm-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.csh-admin-tab.is-active {
    background: #fff;
    color: var(--adm-green);
    box-shadow: 0 -1px 0 var(--adm-border);
}
.csh-panel-form-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--adm-text);
    margin-bottom: 6px;
}
.csh-panel-hint {
    font-size: 0.76rem;
    color: var(--adm-muted);
    line-height: 1.5;
    margin-bottom: 12px;
}
.csh-panel-hint code {
    font-size: 0.72rem;
    background: #e2e8f0;
    padding: 1px 4px;
    border-radius: 4px;
}
.csh-field--checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--adm-text);
    cursor: pointer;
}
.csh-field--checkbox input {
    width: auto;
    margin-top: 3px;
}
.csh-cancel-edit {
    width: 100%;
    margin-top: 8px;
}

/* ── Liste admin ─────────────────────────────────────────────────────────── */
.csh-admin-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 42vh;
    overflow-y: auto;
}
.csh-admin-list__empty {
    font-size: 0.85rem;
    color: var(--adm-muted);
    text-align: center;
    padding: 20px;
}
.csh-admin-list__item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    background: #fff;
}
.csh-admin-list__item.is-draft {
    border-style: dashed;
    background: #fffbeb;
}
.csh-admin-list__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8rem;
    color: var(--adm-muted);
}
.csh-admin-list__main strong {
    font-size: 0.88rem;
    color: var(--adm-text);
}
.csh-admin-list__draft {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #b45309;
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
}
.csh-admin-list__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.csh-admin-list__btn {
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--adm-border);
    border-radius: 6px;
    background: var(--adm-bg);
    color: var(--adm-text);
    cursor: pointer;
}
.csh-admin-list__btn:hover {
    border-color: var(--adm-accent);
}
.csh-admin-list__btn--danger:hover {
    border-color: #fca5a5;
    color: #dc2626;
    background: #fef2f2;
}
.csh-admin-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--adm-border);
}

.csh-panel-hint--export {
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 0.72rem;
    text-align: center;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.csh-admin-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: var(--adm-green);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-width: min(90vw, 420px);
    text-align: center;
}
.csh-admin-toast[hidden] {
    display: none !important;
}

/* ── Responsive mobile ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .csh-admin-overlay,
    .csh-admin-login,
    .csh-admin-panel {
        animation: none;
    }
}

@media (max-width: 640px) {
    .csh-admin-panel {
        right: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }
    .csh-field-row {
        flex-wrap: wrap;
    }
    .csh-field-row .csh-field {
        min-width: calc(50% - 4px);
    }
}
