/* =================================================================
   CALENDRIER D'OCCUPATION - STYLES
   ================================================================= */

/* Conteneur principal */
.lc-year-calendar-container,
.lc-month-calendar-container {
    background: white;
    padding: 20px;
    margin: 20px 0;
}

.lc-calendar-title {
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.lc-month-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #34495e;
    margin-bottom: 15px;
}

/* Erreurs */
.lc-error {
    background: #fee;
    border: 2px solid #c33;
    border-radius: 4px;
    padding: 15px;
    color: #c33;
    font-weight: bold;
}

/* =================================================================
   CALENDRIER ANNUEL (Tableau par semaine)
   ================================================================= */

.lc-year-calendar {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: fixed;
}

/* En-tête jour de la semaine */
.lc-weekday-header {
    background: #ffd966;
    border: 1px solid #333;
    padding: 4px;
    text-align: center;
    font-weight: bold;
    width: 80px;
}

/* Nom du jour de la semaine dans la première colonne */
.lc-weekday-name {
    background: #c0c0c0;
    border: 1px solid #333;
    padding: 4px;
    text-align: center;
    font-weight: bold;
    vertical-align: middle;
}

/* Week-ends plus pâles */
.lc-weekend .lc-weekday-name {
    background: #c0c0c0;
    opacity: 0.5;
}

.lc-month-header {
    border: 1px solid #333;
    padding: 4px;
    text-align: center;
    font-weight: bold;
    font-size: 10px;
    color: black;
}

