/* Two Hour Agenda v3 - Version sécurisée et jolie */

.tha-v3-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* ALIGNEMENT HORIZONTAL */
.tha-v3-grid {
    display: flex;
    gap: 2.5rem;
    width: 100%;
    align-items: flex-start;
    margin: 1rem 0;
}

.tha-v3-calendar,
.tha-v3-slots-panel,
.tha-v3-form-container {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

/* CALENDRIER AMÉLIORÉ */
.tha-v3-calendar {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    color: #ffffff;
    border: 1px solid #444;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tha-v3-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tha-v3-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    flex-grow: 1;
    text-align: center;
}

.tha-v3-nav {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tha-v3-nav:hover {
    background: #005177;
    transform: translateY(-1px);
}

/* GRILLE DES JOURS */
.tha-v3-grid-7 {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-top: 1rem;
}

.tha-v3-weekday {
    background: #333;
    color: #ffffff;
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 4px;
}

.tha-v3-day {
    background: #000000;
    color: #ffffff;
    border: 1px solid #444;
    padding: 0.8rem 0.3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.tha-v3-day:hover {
    background: #333;
    border-color: #0073aa;
    transform: translateY(-1px);
}

/* DATE SÉLECTIONNÉE EN JAUNE */
.tha-v3-day.selected {
    background: #ffd700 !important;
    color: #000000 !important;
    border-color: #ffcc00 !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.tha-v3-day.selected:hover {
    background: #ffdd33 !important;
}

/* ÉTAT DES JOURS AVEC RÉSERVATIONS */
.tha-v3-day.has-bookings {
    background: #006400;
    border-color: #228b22;
}

.tha-v3-day.fully-booked {
    background: #8b0000;
    border-color: #ff0000;
    opacity: 0.8;
}

.tha-v3-day.other-month {
    opacity: 0.3;
    cursor: default;
}

/* PANELS CRÉNEAUX ET FORMULAIRE AMÉLIORÉS */
.tha-v3-slots-panel,
.tha-v3-form-container {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border: 2px solid #87ceeb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(135, 206, 235, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tha-v3-slots-panel:hover,
.tha-v3-form-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(135, 206, 235, 0.3);
}

/* CORRECTION DES ENTÊTES - HAUTEUR UNIFORME */
.tha-v3-slots-panel h4,
.tha-v3-form-container h4 {
    min-height: 1.6rem;        /* réduit par rapport à 2.4rem */
    display: flex;
    align-items: center;
    margin: 0 0 0.5rem 0;      /* espace bas réduit */
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c5aa0;
    border-bottom: 2px solid #87ceeb;
    padding-bottom: 0.2rem;    /* réduit encore l’espace */
    line-height: 1.2;
}

/* STYLES POUR LES CRÉNEAUX */
.tha-v3-slots-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.tha-v3-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: #ffffff;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tha-v3-slot:hover {
    border-color: #0073aa;
}

/* CRÉNEAU SÉLECTIONNÉ EN JAUNE */
.tha-v3-slot.selected {
    background: #ffd700 !important;
    border-color: #ffcc00 !important;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    transform: translateY(-1px);
}

.tha-v3-slot-label {
    font-weight: 600;
    color: #2c5aa0;
    font-size: 0.95rem;
}

.tha-v3-slot.selected .tha-v3-slot-label {
    color: #000000 !important;
    font-weight: 700;
}

.tha-v3-slot-btn {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tha-v3-slot-btn:hover {
    background: #005177;
    transform: translateY(-1px);
}

.tha-v3-slot.selected .tha-v3-slot-btn {
    background: #000000 !important;
    color: #ffd700 !important;
    font-weight: 700;
}

.tha-v3-slot-status {
    color: #888;
    font-style: italic;
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border-radius: 6px;
}

.tha-v3-slot.booked {
    background: #f8f8f8;
    border-color: #ccc;
    opacity: 0.7;
}

/* FORMULAIRE AMÉLIORÉ */
.tha-v3-form input[type="text"],
.tha-v3-form input[type="email"],
.tha-v3-form input[type="tel"] {
    border: 2px solid #b6d7ff;
    border-radius: 8px;
    height: 2.8rem;
    padding: 0.8rem;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #ffffff;
    margin-bottom: 0.8rem;
}

.tha-v3-form input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    transform: translateY(-1px);
}

.tha-v3-form label {
    font-weight: 600;
    color: #2c5aa0;
    margin-bottom: 0.3rem;
    display: block;
}

.tha-v3-btn {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.tha-v3-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

/* MESSAGES */
#tha-v3-form-msg {
    display: block;
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

#tha-v3-form-msg.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#tha-v3-form-msg.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ÉTATS DE CHARGEMENT */
.tha-v3-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.tha-v3-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* RESPONSIVE */
@media (max-width: 768px) {
    .tha-v3-grid {
        flex-direction: column;
        gap: 1rem;
    }
    
    .tha-v3-calendar,
    .tha-v3-slots-panel,
    .tha-v3-form-container {
        min-width: auto;
        max-width: none;
    }
    
    .tha-v3-slot {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}