/* ==========================================================================
   BOOKING PAGE STYLING
   ========================================================================== */

:root {
    --booking-bg: #f8fafc;
    --booking-card-bg: #ffffff;
    --booking-border: #e2e8f0;
    --booking-text: #0f172a;
    --booking-text-muted: #64748b;
    --booking-primary: #6c5ce7;
    --booking-primary-hover: #5b4bc4;
    --booking-purple: #a55eea;
    --booking-success: #10b981;
    --booking-warning: #f59e0b;
    --booking-danger: #ef4444;
}

body.booking-page {
    background-color: var(--booking-bg);
    color: var(--booking-text);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding-top: 80px; /* Space for fixed header */
    min-height: 100vh;
}

/* Header Tweaks */
.booking-page .header {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid var(--booking-border);
}

.booking-page .logo-text {
    background: linear-gradient(135deg, var(--booking-primary), var(--booking-purple)) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Layout */
.booking-main {
    padding: 3rem 0 5rem 0;
}

.booking-hero {
    text-align: center;
    margin-bottom: 3.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.booking-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.75rem;
    font-weight: 850;
    margin-bottom: 0.8rem;
    background: linear-gradient(135deg, #1e293b 30%, var(--booking-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.booking-subtitle {
    font-size: 1.15rem;
    color: var(--booking-text-muted);
    line-height: 1.6;
}

.booking-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.booking-form-side,
.booking-timeline-side {
    width: 100%;
}

/* Booking Cards */
.booking-card {
    background: var(--booking-card-bg);
    border: 1px solid var(--booking-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.04);
}

.timeline-card {
    border: 1px solid rgba(108, 92, 231, 0.15);
    box-shadow: 0 15px 35px -10px rgba(108, 92, 231, 0.06);
}

/* Multi-step Form */
.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--booking-border);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--booking-primary), var(--booking-purple));
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-label {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.6rem;
}

.form-input {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--booking-text);
    transition: all 0.2s ease;
    background: #ffffff;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--booking-primary);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

/* Event Type Selector Cards */
.event-type-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.event-type-card {
    border: 2px solid var(--booking-border);
    border-radius: 16px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    text-align: center;
}

.event-type-card:hover {
    border-color: var(--booking-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 92, 231, 0.05);
}

.event-type-card.active {
    border-color: var(--booking-primary);
    background: rgba(108, 92, 231, 0.05);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.08);
}

.event-type-icon {
    font-size: 1.8rem;
}

.event-type-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #334155;
}

.event-type-card.active .event-type-name {
    color: var(--booking-primary);
}

/* Gender Selector */
.gender-selector {
    display: flex;
    gap: 1rem;
}

.gender-card {
    flex: 1;
    border: 2px solid var(--booking-border);
    border-radius: 14px;
    padding: 0.85rem;
    text-align: center;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    font-size: 0.95rem;
}

.gender-card:hover {
    border-color: var(--booking-primary);
}

.gender-card.active {
    border-color: var(--booking-primary);
    background: rgba(108, 92, 231, 0.05);
    color: var(--booking-primary);
}

/* Conditional Block Visibility */
.conditional-block {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.conditional-block.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   INTERACTIVE TIMELINE & TRACKS
   ========================================================================== */
.timeline-section-header {
    margin-bottom: 2rem;
}

.timeline-intro-text {
    font-size: 0.92rem;
    color: var(--booking-text-muted);
    line-height: 1.5;
    margin-top: 0.4rem;
}

.timeline-visual-wrapper {
    background: #f8fafc;
    border: 1px solid var(--booking-border);
    border-radius: 18px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* Hours scale */
.timeline-hours-scale {
    display: flex;
    border-bottom: 1.5px dashed var(--booking-border);
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
    min-width: 560px; /* Ensures grid doesn't squeeze too small */
}

.hour-tick {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--booking-text-muted);
    text-align: center;
    position: relative;
}

.hour-tick::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 1px;
    height: 6px;
    background: #cbd5e1;
}

/* Tracks Container */
.timeline-tracks-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 700px;
    position: relative;
}

.timeline-track-row {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 700px;
    gap: 1rem;
}

