/* ==========================================
   CDV Booking Calendar - Frontend Styles
   ========================================== */

/* Container principal */
.cdv-calendar-wrapper {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: relative;
}

/* Légende */
.cdv-legend {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.cdv-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
}

.cdv-legend-box {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.cdv-legend-available {
    background: white;
}

.cdv-legend-blocked {
    background: #ef4444;
}

.cdv-legend-today {
    background: #667eea;
}

/* Grille des mois */
.cdv-calendar-container {
    width: 100%;
    margin: 0 auto;
}

/* Mois individuel */
.cdv-month {
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    border: none;
    margin: 0 auto 25px auto;
    width: 100%;
}

/* En-tête du mois - MASQUÉ */
.cdv-month-header {
    display: none !important;
}

/* Jours de la semaine */
.cdv-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: transparent;
    border-bottom: none;
    gap: 3px;
    margin-bottom: 6px;
}

.cdv-weekday {
    padding: 6px 4px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Grille des jours */
.cdv-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    background: transparent;
    padding: 0;
}

/* Jour individuel */
.cdv-day {
    aspect-ratio: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.25s ease;
    min-height: 38px;
    border-radius: 6px;
    border: 2px solid transparent;
}

.cdv-day-number {
    font-size: 13px;
    font-weight: 600;
    color: #344256;
    z-index: 1;
}

/* Jour vide */
.cdv-day-empty {
    background: transparent;
    cursor: default;
}

/* Aujourd'hui */
.cdv-day-today {
    background: #667eea;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
}

.cdv-day-today .cdv-day-number {
    color: #ffffff;
    font-weight: 800;
}

/* Jour passé */
.cdv-day-past {
    opacity: 0.3;
    cursor: not-allowed;
}

.cdv-day-past .cdv-day-number {
    color: #9ca3af;
}

/* Jour bloqué (réservé) */
.cdv-day-blocked {
    background: #fee2e2;
    position: relative;
    cursor: not-allowed;
    border-color: #ef4444;
}

.cdv-day-blocked .cdv-day-number {
    color: #ef4444;
    font-weight: 700;
}

.cdv-day-blocked::after {
    display: none;
}

/* Hover sur jours disponibles */
.cdv-day:not(.cdv-day-blocked):not(.cdv-day-past):not(.cdv-day-empty):hover {
    background: #e0e7ff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    z-index: 10;
}

.cdv-day:not(.cdv-day-blocked):not(.cdv-day-past):not(.cdv-day-empty):hover .cdv-day-number {
    color: #667eea;
    font-weight: 700;
}

/* ========================================
   STYLES DE SÉLECTION
======================================== */

/* Jour sélectionné */
.cdv-day-selected {
    background: #e0e7ff !important;
    border: 2px solid #667eea !important;
}

/* Jour de début (arrivée) */
.cdv-day-start {
    background: #667eea !important;
}

.cdv-day-start .cdv-day-number {
    color: white !important;
    font-weight: 700;
}

/* Jour de fin (départ) */
.cdv-day-end {
    background: #667eea !important;
}

.cdv-day-end .cdv-day-number {
    color: white !important;
    font-weight: 700;
}

/* Jours entre les deux - BLEUTÉ */
.cdv-day-in-range {
    background: #dbeafe !important;
    border-color: #93c5fd !important;
}

/* Résumé de la sélection */
.cdv-selection-summary {
    background: #f8f9fa;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    animation: cdv-slideIn 0.3s ease;
    position: relative;
}