/* Couleurs alternées pour les 12 mois */
.lc-month-1 { background-color: #ffd966; } /* Janvier - Jaune */
.lc-month-2 { background-color: #e06666; } /* Février - Rouge */
.lc-month-3 { background-color: #93c47d; } /* Mars - Vert clair */
.lc-month-4 { background-color: #6fa8dc; } /* Avril - Bleu clair */
.lc-month-5 { background-color: #cc66ff; } /* Mai - Violet */
.lc-month-6 { background-color: #f6b26b; } /* Juin - Orange */
.lc-month-7 { background-color: #ffd966; } /* Juillet - Jaune */
.lc-month-8 { background-color: #e06666; } /* Août - Rouge */
.lc-month-9 { background-color: #93c47d; } /* Septembre - Vert clair */
.lc-month-10 { background-color: #6fa8dc; } /* Octobre - Bleu clair */
.lc-month-11 { background-color: #cc66ff; } /* Novembre - Violet */
.lc-month-12 { background-color: #f6b26b; } /* Décembre - Orange */

/* Cellules de semaine (contient plusieurs jours) */
.lc-week-cell {
    border: 1px solid #333;
    padding: 1px;
    vertical-align: top;
    min-height: 20px;
    height: 20px;
    font-size: 9px;
    position: relative;
    opacity: 0.8;
}

/* Week-ends plus pâles */
.lc-week-cell.lc-weekend {
    opacity: 0.5;
}

/* Wrapper du jour (numéro + timeline sur MÊME ligne) */
.lc-day-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row; /* Horizontal au lieu de vertical */
    align-items: stretch;
}

/* Numéro du jour (à gauche) */
.lc-day-num {
    display: block;
    font-weight: bold;
    font-size: 9px;
    flex-shrink: 0;
    width: 12px; /* Largeur fixe pour le numéro */
    text-align: center;
    padding-right: 2px;
    border-right: 1px solid #ddd;
}

/* Timeline des événements (à droite du numéro) */
.lc-events-timeline {
    position: relative;
    flex: 1;
    min-height: 16px;
    height: 100%;
}

/* Barre d'événement HORIZONTALE (positionnée selon l'heure) */
.lc-year-event-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    height: 100%;
    border-radius: 2px;
    font-size: 7px;
    font-weight: bold;
    line-height: 18px;
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.2s, z-index 0s;
    z-index: 1;
}

.lc-year-event-bar:hover {
    transform: scaleY(1.2);
    z-index: 10;
}

/* Couleurs événements barres */
.lc-year-event-bar.lc-assoc {
    background-color: #c2203a;
    color: white;
    border-top: 2px solid #9b1a2e;
}

.lc-year-event-bar.lc-external {
    background-color: #e0e0e0;
    color: black;
    border-top: 2px solid #c8c8c8;
}

/* Couleurs par catégorie (vue annuelle) — prennent le dessus sur assoc/external */
.lc-year-event-bar.lc-cat-activites {
    background: radial-gradient(rgba(237,125,50,1) 0%, rgba(237,145,84,1) 100%);
    color: black;
    border-top: 2px solid rgba(200,90,20,1);
}
.lc-year-event-bar.lc-cat-gestion {
    background: radial-gradient(rgba(255,192,1,1) 0%, rgba(255,207,70,1) 100%);
    color: black;
    border-top: 2px solid rgba(200,145,0,1);
}
.lc-year-event-bar.lc-cat-decision {
    background: radial-gradient(rgba(112,173,71,1) 0%, rgba(150,220,103,1) 100%);
    color: black;
    border-top: 2px solid rgba(80,130,50,1);
}

.lc-event-abbrev {
    font-size: 7px;
    vertical-align: middle;
}

.lc-conflict-icon {
    float: right;
    font-size: 8px;
}

/* Anciens styles événements (fallback) */
.lc-year-event {
    display: inline-block;
    padding: 1px 3px;
    margin: 1px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: bold;
    line-height: 1.2;
}

/* Couleurs événements : Association vs Externe */
.lc-year-event.lc-assoc {
    background-color: #4a90e2;
    color: black;
}

.lc-year-event.lc-external {
    background-color: #f0f0f0;
    color: black;
}

/* Légende */
.lc-legend {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.lc-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.lc-legend-box {
    display: inline-block;
    width: 30px;
    height: 15px;
    border-radius: 3px;
}

.lc-legend-box.lc-assoc {
    background-color: #c2203a;
}

.lc-legend-box.lc-external {
    background-color: #e0e0e0;
}

.lc-legend-icon {
    font-size: 18px;
}

/* =================================================================
   CALENDRIER MENSUEL
   ================================================================= */

.lc-month-calendar-container {
    margin-bottom: 30px;
}

/* Navigation mois précédent/suivant */
.lc-month-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.lc-nav-prev,
.lc-nav-next {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background 0.2s;
}

.lc-nav-prev:hover,
.lc-nav-next:hover {
    background: #e9ecef;
}

.lc-month-title {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    color: #34495e;
}

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

.lc-month-calendar th {
    background: #34495e;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #2c3e50;
}

/* En-têtes week-end */
.lc-weekend-header {
    background: #4a5568 !important;
}

.lc-month-calendar td {
    border: 1px solid #bdc3c7;
    padding: 5px;
    vertical-align: top;
    min-height: 80px;
    height: 100px;
}

.lc-month-empty {
    background: #ecf0f1;
}

/* Jours week-end */
.lc-month-weekend {
    background: #f8f9fa !important;
}

.lc-month-day-number {
    font-weight: bold;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.lc-month-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lc-month-event {
    font-size: 11px;
    padding: 3px 5px;
    border-radius: 3px;
    line-height: 1.3;
}

.lc-month-event.lc-assoc {
    background-color: #e2405a;
    border-left: 3px solid #b2102a;
    color: black;
}

.lc-month-event.lc-external {
    background-color: #e0e0e0;
    border-left: 3px solid #b0b0b0;
}

/* Couleurs par catégorie (vue mensuelle) — prennent le dessus sur assoc/external */
.lc-month-event.lc-cat-activites {
    background: radial-gradient(rgba(237,125,50,1) 0%, rgba(237,145,84,1) 100%);
    border-left: 3px solid rgba(200,90,20,1);
    color: black;
}
.lc-month-event.lc-cat-gestion {
    background: radial-gradient(rgba(255,192,1,1) 0%, rgba(255,207,70,1) 100%);
    border-left: 3px solid rgba(200,145,0,1);
    color: black;
}
.lc-month-event.lc-cat-decision {
    background: radial-gradient(rgba(112,173,71,1) 0%, rgba(150,220,103,1) 100%);
    border-left: 3px solid rgba(80,130,50,1);
    color: black;
}

.lc-month-event strong {
    display: block;
    color: #333;
}

/* =================================================================
   IMPRESSION
   ================================================================= */

/* Page par défaut : A4 portrait (list, month) */
@page {
    size: A4 portrait;
    margin: 15mm;
}

/* Page nommée A3 paysage uniquement pour le calendrier annuel */
@page lc-year-page {
    size: A3 landscape;
    margin: 10mm;
}

@media print {
    body {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Calendrier annuel → page A3 paysage */
    .lc-year-calendar-container {
        page: lc-year-page;
        page-break-after: always;
    }
    
    .lc-calendar-title {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .lc-year-calendar {
        font-size: 8px;
    }
    
    .lc-month-header {
        font-size: 8px;
        padding: 2px;
    }
    
    .lc-day-number {
        font-size: 8px;
        padding: 2px;
    }
    
    .lc-day-cell {
        font-size: 7px;
        padding: 1px;
        min-height: 18px;
    }
    
    .lc-year-event {
        font-size: 7px;
        padding: 0px 2px;
    }
    
    /* Forcer les couleurs en impression */
    .lc-month-header,
    .lc-day-header,
    .lc-day-number,
    .lc-day-cell,
    .lc-year-event {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
    
    /* Calendrier mensuel */
    .lc-month-calendar-container {
        page-break-after: always;
        page-break-inside: avoid;
    }
    
    .lc-month-calendar-container:last-child {
        page-break-after: auto;
    }
    
    .lc-month-title {
        font-size: 20px;
    }
    
    .lc-month-calendar {
        font-size: 10px;
    }
    
    .lc-month-calendar th {
        padding: 6px;
    }
    
    .lc-month-calendar td {
        padding: 3px;
        min-height: 60px;
    }
    
    .lc-month-event {
        font-size: 9px;
        padding: 2px 3px;
    }
    
    /* Cacher la légende en impression (prend de la place) */
    .lc-legend {
        display: none;
    }

    /* Liste chronologique : structure <ul>/<li> — Safari respecte les <li> comme unités atomiques */
    .lc-list-container {
        width: 100%;
    }

    .lc-list-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Colonnes WordPress : forcer le flex en impression pour que logo et titre restent côte à côte */
    .wp-block-columns {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 12pt !important;
        margin-bottom: 10pt !important;
    }

    .wp-block-column {
        padding-top: 4pt !important;
        padding-bottom: 4pt !important;
    }

    /* Réduire le spacing WordPress via variable CSS */
    :root {
        --wp--preset--spacing--70: 4pt !important;
        --wp--preset--spacing--60: 4pt !important;
        --wp--preset--spacing--50: 4pt !important;
    }

    /* H1 à une taille raisonnable en impression */
    body h1,
    body h1.wp-block-heading {
        font-size: 16pt !important;
        line-height: 1.2 !important;
        margin: 0 !important;
    }
}

/* =================================================================
   RESPONSIVE (Écran)
   ================================================================= */

@media screen and (max-width: 1400px) {
    .lc-year-calendar {
        font-size: 9px;
    }
    
    .lc-month-header {
        font-size: 8px;
    }
    
    .lc-year-event {
        font-size: 7px;
    }
}

@media screen and (max-width: 1024px) {
    .lc-year-calendar {
        font-size: 8px;
    }
    
    .lc-calendar-title {
        font-size: 24px;
    }
    
    .lc-year-event {
        font-size: 6px;
        padding: 0px 1px;
    }
}

/* Mobile : afficher un message */
@media screen and (max-width: 768px) {
    .lc-year-calendar-container::before {
        content: "📱 Tournez votre appareil en mode paysage pour une meilleure visualisation";
        display: block;
        background: #fff3cd;
        border: 2px solid #ffc107;
        padding: 10px;
        margin-bottom: 15px;
        text-align: center;
        border-radius: 4px;
        font-weight: bold;
    }
}

/* =================================================================
   POPUP HOVER – CALENDRIER MENSUEL
   ================================================================= */

.lc-month-event.lc-has-popup {
    position: relative;
    cursor: pointer;
}

.lc-event-popup {
    display: none;
    position: absolute;
    z-index: 9999;
    left: 0;
    top: calc(100% + 4px);
    min-width: 240px;
    max-width: 320px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    padding: 12px 14px;
    font-size: 13px;
    color: #374151;
    line-height: 1.5;
    text-align: left;
    pointer-events: none;
}

/* Apparition au hover */
.lc-month-event.lc-has-popup:hover .lc-event-popup,
.lc-month-event.lc-has-popup:focus-within .lc-event-popup {
    display: block;
}

/* Décalage si popup sort à droite : flipper à gauche */
@media (min-width: 600px) {
    .lc-month-day:nth-child(n+6) .lc-event-popup {
        left: auto;
        right: 0;
    }
}

.lc-popup-time {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 3px;
}
.lc-popup-title {
    font-weight: 700;
    font-size: 14px;
    color: #111827;
    margin-bottom: 6px;
}
.lc-popup-location {
    font-size: 12px;
    margin-bottom: 5px;
    word-break: break-word;
}
.lc-popup-location a { color: #4f46e5; text-decoration: none; }
.lc-popup-location a:hover { text-decoration: underline; }
.lc-popup-desc {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 6px;
    white-space: pre-line;
    max-height: 120px;
    overflow-y: auto;
}
.lc-popup-img {
    margin-top: 6px;
    text-align: center;
}
.lc-popup-img img {
    max-width: 100%;
    max-height: 140px;
    border-radius: 6px;
    object-fit: cover;
}

/* =================================================================
   TYPE LIST
   ================================================================= */

/* Structure ul/li — identique à ICS Calendar (Safari respecte les <li> en impression) */
.lc-list-container {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.lc-list-item {
    display: flex;
    flex-direction: row;
    clear: both;
    border-bottom: 1px solid #f3f4f6;
    margin: 0 0 0 0;
    break-inside: avoid;
    page-break-inside: avoid;
}
.lc-list-item:last-child { border-bottom: none; }

.lc-list-date {
    align-self: flex-start;
    display: inline-block;
    width: 60px;
    min-width: 60px;
    padding: 10px 6px 10px 0;
}

/* Boîte grise autour de la date uniquement */
.lc-list-date-box {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
    line-height: 1.2;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}
.lc-list-dow  { font-size: 11px; color: #6b7280; text-transform: uppercase; }
.lc-list-day  { font-size: 26px; font-weight: 800; color: #111827; }
.lc-list-month{ font-size: 12px; color: #6b7280; text-transform: uppercase; }
.lc-list-year { font-size: 10px; color: #9ca3af; }

.lc-list-body {
    display: inline-block;
    flex: 1;
    border-left: 4px solid #e5e7eb;
    padding: 10px 0 10px 14px;
}
.lc-list-body.lc-assoc    { border-left-color: #c2203a; }
.lc-list-body.lc-external { border-left-color: #059669; }

/* Couleurs par catégorie (vue liste) */
.lc-list-body.lc-cat-activites { border-left-color: rgba(237,125,50,1); }
.lc-list-body.lc-cat-gestion   { border-left-color: rgba(255,192,1,1); }
.lc-list-body.lc-cat-decision  { border-left-color: rgba(112,173,71,1); }

.lc-list-time  { font-size: 12px; color: #6b7280; margin-bottom: 2px; }
.lc-list-title { font-size: 16px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.lc-list-location { font-size: 12px; color: #4b5563; margin-bottom: 3px; }
.lc-list-location a { color: #4f46e5; text-decoration: none; }
.lc-list-location a:hover { text-decoration: underline; }
.lc-list-desc { font-size: 13px; color: #4b5563; white-space: pre-line; margin-bottom: 4px; }
.lc-list-img  { margin-top: 8px; }
.lc-list-img img { max-width: 240px; max-height: 160px; border-radius: 8px; object-fit: cover; }

/* =================================================================
   TYPE STATISTIQUES
   ================================================================= */

.lc-stats-container {
    overflow-x: auto;
    margin: 16px 0;
}
.lc-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.lc-stats-table th,
.lc-stats-table td {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    text-align: center;
}
.lc-stats-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}
.lc-stats-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: #111827;
}
.lc-stats-table tbody tr:hover { background: #f0f9ff; }


