/* ========================================
   RDV Widget - Styles pour la prise de rendez-vous
   Inspiré du style agenda existant
   ======================================== */

/* Variables CSS pour la cohérence avec l'existant */
:root {
    --rdv-primary: #F28E00;
    --rdv-secondary: #727272;
    --rdv-background: #F3F3F3;
    --rdv-border: #EBEBEB;
    --rdv-text: #727272;
    --rdv-white: #FFFFFF;
    --rdv-disabled: #F5F5F5;
    --rdv-success: #79B455;
    --rdv-error: #E30000;
}

/* Container principal */
.rdv-widget {
    width: 100%;
    /* margin-top: 20px; */
}

.rdv-widget-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100%;
}

/* ========================================
   COLONNE GAUCHE - FAQ
   ======================================== */

.rdv-faq-column {
    background-color: var(--rdv-white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.rdv-faq-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--rdv-secondary);
    margin-bottom: 20px;
    font-family: 'Montserrat', sans-serif;
}

.rdv-faq-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rdv-faq-item {
    border: 1px solid var(--rdv-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rdv-faq-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rdv-faq-question {
    width: 100%;
    padding: 15px 20px;
    background-color: var(--rdv-white);
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--rdv-secondary);
    transition: all 0.3s ease;
}

.rdv-faq-question:hover {
    background-color: var(--rdv-background);
}

.rdv-faq-question:focus {
    outline: 2px solid var(--rdv-primary);
    outline-offset: 2px;
}

.rdv-faq-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--rdv-secondary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.3s ease;
}

.rdv-faq-item[data-faq-open="true"] .rdv-faq-icon {
    transform: rotate(180deg);
}

.rdv-faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: var(--rdv-background);
}

.rdv-faq-item[data-faq-open="true"] .rdv-faq-answer {
    max-height: 200px;
    padding: 15px 20px;
}

.rdv-faq-answer p {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--rdv-secondary);
}

/* ========================================
   COLONNE DROITE - CALENDRIER COMPACT
   ======================================== */

.rdv-calendar-column {
    background-color: var(--rdv-white);
    border-radius: 10px;
    /* padding: 25px; */
    padding: 25px 15px;
    /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
    height: fit-content;
}

.rdv-calendar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--rdv-secondary);
    margin-bottom: 20px;
    font-family: 'Montserrat', sans-serif;
}

.rdv-calendar-compact {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Header du calendrier */
.rdv-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 15px;
    background-color: var(--rdv-primary);
    border-radius: 10px;
    color: var(--rdv-white);
    margin: 0 10px;
}

.rdv-calendar-nav {
    background: none;
    border: none;
    color: var(--rdv-white);
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.rdv-calendar-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.rdv-calendar-nav:focus {
    outline: 2px solid var(--rdv-white);
    outline-offset: 2px;
}

.rdv-calendar-nav svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rdv-calendar-prev svg{
    transform: rotate(180deg);
}

.rdv-calendar-period {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
}

/* Affichage des 3 jours */
.rdv-calendar-days {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    /* margin-bottom: 15px; */
    margin: 0 10px;
}

/* Barre de scroll personnalisée pour les jours (si nécessaire) */
.rdv-calendar-days::-webkit-scrollbar {
    height: 4px;
    background: #F3F3F3;
}

.rdv-calendar-days::-webkit-scrollbar-thumb {
    border: none;
    background-color: #F28E00;
    border-radius: 2px;
}

.rdv-calendar-day {
    background-color: var(--rdv-background);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.rdv-calendar-day.selected {
    /* background-color: var(--rdv-primary); */
    /* color: var(--rdv-white); */
    border-color: var(--rdv-primary);
}

.rdv-calendar-day.disabled {
    background-color: var(--rdv-disabled);
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.rdv-day-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 0;
}

.rdv-day-date {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 700;
}

.rdv-day-month {
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    opacity: 0.8;
}

/* Créneaux horaires - Structure en colonnes pour desktop */
.rdv-calendar-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    margin-left: 4px;
    margin-left: 10px;
}

/* Barre de scroll personnalisée pour les créneaux */
.rdv-calendar-slots::-webkit-scrollbar {
    width: 4px;
    background: #F3F3F3;
}

.rdv-calendar-slots::-webkit-scrollbar-thumb {
    border: none;
    background-color: #F28E00;
    border-radius: 2px;
}

.rdv-calendar-slots {
    padding-right: 8px;
}

/* Colonnes individuelles de créneaux */
.rdv-day-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
}

.rdv-day-slots-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rdv-slot {
    background-color: #F8F9FA;
    border: 2px solid #E9ECEF;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rdv-slot-time {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    line-height: 1.2;
}

.rdv-slot-type {
    font-size: 13px;
    font-weight: 400;
    color: #6C757D;
    line-height: 1.2;
}

/* .rdv-slot:hover {
    background-color: var(--rdv-primary);
    border-color: var(--rdv-primary);
}

.rdv-slot:hover .rdv-slot-time,
.rdv-slot:hover .rdv-slot-type {
    color: var(--rdv-white);
}

.rdv-slot.selected {
    background-color: var(--rdv-primary);
    border-color: var(--rdv-primary);
}

.rdv-slot.selected .rdv-slot-time,
.rdv-slot.selected .rdv-slot-type {
    color: var(--rdv-white);
} */

.rdv-slot:hover {
    border-color: var(--rdv-primary);
}

.rdv-slot.selected {
    border-color: var(--rdv-primary);
}

.rdv-slot.disabled {
    background-color: #F8F9FA;
    border-color: #E9ECEF;
    cursor: not-allowed;
    opacity: 0.6;
}