/* Bouton Réserver */
.cdv-btn-reserve {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cdv-btn-reserve:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.cdv-btn-reserve:active {
    transform: translateY(0);
}

.cdv-btn-reserve::before {
    content: '📅';
    font-size: 18px;
}

.cdv-summary-dates {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.cdv-summary-date {
    font-size: 13px;
    color: #344256;
}

.cdv-summary-date strong {
    color: #667eea;
    font-weight: 600;
    display: block;
    font-size: 11px;
    margin-bottom: 2px;
}

.cdv-summary-separator {
    color: #9ca3af;
    font-size: 16px;
}

/* Colonne de droite avec croix et badge */
.cdv-summary-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cdv-btn-reset {
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.2s;
}

.cdv-btn-reset:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: scale(1.05);
}

.cdv-summary-nights {
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 70px;
    text-align: center;
}

@keyframes cdv-slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   CONTRÔLES DE NAVIGATION
======================================== */

.cdv-calendar-controls {
    background: transparent;
    padding: 15px 0;
    border-radius: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: none;
    border-bottom: 2px solid #f0f0f0;
}

.cdv-nav-btn {
    background: #f8f9fa;
    border: 2px solid #e5e7eb;
    color: #667eea;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.cdv-nav-btn:hover:not(.cdv-nav-disabled) {
    background: #667eea;
    border-color: #667eea;
    color: white;
    transform: scale(1.05);
}

.cdv-nav-btn.cdv-nav-disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cdv-current-month-display {
    flex: 1;
    text-align: center;
}

.cdv-month-name {
    font-size: 18px;
    font-weight: 700;
    color: #344256;
    text-transform: capitalize;
}

/* ========================================
   ANIMATIONS & TRANSITIONS
======================================== */

.cdv-calendar-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}

.cdv-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: cdv-spin 0.8s linear infinite;
}

@keyframes cdv-spin {
    to { transform: rotate(360deg); }
}

.cdv-fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cdv-fade-in {
    opacity: 0;
    animation: cdv-fadeIn 0.3s ease forwards;
}

@keyframes cdv-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tooltip */
.cdv-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.cdv-tooltip-visible {
    opacity: 1;
}

.cdv-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.9);
}

/* Bouton export iCal */
.cdv-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    margin: 20px 0;
}

.cdv-export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
    color: white !important;
}

/* Messages d'erreur */
.cdv-error {
    padding: 12px 20px;
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
    border-radius: 4px;
    margin: 20px 0;
}

/* ========================================
   SIDEBAR (depuis CSS additionnel)
======================================== */

.sis-sidebar-calendar {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    margin: 0 auto 20px auto;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.sis-booking-form-wrap {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-top: 0;
}

.book-form-col {
    margin-bottom: 20px;
}

.book-form-col label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #344256;
    margin-bottom: 8px;
}

.book-form-col-input {
    position: relative;
}

.book-form-col-input .icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.book-form-col-input .icon svg {
    width: 20px;
    height: 20px;
}

.book-form-col-input input {
    width: 100%;
    padding: 14px 15px 14px 45px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #344256;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.book-form-col-input input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.book-form-col-input input::placeholder {
    color: #9ca3af;
}

.book-form-col.elementor-widget-button {
    margin-top: 25px;
}

.book-form-col .elementor-button {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 16px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.book-form-col .elementor-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.book-form-col .elementor-button:active {
    transform: translateY(0);
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 768px) {
    .sis-sidebar-calendar,
    .sis-booking-form-wrap {
        padding: 20px;
    }
    
    .cdv-calendar-controls {
        padding: 12px 0;
    }
    
    .cdv-nav-btn {
        width: 32px;
        height: 32px;
    }
    
    .cdv-month-name {
        font-size: 16px;
    }
    
    .cdv-weekday {
        font-size: 9px;
        padding: 5px 2px;
    }
    
    .cdv-day {
        min-height: 32px;
    }
    
    .cdv-day-number {
        font-size: 12px;
    }
    
    .cdv-legend {
        gap: 8px;
        padding: 10px;
    }
    
    .cdv-legend-item {
        font-size: 10px;
    }
    
    .cdv-legend-box {
        width: 10px;
        height: 10px;
    }
    
    .cdv-selection-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cdv-summary-dates {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .cdv-summary-separator {
        display: none;
    }
}

/* Animation de chargement */
@keyframes cdv-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.cdv-calendar-loading {
    animation: cdv-pulse 1.5s ease-in-out infinite;
}

/* Print styles */
@media print {
    .cdv-legend,
    .cdv-export-btn {
        display: none;
    }
    
    .cdv-month {
        page-break-inside: avoid;
    }
}