/* Améliorations pour l'intégration MyHair */

/* Modal wizard — s'adapte au contenu, scroll seulement si nécessaire */
#bookingModal {
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#bookingModal .modal-content {
    max-width: 95%;
    width: 700px;
    padding: 0;
    max-height: 90vh;
    height: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Header local fixe de la modale (indépendant de l'iframe distant) */
.booking-local-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    background: #ffffff;
    border-bottom: 1px solid #eee4c8;
    flex-shrink: 0;
}

.booking-local-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.booking-local-brand img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    border-radius: 8px;
    background: #fffdf6;
    border: 1px solid #eee4c8;
    flex-shrink: 0;
}

.booking-local-title {
    min-width: 0;
}

.booking-local-title h2 {
    margin: 0;
    color: #2d2d2d;
    font-family: 'Playfair Display', serif;
    font-size: 1.45rem;
    line-height: 1.2;
}

.booking-local-title p {
    margin: 4px 0 0;
    color: #6e6e6e;
    font-size: 0.9rem;
    line-height: 1.2;
}

.booking-local-close {
    width: 38px;
    height: 38px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #ffffff;
    color: #404040;
    font-size: 28px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.booking-local-close:hover {
    background: #f5f5f5;
    transform: rotate(90deg);
}

#bookingWizardRoot {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Wizard content container */
.booking-wizard {
    display: flex;
    flex-direction: column;
    background: white;
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.booking-step-fixed {
    flex-shrink: 0;
    padding: 20px 20px 0;
}

.booking-step-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 0 20px 20px;
}

/* Loading overlay */
.booking-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.booking-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.booking-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.booking-loading-text {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Footer de la modal */
.booking-modal-footer {
    background: var(--bg-light);
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
}

.booking-help-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.booking-help-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.booking-help-item i {
    color: var(--primary-color);
    font-size: 20px;
}

.booking-help-item span {
    color: var(--text-light);
    font-size: 14px;
}

.booking-help-item strong {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Boutons d'action rapide */
.quick-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 5;
}

.quick-action-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.quick-action-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    #bookingModal .modal-content {
        width: 100%;
        height: auto;
        max-height: 100vh;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .booking-local-header {
        padding: 12px 14px;
    }

    .booking-local-brand {
        gap: 10px;
    }

    .booking-local-brand img {
        width: 42px;
        height: 42px;
    }

    .booking-local-title h2 {
        font-size: 1.1rem;
    }

    .booking-local-title p {
        font-size: 0.78rem;
    }
    
    .booking-help-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .quick-actions {
        position: static;
        margin-top: 15px;
        justify-content: center;
    }
}

/* Wizard stepper */
.booking-stepper {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
    flex-shrink: 0;
}

.booking-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #999;
}

.booking-step.active {
    color: var(--primary-color, #333);
    font-weight: 600;
}

.booking-step.completed {
    color: #4caf50;
    cursor: pointer;
}

.booking-step.completed:hover {
    text-decoration: underline;
    opacity: 0.85;
}

.booking-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
}

.booking-error {
    color: #c62828;
    background: #ffebee;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 16px 24px;
}

/* Step title */
.booking-step-title {
    margin: 0 0 16px;
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: #2d2d2d;
}

.booking-step-info {
    color: #6e6e6e;
    font-size: 0.9rem;
    margin: 0 0 16px;
}

