/*
 * CDG46 Agenda — styles autonomes
 * Scope : toutes les règles sont préfixées .cdg46- pour éviter tout conflit
 * avec le thème du site hôte. Pas de reset global.
 */

/* =========================================================
   Wrapper principal
   ========================================================= */
.cdg46-agenda-wrap {
    font-family: inherit;
    color: inherit;
    line-height: 1.5;
    box-sizing: border-box;
}
.cdg46-agenda-wrap *,
.cdg46-agenda-wrap *::before,
.cdg46-agenda-wrap *::after {
    box-sizing: inherit;
}

/* =========================================================
   Barre d'outils
   ========================================================= */
.cdg46-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    margin-bottom: 1rem;
}

/* =========================================================
   Boutons
   ========================================================= */
.cdg46-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem 1rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    background: #1e40af;
    color: #fff !important;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: background .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.cdg46-btn:hover,
.cdg46-btn:focus-visible {
    background: #1d3a9e;
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.cdg46-btn--ical        { background: #0f766e; }
.cdg46-btn--ical:hover  { background: #0d6460; }
.cdg46-btn--ical-all    { background: transparent; color: #0f766e !important; border: 1px solid #0f766e; }
.cdg46-btn--ical-all:hover { background: #f0fdfa; }
.cdg46-btn--list   { background: #4b5563; }
.cdg46-btn--list:hover { background: #374151; }
.cdg46-btn--nav    { background: transparent; color: #1e40af !important; border: 1px solid #bfdbfe; }
.cdg46-btn--nav:hover { background: #eff6ff; }
.cdg46-btn--back   { background: transparent; color: #4b5563 !important; border: 1px solid #d1d5db; }
.cdg46-btn--back:hover { background: #f9fafb; }

/* =========================================================
   FullCalendar — surcharges légères
   ========================================================= */
.cdg46-agenda-wrap .fc {
    --fc-border-color: #e5e7eb;
    --fc-today-bg-color: #eff6ff;
    --fc-event-border-color: transparent;
}
.cdg46-agenda-wrap .fc-toolbar-title {
    font-size: 1.1rem !important;
    font-weight: 600;
}
.cdg46-agenda-wrap .fc-event {
    cursor: pointer;
    border-radius: 4px;
    font-size: .8rem;
    padding: 1px 4px;
}

/* =========================================================
   Modal événement
   ========================================================= */
.cdg46-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.cdg46-modal[hidden] {
    display: none;
}
.cdg46-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    cursor: pointer;
}
.cdg46-modal__box {
    position: relative;
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.cdg46-modal__color-bar {
    height: 6px;
    border-radius: 10px 10px 0 0;
    background: #3b82f6;
}
.cdg46-modal__body {
    padding: 1.5rem;
}
.cdg46-modal__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: .25rem;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.cdg46-modal__close:hover,
.cdg46-modal__close:focus-visible {
    color: #111;
    background: #f3f4f6;
    outline: none;
}
.cdg46-modal__box h2 {
    margin: 0 0 .75rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    padding-right: 2rem;
}
.cdg46-modal__meta {
    margin: .3rem 0;
    color: #4b5563;
    font-size: .9rem;
}
.cdg46-modal__desc {
    margin-top: 1rem;
    font-size: .9rem;
    color: #374151;
    line-height: 1.6;
}
.cdg46-modal__actions {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* =========================================================
   Vue liste
   ========================================================= */
.cdg46-list-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.cdg46-list-nav__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: capitalize;
}
.cdg46-event-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.cdg46-empty {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
}

/* =========================================================
   Carte événement (partial EventCard)
   ========================================================= */
.cdg46-event-card {
    display: flex;
    gap: 1rem;
    padding: .875rem 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    transition: box-shadow .15s;
}
.cdg46-event-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}
.cdg46-event-card__date {
    min-width: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border-radius: 6px;
    padding: .5rem .75rem;
}
.cdg46-event-card__day {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #1e40af;
}
.cdg46-event-card__month {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #3b82f6;
    font-weight: 600;
}
.cdg46-event-card__content {
    flex: 1;
    min-width: 0;
}
.cdg46-event-card__title {
    margin: 0 0 .35rem;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.3;
}
.cdg46-event-card__title a {
    color: inherit;
    text-decoration: none;
}
.cdg46-event-card__title a:hover {
    text-decoration: underline;
    color: #1e40af;
}
.cdg46-event-card__meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    font-size: .8rem;
    color: #6b7280;
}

/* =========================================================
   Page détail événement
   ========================================================= */
.cdg46-event-detail {
    max-width: 700px;
}
.cdg46-breadcrumb {
    margin-bottom: 1.25rem;
}
.cdg46-event-detail__article {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    overflow: hidden;
}
.cdg46-event-detail__color-bar {
    height: 8px;
    background: #3b82f6;
}
.cdg46-event-detail__body {
    padding: 1.75rem;
}
.cdg46-event-detail__title {
    margin: 0 0 1rem;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.25;
}
.cdg46-event-detail__meta {
    margin: .4rem 0;
    color: #4b5563;
    font-size: .95rem;
}
.cdg46-event-detail__description {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
    font-size: .95rem;
    line-height: 1.7;
    color: #374151;
}
.cdg46-event-detail__actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 640px) {

    /* Toolbar custom : boutons en pleine largeur empilés */
    .cdg46-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: .4rem;
    }
    .cdg46-toolbar .cdg46-btn {
        justify-content: center;
        width: 100%;
    }

    /* FullCalendar : toolbar en colonne sur mobile */
    .cdg46-agenda-wrap .fc .fc-toolbar {
        flex-direction: column;
        gap: .4rem;
        align-items: stretch;
    }
    .cdg46-agenda-wrap .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: .25rem;
    }
    /* Titre centré plus compact */
    .cdg46-agenda-wrap .fc-toolbar-title {
        font-size: .95rem !important;
        text-align: center;
    }
    /* Boutons FullCalendar plus petits */
    .cdg46-agenda-wrap .fc .fc-button {
        padding: .25rem .5rem !important;
        font-size: .8rem !important;
    }

    /* Carte événement */
    .cdg46-event-card {
        flex-direction: column;
        gap: .5rem;
    }
    .cdg46-event-card__date {
        flex-direction: row;
        gap: .5rem;
        align-self: flex-start;
        padding: .25rem .5rem;
    }
    .cdg46-event-card__day {
        font-size: 1rem;
    }

    /* Modal plein écran sur mobile */
    .cdg46-modal {
        align-items: flex-end;
        padding: 0;
    }
    .cdg46-modal__box {
        max-height: 90vh;
        border-radius: 14px 14px 0 0;
        width: 100%;
        max-width: 100%;
    }

    /* Navigation liste */
    .cdg46-list-nav {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: .5rem;
    }
    .cdg46-list-nav .cdg46-btn {
        justify-content: center;
    }
}
