/**
 * FBEA Booking Popup Modal
 * Version: 1.0
 * Modal moderne pour la prise de rendez-vous via le chat
 */

/* === Overlay (fond sombre semi-transparent) === */
.fbea-booking-popup-overlay {
    display: none; /* Caché par défaut */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999; /* Au-dessus de tout, y compris le chat */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.fbea-booking-popup-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

/* === Modal Container === */
.fbea-booking-popup-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.4s ease-out;
    padding: 0;
}

/* === Header === */
.fbea-booking-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 24px 30px;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.fbea-booking-popup-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
}

.fbea-booking-popup-header p {
    margin: 8px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
    color: #ffffff;
}

/* === Close Button === */
.fbea-booking-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fbea-booking-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* === Body === */
.fbea-booking-popup-body {
    padding: 30px;
}

/* === Form Styles === */
.fbea-booking-popup-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fbea-booking-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fbea-booking-form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fbea-booking-form-group label .required {
    color: #e74c3c;
}

.fbea-booking-form-group input,
.fbea-booking-form-group select,
.fbea-booking-form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.fbea-booking-form-group input:focus,
.fbea-booking-form-group select:focus,
.fbea-booking-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.fbea-booking-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* === Date & Time Grid === */
.fbea-booking-datetime-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* === Slots Display === */
.fbea-booking-slots-container {
    margin-top: 10px;
}

.fbea-booking-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.fbea-booking-slot-btn {
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    text-align: center;
}

.fbea-booking-slot-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
    color: #667eea;
}

.fbea-booking-slot-btn.selected {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.fbea-booking-slot-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.fbea-booking-slot-btn.disabled:hover {
    border-color: #e0e0e0;
    background: #ffffff;
    color: #333333;
}

/* === Loading State === */
.fbea-booking-slots-loading {
    text-align: center;
    padding: 20px;
    color: #999999;
    font-size: 14px;
}

.fbea-booking-slots-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

/* === Error/Success Messages === */
.fbea-booking-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fbea-booking-message.error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.fbea-booking-message.success {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
}

.fbea-booking-message.info {
    background: #eef;
    border: 1px solid #ccf;
    color: #33c;
}

/* === Submit Button === */
.fbea-booking-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin-top: 10px;
}

.fbea-booking-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.fbea-booking-submit-btn:active {
    transform: translateY(0);
}

.fbea-booking-submit-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.fbea-booking-submit-btn.loading {
    position: relative;
    color: transparent;
}

.fbea-booking-submit-btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* === Animations === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* === Responsive Design === */
@media (max-width: 768px) {
    .fbea-booking-popup-modal {
        width: 95%;
        max-height: 95vh;
    }

    .fbea-booking-popup-header {
        padding: 20px;
    }

    .fbea-booking-popup-header h2 {
        font-size: 20px;
    }

    .fbea-booking-popup-body {
        padding: 20px;
    }

    .fbea-booking-datetime-grid {
        grid-template-columns: 1fr;
    }

    .fbea-booking-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .fbea-booking-popup-header h2 {
        font-size: 18px;
    }

    .fbea-booking-popup-body {
        padding: 16px;
    }

    .fbea-booking-form-group input,
    .fbea-booking-form-group select,
    .fbea-booking-form-group textarea {
        padding: 10px 14px;
        font-size: 14px;
    }

    .fbea-booking-submit-btn {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* === Scrollbar Styling === */
.fbea-booking-popup-modal::-webkit-scrollbar {
    width: 8px;
}

.fbea-booking-popup-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.fbea-booking-popup-modal::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.fbea-booking-popup-modal::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}