.timeline-scale-spacer {
    flex: 0 0 140px;
    min-width: 140px;
}

.timeline-track-label {
    flex: 0 0 140px;
    min-width: 140px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    border: 1px solid var(--booking-border);
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.02);
}

.timeline-track-label span:first-child {
    font-size: 1.1rem;
}

.timeline-track-bar-container {
    flex: 1;
    height: 32px;
    background: rgba(226, 232, 240, 0.4);
    border-radius: 8px;
    position: relative;
}


.timeline-bar {
    position: absolute;
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--booking-primary), var(--booking-purple));
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.25);
    padding: 0 0.5rem;
    box-sizing: border-box;
    cursor: grab;
    user-select: none;
    overflow: visible;
    transition: left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.timeline-bar.dragging {
    cursor: grabbing;
    transition: none !important;
    z-index: 100;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
}

.timeline-bar-label {
    width: 100%;
    height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 8px;
    padding-right: calc(var(--break-width, 0%) + 6px);
    pointer-events: none;
    box-sizing: border-box;
}

.timeline-bar-break-tail {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: var(--break-width, 0%);
    background: inherit;
    filter: brightness(0.82) saturate(0.9);
    border-left: 1.5px dashed rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.95);
    pointer-events: auto;
    overflow: visible;
    white-space: nowrap;
    border-radius: 0 8px 8px 0;
    z-index: 5;
    box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.15);
}

/* Скрытие основной подсказки при наведении на хвостик перерыва */
.timeline-bar-break-tail:hover ~ .timeline-tooltip {
    opacity: 0 !important;
    transform: translateX(-50%) translateY(6px) !important;
}

/* Всплывающая подсказка для перерыва */
.timeline-break-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #0f172a;
    color: #ffffff;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 6px 15px rgba(15, 23, 42, 0.15);
    z-index: 1001;
}

.timeline-break-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #0f172a;
}

.timeline-bar-break-tail:hover .timeline-break-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.timeline-bar-break-tail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.18),
        rgba(255, 255, 255, 0.18) 4px,
        transparent 4px,
        transparent 8px
    );
    pointer-events: none;
}

.timeline-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0 8px 8px 0;
    transition: background 0.2s ease;
    z-index: 10;
}

.timeline-bar:hover .timeline-resize-handle {
    background: rgba(255, 255, 255, 0.25);
}

.timeline-resize-handle:hover {
    background: rgba(255, 255, 255, 0.45) !important;
}

.timeline-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #0f172a;
    color: #ffffff;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 6px 15px rgba(15, 23, 42, 0.15);
    z-index: 1000;
}

.timeline-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #0f172a;
}

.timeline-bar:hover .timeline-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.timeline-bar.character-bar {
    background: linear-gradient(90deg, #fd79a8, #e84393);
    box-shadow: 0 4px 10px rgba(232, 67, 147, 0.25);
}

.timeline-bar.program-bar {
    background: linear-gradient(90deg, #0984e3, #6c5ce7);
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.25);
}

.timeline-bar.service-bar {
    background: linear-gradient(90deg, #00b894, #00cec9);
    box-shadow: 0 4px 10px rgba(0, 184, 148, 0.25);
}

/* Config List Items */
.timeline-config-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    margin-top: 1.5rem;
}

.timeline-config-item {
    background: #ffffff;
    border: 1px solid var(--booking-border);
    border-radius: 18px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
    transition: border-color 0.2s ease;
}

.timeline-config-item:hover {
    border-color: #cbd5e1;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.item-icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.3rem;
}

.item-icon-circle.character {
    background: #ffe8f0;
}

.item-icon-circle.program {
    background: #e8f0ff;
}

.item-icon-circle.service {
    background: #e8fff0;
}

.item-title-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.item-name {
    font-weight: 800;
    color: #1e293b;
    font-size: 1.02rem;
}

.item-rate {
    font-size: 0.82rem;
    color: var(--booking-text-muted);
    font-weight: 500;
}

.item-price-tag {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--booking-text);
}

/* Controls Grid */
.item-controls-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
    padding-top: 0.8rem;
    border-top: 1px solid #f1f5f9;
}