.rdv-slot.disabled .rdv-slot-time {
    color: #ADB5BD;
    font-weight: 400;
}

.rdv-slot.disabled .rdv-slot-type {
    color: #CED4DA;
}

/* Section de confirmation */
.rdv-calendar-confirm {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background-color: white;
    border: 1px solid #E9ECEF;
    border-radius: 12px;
    /* padding: 16px 20px; */
    padding: 10px;
    margin: 0 10px;
    /* margin-top: 20px; */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
}

.rdv-selected-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.rdv-selected-message {
    font-style: italic;
    color: #999;
    font-size: 14px;
}

.rdv-selected-date {
    font-weight: 600;
    font-size: 16px;
    color: #495057;
    line-height: 1.2;
}

.rdv-selected-time {
    font-weight: 400;
    font-size: 14px;
    color: #6C757D;
    line-height: 1.2;
}

.rdv-confirm-btn {
    background-color: var(--rdv-primary);
    color: var(--rdv-white);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.rdv-confirm-btn:hover:not(:disabled) {
    background-color: #e67e00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 142, 0, 0.3);
}

.rdv-confirm-btn:disabled {
    background-color: #CED4DA;
    color: #6C757D;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

@media (max-width: 1200px) {
    .rdv-widget-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .rdv-faq-column,
    .rdv-calendar-column {
        padding: 20px;
    }
}

/* Sur desktop, masquer les flèches et rendre les boutons non sélectionnables */
@media (min-width: 769px) {
    .rdv-day-arrow {
        display: none;
    }

    .rdv-calendar-day {
        user-select: none;
        pointer-events: none;
        cursor: default;
    }
}

/* Responsivité tablette */
@media (min-width: 769px) and (max-width: 1024px) {
    .rdv-calendar-days {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .rdv-calendar-slots {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .rdv-day-slots-title {
        font-size: 11px;
        padding: 6px 10px;
    }

    .rdv-slot {
        padding: 10px 12px;
        font-size: 13px;
    }

    .rdv-slot-time {
        font-size: 13px;
    }

    .rdv-slot-type {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .rdv-calendar-days {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .rdv-calendar-day {
        padding: 8px;
        gap: 3px;
    }

    .rdv-day-name {
        font-size: 11px;
    }

    .rdv-day-date {
        font-size: 14px;
    }

    .rdv-day-month {
        font-size: 9px;
    }

    /* Sur mobile, masquer la section des créneaux desktop */
    .rdv-calendar-slots {
        display: none;
    }

    /* Sur mobile, les boutons de jour deviennent des déclencheurs d'accordéon */
    .rdv-calendar-day {
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;
        user-select: auto;
        pointer-events: auto;
    }

    .rdv-day-arrow {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
        width: 16px;
        height: 16px;
        opacity: 0.7;
    }

    .rdv-day-arrow svg {
        width: 100%;
        height: 100%;
        fill: none;
        stroke: var(--rdv-secondary);
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .rdv-calendar-day.expanded .rdv-day-arrow {
        transform: translateY(-50%) rotate(90deg);
    }

    /* Structure mobile : créneaux sous chaque jour */
    .rdv-day-slots-mobile {
        display: none;
        margin-top: 8px;
        padding: 0 8px;
    }

    .rdv-day-slots-mobile.expanded {
        display: block;
    }

    /* Correction pour éviter les marges doubles sur mobile */
    .rdv-day-slots-mobile .rdv-slot {
        margin-bottom: 6px;
        padding: 10px 12px;
    }

    .rdv-day-slots-mobile .rdv-slot:last-child {
        margin-bottom: 0;
    }

    /* S'assurer que les créneaux mobiles ont la bonne taille de police */
    .rdv-day-slots-mobile .rdv-slot-time {
        font-size: 13px;
        font-weight: 600;
        color: #495057;
        line-height: 1.2;
    }

    .rdv-day-slots-mobile .rdv-slot-type {
        font-size: 12px;
        font-weight: 400;
        color: #6C757D;
        line-height: 1.2;
    }

    .rdv-faq-title,
    .rdv-calendar-title {
        font-size: 18px;
    }

    .rdv-faq-question {
        padding: 12px 15px;
        font-size: 14px;
    }

    .rdv-calendar-header {
        padding: 12px;
    }

    .rdv-calendar-period {
        font-size: 14px;
    }

    .rdv-calendar-header, .rdv-calendar-days, .rdv-calendar-slots, .rdv-calendar-confirm {
        margin: 0;
    }

    .rdv-calendar-confirm{
        flex-direction: column;
        align-items: flex-start;
    }

    .rdv-selected-info{
        margin-bottom: 15px;
    }

    .rdv-confirm-btn{
        margin-left: auto;
    }
}

@media (max-width: 480px) {
    .rdv-calendar-slots {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .rdv-slot {
        padding: 8px;
        font-size: 13px;
    }

    .rdv-confirm-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

/* Focus visible pour tous les éléments interactifs */
.rdv-faq-question:focus-visible,
.rdv-calendar-nav:focus-visible,
.rdv-calendar-day:focus-visible,
.rdv-slot:focus-visible,
.rdv-confirm-btn:focus-visible {
    outline: 2px solid var(--rdv-primary);
    outline-offset: 2px;
}

/* Animation pour les transitions */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Contraste élevé pour les utilisateurs qui en ont besoin */
@media (prefers-contrast: high) {
    .rdv-faq-item,
    .rdv-calendar-day,
    .rdv-slot {
        border-width: 2px;
    }

    .rdv-faq-question:hover,
    .rdv-slot:hover {
        border-color: var(--rdv-primary);
    }
}
