/* RDV Dynamic - Frontend Styles */

/* intlTelInput customization */
.iti {
    width: 100%;
}

.iti__flag-container {
    z-index: 2;
}

.rdv-question-input .iti__tel-input {
    width: 100%;
    padding: 15px 15px 15px 60px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
}

/* Bouton */
.rdv-button,
.rdv-button-wpbakery {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: white;
    border: 2px solid #0073aa;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.rdv-success-message h2 {
    width: 100%;
    max-width: 100%;
}

.rdv-button:hover,
.rdv-button-wpbakery:hover {
    background: #005a87;
    border-color: #005a87;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

/* Popup */
.rdv-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rdv-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.rdv-popup-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: popupSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.rdv-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    padding:0;
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rdv-popup-close:hover {
    background: rgba(0,0,0,0.8);
    transform: rotate(90deg);
}

.rdv-popup-content {
    padding: 40px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Étapes */
.rdv-step {
    display: none;
}

.rdv-step.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rdv-step-header {
    text-align: center;
    margin-bottom: 40px;
}

.rdv-step-header h2 {
    font-size: 32px;
    margin: 0 0 10px 0;
    color: #0073aa;
}

.rdv-step-header p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Calendrier */
.rdv-calendar-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Liste des jours */
.rdv-days-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rdv-day-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    user-select: none;
}

.rdv-day-item:hover {
    border-color: #0073aa;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.1);
}

.rdv-day-item.selected {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    border-color: #0073aa;
    color: white;
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.3);
    transform: translateX(4px);
}

.rdv-day-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0px;
    background: white;
}

.rdv-day-label {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.rdv-day-date {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 500;
}

.rdv-day-item.selected .rdv-day-label,
.rdv-day-item.selected .rdv-day-date {
    color: white;
}

/* Ancien datepicker input (conservé pour compatibilité) */
.rdv-calendar-picker input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
    display: none; /* Masqué par défaut */
}

.rdv-calendar-picker input:focus {
    outline: none;
    border-color: #0073aa;
}

.rdv-slots-container {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.rdv-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.rdv-slots-header h3 {
    margin: 0;
    font-size: 18px;
}

.rdv-selected-date {
    color: #0073aa;
    font-weight: 600;
}

.rdv-slots-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.rdv-slot {
    padding: 12px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    pointer-events: auto;
    user-select: none;
}

.rdv-slot:hover {
    border-color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.2);
}

