/**
 * BookingProgressBar Component Styles
 * 
 * Enhanced styles for the booking progress bar with improved responsiveness,
 * better visual design, and proper back navigation support.
 * 
 * Dark Theme Colors:
 * - Primary Background: #141416 (dark)
 * - Step Background: #1a1a1c (slightly lighter)
 * - Text Primary: #ffffff (white)
 * - Text Secondary: #a3a3a3 (gray)
 * - Border: #777E90 (gray border)
 * - Active Step: #8b5cf6 (purple)
 * - Completed Step: #4FF6B1 (green)
 * - Connector Line: #777E90 (gray)
 * - Hover State: #6d28d9 (darker purple)
 */

/* Component Reset - Prevent global style conflicts */
.booking-progress-bar,
.booking-progress-bar *,
.booking-progress-bar *::before,
.booking-progress-bar *::after {
    box-sizing: border-box;
}

/* Main Progress Bar Container */
.booking-progress-bar,
#gdlr-booking-process-bar {
    /* CSS Custom Properties - Override these for theming */
    /* BS-5641 (LA28 handoff, Figma 701:53465): no container, pills sit on the page surface.
       Upcoming = page surface + outlined border, active = darkest primary, done = mid-foreground grey.
       Every value resolves through the event colour-mode tokens (BS-5639) so light and dark both work. */
    --progress-bg: transparent;
    --progress-border: transparent;
    --progress-backdrop: none;
    
    --step-surface: var(--event-surface-primary-color, #1f1f23);
    --step-muted: var(--event-mid-foreground-color, #777E90);
    --step-bg: var(--step-surface);
    --step-bg-hover: color-mix(in srgb, var(--step-muted) 18%, var(--step-surface));
    --step-border: var(--event-secondary-outlined-border, var(--step-muted));
    --step-text: var(--event-text-primary-color, #ffffff);
    
    --step-active-bg: var(--event-primary-darkest-color, var(--event-primary-color, #4323FF));
    --step-active-border: var(--step-active-bg);
    --step-active-text: #ffffff;
    --step-active-glow: transparent;
    
    --step-complete-bg: var(--step-muted);
    --step-complete-border: var(--step-muted);
    --step-complete-text: var(--step-surface);
    --step-complete-glow: transparent;
    
    --step-number-border: var(--step-muted);
    --step-number-active-bg: var(--event-surface-primary-color, #ffffff);

    --step-shadow-default: transparent;
    --step-shadow-hover: transparent;


    /* Layout */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
    font-family: var(--event-font-family, "DM Sans"), sans-serif;
    background: var(--progress-bg);
    -webkit-backdrop-filter: var(--progress-backdrop);
    backdrop-filter: var(--progress-backdrop);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    /* BS-5865: overflow-x: auto + overflow-y: visible computes overflow-y to auto too (per spec),
       so desktop got a vertical scrollbar it never needed. Only the mobile circle layout below
       gets the horizontal scroll back. */
    overflow: visible;
    box-shadow: none;
}

/* Back Button */
.booking-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--event-surface-primary-color, #ffffff);
    border: 2px solid var(--event-secondary-outlined-border, #ADADB3);
    border-radius: 50%;
    color: var(--step-text);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    cursor: pointer;
}

.booking-back-button:hover {
    background: color-mix(in srgb, var(--step-muted) 18%, transparent);
    border-color: var(--step-text);
    transform: translateX(-4px) scale(1.1);
    box-shadow: none;
}

.booking-back-button svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.booking-back-button:hover svg {
    transform: translateX(-2px);
}

/* BS-5865 round 8 (OL canvas row 46, Figma 1104:11582): the back arrow sits on the bar's left edge
   and the steps centre on the page, instead of arrow-plus-steps centring as one run. */
@media (min-width: 769px) {
    .booking-back-button {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    .booking-back-button:hover {
        transform: translate(-4px, -50%) scale(1.1);
    }
}



/* Individual Step */
.booking-progress-step {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    min-height: 64px; /* Figma pill height */
    padding: 12px 24px;
    background: var(--step-bg);
    border: 2px solid var(--step-border);
    border-radius: 12px; /* BS-5865 round 6 (row 24): same 12px as the hotel-page cards */
    font-family: var(--event-font-family, "DM Sans"), sans-serif !important; /* Event typography from Visual Settings */
    font-size: 16px;
    font-weight: 500;
    color: var(--step-text);
    text-align: center;
    line-height: 1 !important; /* Remove extra font space - must override theme */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    text-decoration: none;
    box-shadow: 0 0 8px var(--step-shadow-default);
    -webkit-user-select: none;
    user-select: none;
    transform-origin: center center;
    align-self: center; /* Ensure vertical centering in flex container */
    box-sizing: border-box !important; /* Ensure consistent box model */
}

/* Step Content Wrapper - Proper flexbox centering */
.booking-progress-step__content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit !important; /* Use parent font (DM Sans) */
    font-size: inherit !important; /* Inherit size */
    line-height: 1 !important; /* Remove extra space above/below text - override theme */
    margin: 0 !important; /* Remove any margin */
    padding: 0 !important; /* Remove any padding */
    /* Key fix: Reset vertical-align to prevent baseline issues */
    vertical-align: baseline !important;
    /* Flexbox child alignment */
    align-self: center !important;
}

/* NOTE: Pseudo-elements removed to prevent interference with flex centering
   The debugging overrides and actual shadow rendering handle these */

.booking-progress-step:not(.booking-progress-step--active) {
    padding: 12px 16px;
}

/* Step States */
.booking-progress-step--active {
    background: var(--step-active-bg);
    border-color: transparent;
    color: var(--step-active-text);
    transform: scale(1.02);
    box-shadow: none;
    z-index: 2;
    transform-origin: center center;
}

.booking-progress-step--completed {
    background: var(--step-complete-bg);
    border-color: var(--step-complete-border);
    color: var(--step-complete-text);
    font-weight: 700;
    box-shadow: none;
    cursor: pointer;
}

.booking-progress-bar .booking-progress-step--completed,
.booking-progress-bar .booking-progress-step--completed .booking-progress-step__content,
.booking-progress-bar .booking-progress-step--completed .booking-progress-step__number,
.booking-progress-bar .booking-progress-step--completed .booking-progress-step__text,
#gdlr-booking-process-bar .booking-progress-step--completed,
#gdlr-booking-process-bar .booking-progress-step--completed .booking-progress-step__content,
#gdlr-booking-process-bar .booking-progress-step--completed .booking-progress-step__number,
#gdlr-booking-process-bar .booking-progress-step--completed .booking-progress-step__text,
.booking-progress-step--completed a,
.booking-progress-step--completed a:visited,
.booking-progress-step--completed .booking-progress-step__link {
    color: var(--step-complete-text) !important;
}

.booking-progress-step--clickable {
    cursor: pointer;
}

.booking-progress-step--clickable:hover,
.booking-progress-step--completed:hover {
    border-color: var(--step-muted);
    background: var(--step-bg-hover);
    color: var(--step-text);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 20px var(--step-shadow-hover);
}

.booking-progress-step--completed:hover .booking-progress-step__content,
.booking-progress-step--completed:hover .booking-progress-step__number,
.booking-progress-step--completed:hover .booking-progress-step__text,
.booking-progress-step--completed:hover .booking-progress-step__link,
.booking-progress-step--completed:hover a {
    color: var(--step-text) !important;
}

.booking-progress-step--clickable:active,
.booking-progress-step--completed:active {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 2px 12px var(--step-shadow-hover);
}

/* Disabled step state - prevents interaction on confirmation page */
.booking-progress-step--disabled {
    pointer-events: none !important;
    cursor: default !important;
    opacity: 0.7;
}

.booking-progress-step--disabled:hover,
.booking-progress-step--disabled.booking-progress-step--hover {
    transform: none !important;
    box-shadow: 0 0 8px var(--step-shadow-default) !important;
    border-color: inherit !important;
    background: inherit !important;
    color: inherit !important;
}

.booking-progress-step--disabled.booking-progress-step--clickable,
.booking-progress-step--disabled.booking-progress-step--completed {
    cursor: default !important;
}

/* Step with Link */
.booking-progress-step a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}


/* Step Numbers (optional) */
.booking-progress-step__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    background: transparent;
    border: 1px solid var(--step-number-border);
    border-radius: 50%;
    box-sizing: border-box; /* keep the border inside the 25px circle */
    font-family: inherit; /* Use parent font (DM Sans) */
    font-size: 16px;
    font-weight: 500;
    color: var(--event-text-secondary-color, #474754);
    flex-shrink: 0;
    line-height: 1 !important; /* Precise centering - override theme */
    margin: 0 !important; /* Remove any margin */
    padding: 0 !important; /* Remove any padding */
    vertical-align: middle !important; /* Force middle alignment */
}

.booking-progress-step--active .booking-progress-step__number {
    background: var(--step-number-active-bg);
    border-color: transparent;
    color: var(--event-text-secondary-color, #474754);
}

/* Same specificity as the completed-text !important block above, later in the file, so the
   number stays readable on its surface-coloured badge. */
.booking-progress-bar .booking-progress-step--completed .booking-progress-step__number,
#gdlr-booking-process-bar .booking-progress-step--completed .booking-progress-step__number {
    background: var(--step-surface);
    border-color: transparent;
    color: var(--step-complete-bg) !important;
}

.booking-progress-bar .booking-progress-step--completed:hover .booking-progress-step__number,
#gdlr-booking-process-bar .booking-progress-step--completed:hover .booking-progress-step__number {
    color: var(--step-text) !important;
}

/* Step Text */
.booking-progress-step__text {
    font-family: inherit; /* Use parent font (DM Sans) */
    line-height: 1.5 !important;
    white-space: nowrap;
    display: flex; /* Make it flex to control alignment */
    align-items: center; /* Vertically center the text */
    margin: 0 !important; /* Remove any margin */
    padding: 0 !important; /* Remove any padding */
    vertical-align: middle !important; /* Force middle alignment */
}

/* Error State */
.booking-progress-bar--error {
    background: #1a1a1c;
    border: 2px solid #ef4444;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.booking-progress-bar__error-message {
    color: #ef4444;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Responsive Design */
/* ========================================================================
   RESPONSIVE DESIGN - Mobile First
   ======================================================================== */

/* Mobile & Tablet (all screens up to 768px) */
@media (max-width: 768px) {
    .booking-progress-bar,
    #gdlr-booking-process-bar {
        flex-direction: row;
        gap: 8px;
        padding: 10px 0;
        margin: 12px 0;
        /* BS-5865: mobile circles can still outrun narrow viewports; keep the horizontal
           scroll here only, now that desktop no longer inherits it. */
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    
    /* BS-5865 round 5 (OL canvas row 20, Figma 1097:16130): the back arrow is a bare icon on the
       left edge and the step circles group on the right, instead of one centred run of circles. */
    .booking-back-button {
        width: 24px;
        height: 24px;
        margin-right: auto;
        background: transparent;
        border: none;
        border-radius: 0;
    }
    
    .booking-back-button svg {
        width: 24px;
        height: 24px;
    }
    
    .booking-back-button:hover {
        background: transparent;
        transform: translateX(-2px);
    }
    
    .booking-progress-step {
        min-width: 40px;
        max-width: 40px;
        width: 40px;
        min-height: 40px;
        max-height: 40px;
        height: 40px;
        padding: 0;
        font-size: 13px;
        touch-action: manipulation;
        justify-content: center;
        transform: none;
        border-radius: 50%;
        flex-shrink: 0;
    }
    
    .booking-progress-step__content {
        gap: 0;
    }
    
    .booking-progress-step__text {
        display: none;
    }
    
    .booking-progress-step__number {
        flex: 0 0 25px;
        width: 25px;
        height: 25px;
        min-width: 25px;
        font-size: 13px;
        background: transparent;
    }
    
    .booking-progress-step--active {
        box-shadow: 0 0 12px var(--step-active-glow), 0 0 0 2px color-mix(in srgb, var(--event-cta-color, #8B5CF6) 20%, transparent);
        transform: none;
    }
    
    .booking-progress-step--clickable:hover,
    .booking-progress-step--completed:hover {
        transform: scale(1.1);
    }
    
    .booking-progress-step--clickable:active,
    .booking-progress-step--completed:active {
        transform: scale(0.95);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .booking-progress-step {
        border-width: 2px;
    }
    
    .booking-progress-step--active {
        border-width: 3px;
        font-weight: 800;
    }
    
    .booking-progress-step--completed {
        border-width: 2px;
        font-weight: 700;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .booking-progress-step,
    .booking-progress-step--active {
        transition: none;
        transform: none;
    }
    
    .booking-progress-step--clickable:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .booking-progress-bar {
        background: #fff;
        color: #000;
        border: 1px solid #000;
        border-radius: 8px;
        padding: 16px;
    }
    
    .booking-progress-step {
        background: #fff;
        border: 1px solid #000;
        color: #000;
    }
    
    .booking-progress-step--active {
        background: #ddd;
        font-weight: 800;
    }
    
    .booking-progress-step--completed {
        background: #eee;
    }
    
}

/* ========================================================================
   NOTE: Legacy class compatibility
   The following legacy classes still work via cascading/specificity:
   - #gdlr-booking-process-bar (inherits from .booking-progress-bar)
   - .gdlr-active (no longer output, but kept in responsive rules)
   - .gdlr-back (no longer output, but kept in responsive rules)
   ======================================================================== */


/* Accessibility */
.booking-progress-step:focus,
.booking-progress-step a:focus {
    outline: 2px solid var(--step-complete-bg);
    outline-offset: 2px;
}

/* Loading state */
.booking-progress-bar--loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.booking-progress-bar--loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, var(--step-active-glow), transparent);
    animation: loading-shimmer 1.5s infinite;
    border-radius: 16px;
}

@keyframes loading-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.booking-progress-bar--loading .booking-progress-step {
    opacity: 0.8;
    cursor: wait;
}

/* Focus states for accessibility */
.booking-progress-step:focus-visible {
    outline: 3px solid var(--step-complete-bg);
    outline-offset: 3px;
    border-color: var(--step-active-bg);
}

.booking-progress-step a:focus-visible {
    outline: 3px solid var(--step-complete-bg);
    outline-offset: 3px;
    border-radius: var(--event-button-radius, 8px);
}

