/* restaurant/css/stepper/restaurant-progress.css */
/* ============================================================
   RESTAURANT CHECKOUT PROGRESS - same pattern as booking stepper
   (bubble + number/check + connector + label)
   Values copied from booking/css/booking_new1.css (.step, .step-bubble …)
   Direction-agnostic: only flexbox + logical properties, so the
   steps flow right-to-left automatically when <html dir="rtl">.
   Load AFTER stepper-optimized2.css so it wins.
   ============================================================ */

.restaurant-progress {
    --rs-bubble: 2.5rem;          /* booking: 2.5rem */
    --rs-line: 3px;               /* booking: 3px border + 3px connector */
    --rs-idle: #e9ecef;
    --rs-idle-text: #6c757d;
    --rs-done: #28a745;           /* booking: completed = green */
    --rs-accent: var(--menu-primary-color, var(--primary-color, #ff6b93));
    padding: 2rem 0 1rem;         /* booking: .booking-progress */
}

.restaurant-progress .restaurant-progress-steps {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* --- Step ------------------------------------------------- */
.restaurant-progress .restaurant-step {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: var(--rs-bubble);
    position: relative;
    text-align: center;
}

.restaurant-progress .restaurant-step-bubble {
    width: var(--rs-bubble);
    height: var(--rs-bubble);
    border-radius: 50%;
    border: var(--rs-line) solid var(--rs-idle);
    background: transparent;
    color: var(--rs-idle-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1;
    transition: background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}

/* Number and check share the same slot: only one is visible */
.restaurant-progress .restaurant-step-number {
    display: block;
    /* Persian digits in Vazirmatn sit slightly low; keep them centred */
    font-variant-numeric: tabular-nums;
}

.restaurant-progress .restaurant-step-check {
    display: none;
    font-size: 0.85rem;
}

.restaurant-progress .restaurant-step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--rs-idle-text);
    white-space: nowrap;
}

/* --- Active ----------------------------------------------- */
.restaurant-progress .restaurant-step.active .restaurant-step-bubble {
    border-color: var(--rs-accent);
    background: var(--rs-accent);
    color: #fff;
}

.restaurant-progress .restaurant-step.active .restaurant-step-label {
    color: var(--rs-accent);
    font-weight: 600;
}

/* --- Completed (JS may use either class name) -------------- */
.restaurant-progress .restaurant-step.completed .restaurant-step-bubble,
.restaurant-progress .restaurant-step.done .restaurant-step-bubble {
    border-color: var(--rs-done);
    background: var(--rs-done);
    color: #fff;
}

.restaurant-progress .restaurant-step.completed .restaurant-step-number,
.restaurant-progress .restaurant-step.done .restaurant-step-number {
    display: none;
}

.restaurant-progress .restaurant-step.completed .restaurant-step-check,
.restaurant-progress .restaurant-step.done .restaurant-step-check {
    display: block;
}

.restaurant-progress .restaurant-step.completed .restaurant-step-label,
.restaurant-progress .restaurant-step.done .restaurant-step-label {
    color: var(--rs-done);
}

/* --- Old stepper CSS cleanup -------------------------------
   stepper-optimized2.css draws its own lines (pseudo-element
   tracks / absolutely positioned connectors). Together with the
   connector below they produced the doubled "—=" segments.
   Only the .restaurant-step-connector element draws a line now. */
.restaurant-progress::before,
.restaurant-progress::after,
.restaurant-progress .restaurant-progress-steps::before,
.restaurant-progress .restaurant-progress-steps::after,
.restaurant-progress .restaurant-step::before,
.restaurant-progress .restaurant-step::after,
.restaurant-progress .restaurant-step-bubble::before,
.restaurant-progress .restaurant-step-bubble::after,
.restaurant-progress .restaurant-step-connector::before,
.restaurant-progress .restaurant-step-connector::after {
    content: none !important;
    display: none !important;
}

.restaurant-progress .restaurant-step-connector {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    border: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

/* --- Connector -------------------------------------------- */
.restaurant-progress .restaurant-step-connector {
    flex: 1 1 auto;
    min-width: 12px;
    height: var(--rs-line);
    /* vertically centred on the bubble */
    margin-block-start: calc(var(--rs-bubble) / 2 - var(--rs-line) / 2);
    margin-inline: 4px;
    background: var(--rs-idle);
    border-radius: var(--rs-line);
    transition: background-color .25s ease;
}

.restaurant-progress .restaurant-step.completed + .restaurant-step-connector,
    /* booking's own connector-colour rule never matches (it targets a connector INSIDE .step);
       here completed segments really turn green */
.restaurant-progress .restaurant-step.done + .restaurant-step-connector {
    background: var(--rs-done);
}

/* --- Small phones: 5 steps must fit in ~340px ------------- */
@media (max-width: 400px) {
    .restaurant-progress {
        --rs-bubble: 2.1rem;
    }

    .restaurant-progress .restaurant-step-bubble {
        font-size: 0.8rem;
    }

    .restaurant-progress .restaurant-step-label {
        font-size: 0.65rem;
    }

    .restaurant-progress .restaurant-step-connector {
        min-width: 8px;
        margin-inline: 2px;
    }
}

/* ============================================================
   Success = green (was the card's primary colour)
   - "Confirm Order" (step 4) and "Verify Order" (step 5) buttons
   - the "Order Confirmed!" screen
   !important: stepper-optimized2.css paints these with
   var(--menu-primary-color) at high specificity.
   ============================================================ */
#restaurantStepperContainer {
    --rs-success: #198754;
    --rs-success-hover: #157347;
}

#restaurantStepperContainer .restaurant-stepper-actions .btn-success,
#restaurant_verifyCodeBtn {
    background: var(--rs-success) !important;
    border-color: var(--rs-success) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(25, 135, 84, .25) !important;
}

#restaurantStepperContainer .restaurant-stepper-actions .btn-success:hover,
#restaurant_verifyCodeBtn:hover {
    background: var(--rs-success-hover) !important;
    border-color: var(--rs-success-hover) !important;
}

