/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Dynamic viewport height: adapts to Chrome/Safari mobile toolbars */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 85%;
    max-width: 840px; /* Slightly wider for better video presentation */
    max-height: 85vh;
    padding: 0;
    /* Removed fixed background: black to avoid bars if aspect ratio doesn't match and to let glass-panel shine */
    border-radius: 32px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Video specific modal overrides to remove 'borders' */
#videoModal .modal-content {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
    width: auto;
    max-width: 90vw;
}

#videoModal .modal-content::before,
#videoModal .modal-content::after {
    display: none !important;
}

#videoModal video {
    border-radius: 24px;
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2E8B57;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: black;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #444;
    transform: scale(1.1);
}

.video-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent; /* No more black bars from here */
}

.video-container video {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .modal-content {
        width: 96%; /* Slightly more screen usage on mobile */
        margin: 0 auto;
        max-height: 85vh;
        border-radius: 24px;
        background: transparent; /* Remove black background to avoid 'borders' */
    }

    .modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        z-index: 20;
    }

    .video-container {
        width: 100%;
        height: auto;
    }

    .video-container video {
        width: 100%;
        max-width: 100%;
        height: auto;
        display: block;
        max-height: 80vh;
        object-fit: contain;
    }
}

/* -----------------------------
   Booking Modal Specific Styles
   ----------------------------- */
.booking-modal-content {
    background: rgba(247, 245, 240, 0.9); /* Было: rgba(255, 255, 255, 0.85) */
    display: block;
    overflow-y: auto;
    padding: 0;
}

@media (max-width: 768px) {
    .booking-modal-content {
        background: rgba(247, 245, 240, 0.9); /* Было: rgba(255, 255, 255, 0.85) */
        /* maintain glass look */
        max-height: 90vh;
        max-height: 88dvh; /* dvh = dynamic viewport height, adjusts for Chrome/Safari mobile toolbars */
    }
}

/* Progress Bar */
.booking-progress-bar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.booking-progress-bar .progress-fill {
    height: 100%;
    background: var(--color-emerald);
    width: 0%;
    transition: width 0.4s ease;
}

/* Unified Header Style for Modal (Immune to tag selectors) */
.modal-unified-title {
    display: block;
    font-family: 'Onest', sans-serif !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    color: var(--color-dark) !important;
    margin-bottom: 16px !important;
    letter-spacing: -0.01em !important;
    line-height: 1.3 !important;
    text-align: center !important;
    opacity: 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* Exclusive override — locks all modal headings regardless of global style.css rules */
#bookingModal .modal-unified-title {
    font-family: 'Onest', sans-serif !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    color: var(--color-dark) !important;
    letter-spacing: -0.01em !important;
    line-height: 1.3 !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* Centered: top calendar heading */
#bookingStep1 .booking-header .modal-unified-title {
    text-align: center !important;
    margin-bottom: 16px !important;
}

/* Left-aligned: time slots and form section headings */
#bookingStep1 .time-slots-widget .modal-unified-title,
#bookingStep2 .form-block .modal-unified-title {
    text-align: left !important;
    margin-bottom: 12px !important;
}

.booking-header {
    text-align: center;
    margin-bottom: 24px;
}

.booking-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Steps */
.booking-step {
    padding: 32px;
}

/* Calendar Widget (Apple Style) */
.calendar-widget {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.calendar-month-display {
    text-align: center;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 20px;
    color: var(--color-dark);
    font-family: 'Onest', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.cal-day-header {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.cal-date {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    border: none;
}

.cal-date.active-day {
    color: var(--color-dark);
    font-weight: 600;
}

.cal-date.active-day:hover {
    background: rgba(0, 0, 0, 0.05);
}

.cal-date.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.cal-date.selected {
    background: var(--color-emerald);
    color: white;
}

.cal-date.today {
    color: var(--color-emerald);
    font-weight: 700;
    background: rgba(46, 139, 87, 0.1);
}

.cal-date.today.selected {
    color: white;
}

/* Slots */
.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.slot-pill {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--color-emerald);
    background: transparent;
    color: var(--color-emerald);
    font-size: 15px !important;
    font-weight: 600 !important;
    font-family: 'Manrope', sans-serif !important;
    cursor: pointer;
    transition: all 0.2s;
}

.slot-pill:hover {
    background: rgba(46, 139, 87, 0.1);
}

.slot-pill.selected {
    background: var(--color-emerald);
    color: white;
}

/* Form Styles */
.booking-form {
    text-align: left;
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--color-emerald);
}

.form-block {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.form-block .modal-unified-title {
    display: block !important;
    text-align: left !important;
    margin-bottom: 12px !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    font-family: 'Onest', sans-serif !important;
    letter-spacing: -0.01em !important;
    line-height: 1.3 !important;
    color: var(--color-dark) !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* Подзаголовок слотов — чуть меньше главного заголовка */
.slots-heading {
    display: block;
    text-align: left;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 500;
    font-family: 'Onest', sans-serif;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--color-dark);
}

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-dark);
}

.field-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
    font-style: italic;
    opacity: 0.9;
}

.required {
    color: var(--color-terracotta);
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-emerald);
    background: white;
}

.form-input.invalid {
    border-color: var(--color-terracotta);
    box-shadow: 0 0 0 3px rgba(199, 110, 85, 0.2);
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
}

.checkbox-label {
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.booking-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.booking-actions .btn {
    font-size: 16px !important;
    padding: 16px 24px;
    height: auto;
}

/* Two-button row: Назад left (auto width), submit right (fills remaining space) */
.booking-actions.double {
    justify-content: space-between;
}

.booking-actions.double #backToCalendarBtn {
    flex: 0 0 auto; /* natural width, stays left */
}

.booking-actions.double #submitBookingBtn {
    flex: 1 1 auto;  /* grows to fill remaining space on the right */
    max-width: 260px;
}

/* Submit button: grey/disabled state by default */
#submitBookingBtn {
    background: #b0b8bb !important;
    color: rgba(255, 255, 255, 0.75) !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    pointer-events: none !important;
    transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease !important;
}

/* Submit button: active green state when form is complete */
#submitBookingBtn.form-ready {
    background: var(--color-emerald) !important;
    color: #fff !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    box-shadow: 0 4px 20px rgba(46, 139, 87, 0.35) !important;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .booking-step {
        padding: 24px 16px;
    }

    .booking-actions.double {
        flex-direction: row;   /* keep side-by-side even on mobile */
        justify-content: space-between;
    }

    .booking-actions.double #submitBookingBtn {
        max-width: none; /* full remaining space on mobile */
    }

    .cal-date {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .calendar-grid {
        gap: 4px;
    }

    .legal-hint {
        font-size: 10px !important;
        text-align: center;
        opacity: 0.8;
    }
}

/* --------------------------------
   Global Form Consent Text Style
   -------------------------------- */
.form-consent-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
    font-weight: 500;
    opacity: 0.85;
}

.form-consent-text a {
    color: var(--color-emerald);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
}

.form-consent-text a:hover {
    opacity: 0.75;
}