/* ============================================
   CALENDRIER MULTI-MOIS v2.0.9
   Modal bas + Mobile ultra-optimisé
   Par Yvann Robinet - Webconscient.fr
   ============================================ */

.cmm-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
}

/* TOGGLE CALENDRIER/LISTE */
.cmm-view-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.cmm-toggle-btn {
    padding: 12px 30px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cmm-toggle-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.cmm-toggle-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.cmm-toggle-btn.active:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6a3f8f 100%);
    border-color: #5a67d8;
}

.cmm-icon {
    font-size: 18px;
}

/* BARRE FILTRE CATÉGORIE */
.cmm-search-filter-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
}

.cmm-category-filter {
    flex: 0 0 auto;
    max-width: 400px;
}

.cmm-category-select {
    padding: 12px 16px;
    border: 2px solid #ccc;
    border-radius: 20px;
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    min-width: 250px;
}

.cmm-category-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* NAVIGATION */
.cmm-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.cmm-nav-btn {
    border-radius: 50px;
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.cmm-nav-btn:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

/* CALENDRIER COMPACT */
.cmm-calendar-wrapper {
    display: block;
    max-width: 100%;
    margin: 0 auto;
}

.cmm-calendar-month {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* EN-TÊTE MOIS - TEXTE BLANC SUR FOND VERT */
.cmm-month-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    text-align: center;
}

.cmm-month-header h3 {
    margin: 0;
    color: #FFFFFF !important;
    font-size: 16px;
    font-weight: 600;
    text-transform: capitalize;
}

/* JOURS DE LA SEMAINE - TEXTE BLANC */
.cmm-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #764ba2;
    padding: 10px 0;
}

.cmm-weekday {
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    color: #FFFFFF !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* JOURS */
.cmm-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    padding: 1px;
}