#restaurantCheckoutSuccess .restaurant-success-icon,
#restaurantCheckoutSuccess .restaurant-success-icon i,
#restaurantCheckoutSuccess .restaurant-success-title {
    color: #198754 !important;
}

/* ============================================================
   Direction-aware arrows in stepper buttons
   fa-arrow-left/right are physical icons; mirror them in RTL so
   "Continue" points forward (left) and "Back" points right.
   ============================================================ */
html[dir="rtl"] .restaurant-stepper-actions .fa-arrow-left,
html[dir="rtl"] .restaurant-stepper-actions .fa-arrow-right {
    transform: scaleX(-1);
}

/* .ltr-input and .code-inputs[dir=ltr] moved to core/css/l10n.css (shared with booking) */

/* stepper-optimized2.css hides the order-type fields with opacity:0 until a .show class is set.
   Visibility is controlled by restaurant-stepper3.js (display), so never keep them transparent. */
#restaurantTableNumberGroup,
#restaurantDeliveryAddressGroup,
#restaurantPickupTimeGroup {
    opacity: 1;
    transform: none;
}

/* ============================================================
   Sticky action bar (Back / Continue) - always reachable
   Sits just above the bottom navigation, like Uber Eats /
   DoorDash / Stripe Checkout on mobile.
   ============================================================ */
#checkout-stepper .tab-content-section {
    /* overflow:hidden makes the section a scroll container, so position:sticky never stuck.
       clip keeps the rounded corners without that side effect (old browsers: visible). */
    overflow: visible;
    overflow: clip;
}

.restaurant-stepper-actions {
    position: sticky;
    /* --card-bar-bottom = measured height of the bottom nav (floating-nav-manager.js syncBarOffset), like
       booking's --booking-bar-bottom; the 60px guess left the bar half under a taller nav. */
    bottom: var(--card-bar-bottom, calc(var(--bottom-nav-height, 60px) + env(safe-area-inset-bottom, 0px)));
    z-index: 20;
    margin-top: 1.5rem;
    padding: 12px 0;
    background: #fff;
    border-top: 1px solid #eef0f2;
    box-shadow: 0 -8px 12px -10px rgba(0, 0, 0, .18);
}

.restaurant-stepper-actions > .d-flex {
    gap: 10px;
}

/* primary action (last button) takes the remaining width; Back stays compact */
.restaurant-stepper-actions .btn:last-child {
    flex: 1 1 auto;
}

.restaurant-stepper-actions .btn:first-child:not(:last-child) {
    flex: 0 0 auto;
}