/* Stepper numbers */
.booking-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.booking-step.active .booking-step-num {
    background: var(--primary-color, #c89a2b);
    color: white;
}

.booking-step.completed .booking-step-num {
    background: #4caf50;
    color: white;
}

/* Booking recap */
.booking-recap {
    background: #faf6eb;
    border: 1px solid #eee4c8;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.booking-recap-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #5a4b1f;
}

.booking-recap-icon {
    font-size: 15px;
}

/* Target group tabs */
.booking-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.booking-tab {
    padding: 8px 18px;
    border: 2px solid #eee4c8;
    border-radius: 999px;
    background: #fffdf6;
    color: #5a4b1f;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.booking-tab:hover {
    border-color: var(--primary-color, #c89a2b);
    background: #fff8e1;
}

.booking-tab.active {
    background: var(--primary-color, #c89a2b);
    border-color: var(--primary-color, #c89a2b);
    color: white;
}

/* Options grid (target groups) */
.booking-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Options list (services) */
.booking-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.booking-category-title {
    margin: 12px 0 4px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8a7340;
}

.booking-category-title:first-child {
    margin-top: 0;
}

/* Option buttons */
.booking-option-btn {
    padding: 14px 20px;
    border: 2px solid #eee4c8;
    border-radius: 8px;
    background: #fffdf6;
    color: #2d2d2d;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.booking-option-btn:hover {
    border-color: var(--primary-color, #c89a2b);
    background: #fff8e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(200, 154, 43, 0.15);
}

.booking-service-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.booking-service-price {
    color: var(--primary-color, #c89a2b);
    font-weight: 700;
    white-space: nowrap;
    margin-left: 16px;
}

/* ── Google Calendar-style week view ── */

/* Week navigation */
.bcal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 6px 0;
}

.bcal-nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    color: #444;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.bcal-nav-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.bcal-nav-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* Loading inside calendar */
.bcal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
}

/* Calendar grid */
.bcal-grid {
    display: grid;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.bcal-corner {
    background: #fafafa;
    border-bottom: 2px solid #e0e0e0;
    border-right: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Day header */
.bcal-day-header {
    text-align: center;
    padding: 8px 2px;
    background: #fafafa;
    border-bottom: 2px solid #e0e0e0;
    border-right: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 1;
}

.bcal-day-header:last-of-type {
    border-right: none;
}

.bcal-day-header.bcal-closed {
    opacity: 0.4;
}

.bcal-day-header.bcal-today .bcal-day-num {
    background: var(--primary-color, #c89a2b);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bcal-day-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.04em;
}

.bcal-day-num {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-top: 2px;
}

/* Time column */
.bcal-time {
    font-size: 11px;
    color: #888;
    text-align: right;
    padding: 4px 6px 4px 4px;
    border-right: 1px solid #e8e8e8;
    border-bottom: 1px solid #f0f0f0;
    background: #fdfdfd;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 38px;
}

/* Slot cells */
.bcal-cell {
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    padding: 2px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bcal-cell:nth-child(7n+1) {
    border-right: 1px solid #e8e8e8;
}

.bcal-cell.bcal-closed,
.bcal-cell.bcal-past {
    background: repeating-linear-gradient(
        -45deg,
        transparent, transparent 4px,
        #f3f3f3 4px, #f3f3f3 8px
    );
}

.bcal-cell.bcal-unavailable {
    background: #f5f5f5;
    position: relative;
}

.bcal-cell.bcal-unavailable::after {
    content: '\2013';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #ccc;
    font-size: 14px;
}

/* Slot button */
.bcal-slot {
    width: 100%;
    padding: 6px 2px;
    border: none;
    border-radius: 4px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bcal-slot:hover {
    background: #c8e6c9;
    transform: scale(1.05);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.bcal-slot.bcal-selected {
    background: var(--primary-color, #c89a2b);
    color: white;
}

/* Mobile: scroll horizontally */
@media (max-width: 768px) {
    .bcal-grid {
        font-size: 11px;
    }
    .bcal-slot {
        font-size: 10px;
        padding: 4px 1px;
    }
    .bcal-day-num {
        font-size: 14px;
    }
}

/* Employee manual pick after auto-assign failure */
.bcal-employee-pick {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

/* Navigation buttons */
.booking-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.booking-btn-primary {
    background: var(--primary-color, #c89a2b);
    color: white;
    width: 100%;
    margin-top: 16px;
}

.booking-btn-primary:hover:not(:disabled) {
    background: #b8892a;
}

.booking-btn-back {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
}

.booking-btn-back:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* Customer form */
.booking-customer-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 8px;
}

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

.booking-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.booking-input {
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.booking-input:focus {
    border-color: var(--primary-color, #c89a2b);
    box-shadow: 0 0 0 3px rgba(200, 154, 43, 0.1);
}

.booking-field-error {
    color: #c62828;
    font-size: 12px;
    min-height: 0;
}

.booking-field-error:empty {
    display: none;
}

/* Success screen */
.booking-success {
    text-align: center;
    padding: 20px 0;
}

.booking-success-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #4caf50;
    color: white;
    font-size: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.booking-success-detail {
    color: #555;
    font-size: 14px;
    margin: 8px 0;
}

/* Animation d'entrée */
@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#bookingModal.show .modal-content {
    animation: slideUp 0.4s ease;
}

/* Indicateur de sécurité */
.security-badge {
    position: absolute;
    bottom: 20px;
    left: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 5;
}

.security-badge i {
    color: var(--success);
    font-size: 18px;
}

.security-badge span {
    color: var(--text-light);
    font-size: 12px;
    font-weight: 500;
}