.rdv-slot.selected {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.rdv-no-slots {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

/* Actions */
.rdv-step-actions {
    text-align: center;
}

.rdv-btn {
    padding: 15px 40px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.rdv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rdv-btn-primary {
    background: #0073aa;
    color: white;
}

.rdv-btn-primary:not(:disabled):hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.rdv-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.rdv-btn-secondary:hover {
    background: #ddd;
}

/* Formulaire style Typeform */
.rdv-form-progress {
    margin-bottom: 30px;
}

.rdv-progress-text {
    text-align: center;
    color: #666;
    font-size: 14px;
}

.rdv-form-container {
    min-height: 300px;
    position: relative;
}

.rdv-form-question {
    display: none;
    animation: slideInRight 0.5s;
}

.rdv-form-question.active {
    display: block;
}

/* Mode single-page : tous les champs visibles */
.rdv-form-question.active.show-all {
    display: block;
    animation: none;
    margin-bottom: 25px;
}

.rdv-form-question.prev {
    animation: slideInLeft 0.5s;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rdv-question-label {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #0073aa;
}

.rdv-question-required {
    color: #d63638;
}

.rdv-question-input input,
.rdv-question-input textarea,
.rdv-question-input select {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.rdv-question-input input:focus,
.rdv-question-input textarea:focus,
.rdv-question-input select:focus {
    outline: none;
    border-color: #0073aa;
}

.rdv-question-input textarea {
    resize: vertical;
    min-height: 120px;
}

.rdv-field-error {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background: #ffebee;
    border-left: 3px solid #d32f2f;
    border-radius: 4px;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.rdv-radio-options,
.rdv-checkbox-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rdv-radio-option,
.rdv-checkbox-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.rdv-radio-option:hover,
.rdv-checkbox-option:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.rdv-radio-option input,
.rdv-checkbox-option input {
    margin-right: 10px;
    width: auto;
}

.rdv-form-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 10px;
}

.rdv-form-navigation .rdv-btn {
    flex: 1;
}

/* Succès */
.rdv-success-container {
    text-align: center;
    padding: 40px 0;
}

.rdv-success-icon {
    font-size: 80px;
    color: #46b450;
    margin-bottom: 20px;
}

.rdv-success-icon .dashicons {
    width: 80px;
    height: 80px;
    font-size: 80px;
}

.rdv-success-message h2 {
    color: #46b450;
    font-size: 32px;
    margin-bottom: 15px;
}

.rdv-success-message p {
    font-size: 18px;
    color: #666;
}

/* Erreur */
.rdv-error-container {
    text-align: center;
    padding: 40px 0;
}

.rdv-error-icon {
    font-size: 80px;
    color: #d63638;
    margin-bottom: 20px;
}

.rdv-error-icon .dashicons {
    width: 80px;
    height: 80px;
    font-size: 80px;
}

.rdv-error-message h2 {
    color: #d63638;
    font-size: 32px;
    margin-bottom: 15px;
}

.rdv-error-message p {
    font-size: 18px;
    color: #666;
}

/* Loading */
.rdv-loading {
    text-align: center;
    padding: 60px 0;
}

.rdv-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .rdv-popup-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .rdv-popup-content {
        padding: 20px;
    }
    
    .rdv-calendar-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .rdv-days-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* Mini calendrier responsive */
    .rdv-mini-calendar {
        display: block !important;
    }
    
    .rdv-calendar-grid {
        gap: 4px;
    }
    
    .rdv-calendar-day {
        font-size: 12px;
    }
    
    .rdv-calendar-header {
        padding: 10px;
    }
    
    .rdv-calendar-title {
        font-size: 16px;
    }
    
    .rdv-calendar-prev,
    .rdv-calendar-next {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .rdv-day-item {
        flex-direction: column;
        text-align: center;
        padding: 12px;
        gap: 4px;
    }
    
    .rdv-day-label {
        font-size: 16px;
    }
    
    .rdv-day-date {
        font-size: 12px;
    }
    
    .rdv-step-header h2 {
        font-size: 24px;
    }
    
    .rdv-step-header p {
        font-size: 16px;
    }
    
    .rdv-slots-list {
        grid-template-columns: 1fr;
    }
    
    .rdv-question-label {
        font-size: 20px;
    }
    
    .rdv-btn {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    .rdv-form-navigation {
        flex-direction: column;
    }
}

/* Animations supplémentaires */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.rdv-slot.selected {
    animation: pulse 0.5s ease-in-out;
}

/* Scrollbar personnalisée */
.rdv-slots-container::-webkit-scrollbar,
.rdv-popup-content::-webkit-scrollbar {
    width: 8px;
}

.rdv-slots-container::-webkit-scrollbar-track,
.rdv-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.rdv-slots-container::-webkit-scrollbar-thumb,
.rdv-popup-content::-webkit-scrollbar-thumb {
    background: #0073aa;
    border-radius: 4px;
}

.rdv-slots-container::-webkit-scrollbar-thumb:hover,
.rdv-popup-content::-webkit-scrollbar-thumb:hover {
    background: #005a87;
}

/* Flatpickr z-index fix */
.flatpickr-calendar {
    z-index: 9999999 !important;
}

/* Mini calendrier */
.rdv-mini-calendar {
    display: block !important;
}

.rdv-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    border-radius: 12px;
    color: white;
}

.rdv-calendar-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.rdv-calendar-prev,
.rdv-calendar-next {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    position: relative;
    z-index: 10;
}

.rdv-calendar-prev:hover,
.rdv-calendar-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.rdv-calendar-days-names {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.rdv-calendar-day-name {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    padding: 8px 0;
    text-transform: uppercase;
}

.rdv-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.rdv-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: default;
    background: #f5f5f5;
    color: #999;
}

.rdv-calendar-day-empty {
    background: transparent;
}

.rdv-calendar-day-past {
    background: #fafafa;
    color: #ccc;
    text-decoration: line-through;
}

.rdv-calendar-day-available {
    background: white;
    border: 2px solid #e0e0e0;
    color: #333;
    cursor: pointer;
}

.rdv-calendar-day-available:hover {
    border-color: #0073aa;
    background: #f0f8ff;
    transform: scale(1.05);
}

.rdv-calendar-day-today {
    border-color: #ff9800 !important;
    font-weight: 700;
}

.rdv-calendar-day.selected {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    border-color: #0073aa !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