.cmm-day {
    background: white;
    min-height: 120px;
    max-height: 120px;
    padding: 6px;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cmm-day:hover {
    background: #f9fafb;
}

.cmm-day-empty {
    background: #f9fafb;
}

.cmm-day-number {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.cmm-day-events {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    padding-right: 2px;
}

.cmm-day-events::-webkit-scrollbar {
    width: 4px;
}

.cmm-day-events::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.cmm-day-events::-webkit-scrollbar-track {
    background: transparent;
}

.cmm-today {
    background: #eff6ff !important;
}

.cmm-today .cmm-day-number {
    background: #667eea;
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 4px;
}

/* ÉVÉNEMENTS CLIQUABLES */
.cmm-has-events {
    background: #fef3c7;
}

.cmm-event {
    display: block;
    background: #667eea;
    color: white;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmm-event:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    color: white;
}

.cmm-event-time {
    font-weight: 600;
    margin-right: 4px;
}

.cmm-event-title {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MODAL ÉVÉNEMENT */
.cmm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    animation: cmm-fadeIn 0.3s ease;
}

.cmm-modal.active {
    display: block;
}

@keyframes cmm-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cmm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.cmm-modal-content {
    position: relative;
    max-width: 650px;
    max-height: 80vh;
    margin: 30vh auto 5vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    animation: cmm-slideUp 0.4s ease;
}

@keyframes cmm-slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cmm-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.cmm-modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.cmm-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.cmm-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: cmm-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes cmm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cmm-modal-body {
    padding: 20px 25px 25px 25px;
}

.cmm-modal-title {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 15px 0;
    line-height: 1.3;
    padding-right: 40px;
}

.cmm-modal-meta {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.cmm-modal-meta-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.6;
}

.cmm-modal-meta-item:last-child {
    margin-bottom: 0;
}

.cmm-modal-icon {
    font-size: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

.cmm-modal-category {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.cmm-modal-excerpt {
    font-size: 15px;
    line-height: 1.7;
    color: #333;
    margin-bottom: 25px;
}

.cmm-modal-excerpt p {
    margin: 0;
}

.cmm-modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 5px;
    justify-content: center;
}

.cmm-modal-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.cmm-modal-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.cmm-modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 99, 70, 0.4);
    color: white;
}

.cmm-modal-btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.cmm-modal-btn-secondary:hover {
    border-color: #999;
    color: #333;
}

/* RESPONSIVE MODAL */
@media (max-width: 768px) {
    .cmm-modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    
    .cmm-modal-body {
        padding: 20px;
    }
    
    .cmm-modal-title {
        font-size: 24px;
        padding-right: 40px;
    }
    
    .cmm-modal-actions {
        flex-direction: column;
    }
    
    .cmm-modal-btn {
        width: 100%;
    }
}

/* VUE LISTE */
.cmm-list-wrapper {
    background: white;
    border-radius: 20px;
    padding: 20px;
}

.cmm-list-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.cmm-list-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cmm-list-item {
    display: grid;
    grid-template-columns: auto 1fr 650px;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 16px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
    align-items: start;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cmm-list-item:hover {
    background: #f0f1f3;
    transform: translateX(5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.cmm-list-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 20px;
    min-width: 80px;
    text-align: center;
}

.cmm-list-day {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.cmm-list-month {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 5px;
}

.cmm-list-year {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.cmm-list-details {
    flex: 1;
}

.cmm-list-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
}

.cmm-list-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
}

.cmm-list-title a:hover {
    color: #667eea;
    text-decoration: underline;
}

.cmm-list-time,
.cmm-list-location {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.cmm-list-categories {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.cmm-list-category {
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
    display: inline-block;
}

.cmm-list-excerpt {
    margin-top: 0;
    padding-left: 20px;
    border-left: 2px solid #e0e0e0;
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.cmm-list-action {
    display: flex;
    align-items: center;
}

.cmm-list-btn {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cmm-list-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 99, 70, 0.3);
    color: white;
}

.cmm-no-events {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .cmm-container {
        padding: 10px;
    }
    
    /* Masquer les éléments inutiles sur mobile (vue liste uniquement) */
    .cmm-toggle-btn[data-view="calendar"] {
        display: none;
    }
    
    .cmm-toggle-btn[data-view="list"] {
        display: none;
    }
    
    .cmm-view-toggle {
        display: none; /* Masque toute la barre de toggle */
    }
    
    .cmm-navigation {
        display: none; /* Masque les boutons précédent/suivant */
    }
    
    .cmm-search-filter-bar {
        padding: 15px;
        margin-bottom: 15px;
        text-align: center;
    }
    
    .cmm-category-filter {
        width: 100%;
    }
    
    .cmm-category-select {
        max-width: 100%;
        font-size: 14px;
        width: 100%;
    }
    
    .cmm-calendar-wrapper {
        max-width: 100%;
    }
    
    .cmm-list-item {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .cmm-list-details {
        text-align: center;
    }
    
    .cmm-list-title {
        text-align: center;
    }
    
    .cmm-list-time,
    .cmm-list-location {
        text-align: center;
    }
    
    .cmm-list-categories {
        justify-content: center;
    }
    
    .cmm-list-excerpt {
        max-width: 100%;
        padding-left: 0;
        border-left: none;
        border-top: 2px solid #e0e0e0;
        padding-top: 10px;
        margin-top: 10px;
        text-align: left;
    }
    
    /* Date compacte sur une ligne pour mobile */
    .cmm-list-date {
        min-width: 100%;
        flex-direction: row;
        gap: 10px;
        padding: 12px 20px;
        justify-content: center;
    }
    
    .cmm-list-day {
        font-size: 24px;
        margin: 0;
    }
    
    .cmm-list-month {
        font-size: 16px;
        margin: 0;
        text-transform: capitalize;
    }
    
    .cmm-list-year {
        font-size: 16px;
        opacity: 0.9;
        margin: 0;
    }
    
    .cmm-list-action {
        justify-content: center;
    }
    
    .cmm-list-btn {
        width: 100%;
        text-align: center;
    }
    
    .cmm-modal-content {
        margin: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .cmm-modal-body {
        padding: 15px;
        flex: 1;
        overflow-y: auto;
    }
    
    .cmm-modal-title {
        font-size: 22px;
        padding-right: 40px;
    }
    
    .cmm-modal-meta {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .cmm-modal-excerpt {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .cmm-modal-actions {
        flex-direction: column;
    }
    
    .cmm-modal-btn {
        width: 100%;
    }
}