/* Sliders */
.control-slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.control-label-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.2rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
}

.time-readout {
    color: var(--booking-primary);
    font-variant-numeric: tabular-nums;
    font-family: monospace;
    min-width: 0;
    white-space: nowrap;
    display: inline-block;
    text-align: right;
    flex-shrink: 0;
}

.custom-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    margin: 8px 0;
    user-select: none;
    -webkit-user-select: none;
}

.custom-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--booking-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(108, 92, 231, 0.4);
    transition: transform 0.1s ease;
}

.custom-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Plus/Minus Custom Buttons for Hours */
.hours-control-wrapper {
    display: flex;
    align-items: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    height: 38px;
    min-width: 0;
    width: 100%;
}

.hour-btn {
    background: none;
    border: none;
    width: 38px;
    height: 100%;
    font-size: 1.2rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.hour-btn:hover {
    background: #f1f5f9;
    color: var(--booking-primary);
}

.hour-btn:active {
    background: #e2e8f0;
}

.hours-value-display {
    flex: 1;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
}

/* Summary Blocks */
.booking-summary-block {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--booking-border);
    border-radius: 20px;
    padding: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.total-row {
    margin-bottom: 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #334155;
}

.total-row .summary-total-price {
    flex-shrink: 0;
}

.summary-total-price {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--booking-primary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.btn-large {
    padding: 1.1rem 2rem !important;
    font-size: 1.15rem !important;
    border-radius: 16px !important;
}

/* Success / calculation modal. These rules used to come from the monolithic
   stylesheet; keep them on the booking page so the hidden success state is
   not rendered as plain text at the bottom of the document. */
.booking-page .calculation-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility 0s linear .22s;
}

.booking-page .calculation-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.booking-page .calculation-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.booking-page .calculation-modal-content {
    position: relative;
    z-index: 1;
    width: min(100%, 760px);
    max-height: min(90vh, 760px);
    overflow: auto;
    border: 1px solid rgba(108, 92, 231, .18);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}

.booking-page .calculation-modal-header,
.booking-page .calculation-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}

.booking-page .calculation-modal-header {
    border-bottom: 1px solid var(--booking-border);
}

.booking-page .calculation-modal-header h2 {
    margin: 0;
    color: var(--booking-text);
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
}

.booking-page .calculation-modal-close {
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--booking-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.booking-page .calculation-modal-body {
    padding: 1.5rem;
}

.booking-page .calculation-modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--booking-border);
}

body.booking-page.modal-open {
    overflow: hidden;
}

/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */
@media (min-width: 1025px) {
    /* Step 3: Contacts in 3 columns */
    .contacts-section .form-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .contacts-section .form-group.full-width {
        grid-column: span 1 !important;
    }
    
    /* Event Type Cards in 4 columns across */
    .event-type-selector {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Child Birthday Block in 4 columns across */
    #child-birthday-block .form-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    /* Date & Location in 2 columns (1fr 2fr) */
    .event-details-section > .form-section > .form-grid {
        grid-template-columns: 1fr 2fr !important;
    }

    /* Horizontal Summary block at the bottom */
    .booking-summary-block {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 1.5rem 2.5rem !important;
    }
    
    .booking-summary-block .total-row {
        margin-bottom: 0 !important;
        gap: 1.5rem !important;
    }
    
    .booking-summary-block .btn {
        width: auto !important;
        min-width: 340px !important;
        margin-top: 0 !important;
    }
}

@media (max-width: 640px) {
    .booking-card {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .event-type-selector {
        grid-template-columns: 1fr;
    }

    /* Блок управления временем: одна колонка чтобы все помещалось */
    .item-controls-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Блок управления аниматора */
    .animator-controls-block .item-controls-grid {
        grid-template-columns: 1fr !important;
    }

    /* Имя + цена на мобильном */
    .item-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .item-price-tag {
        font-size: 1rem;
    }

    .booking-title {
        font-size: 2.2rem;
    }

    .summary-total-price {
        font-size: 1.8rem;
    }

    /* Конфиг программ: одна карточка в ряд */
    .timeline-config-list {
        grid-template-columns: 1fr !important;
    }
}
