/* Search Bar Section */
.search-section {
    background: linear-gradient(135deg, #3498db 0%, #2979AF 100%);
}

/* Order Type Tabs */
.order-tab {
    position: relative;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
}

.order-tab:hover {
    background: rgba(255, 255, 255, 0.2);
}

.order-tab.active {
    color: #00968F;
    background: white;
    border-color: white;
}

/* Distance Slider */
.distance-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #FD5C02 0%, #FD5C02 50%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.3) 100%);
    outline: none;
    transition: background 0.1s ease;
}

.distance-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.distance-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 10px rgba(253, 92, 2, 0.4);
}

.distance-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.distance-slider::-moz-range-progress {
    background: #FD5C02;
    border-radius: 3px;
    height: 6px;
}

.distance-slider::-moz-range-track {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    height: 6px;
}

/* Restaurant Card */
.restaurant-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
}

.restaurant-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.12);
    border-color: #FD5C02;
}

.restaurant-card:hover .restaurant-name {
    color: #FD5C02;
}

/* ============================================
   Whole-card click target (stretched link) + premium polish
   ============================================ */

.restaurant-card {
    cursor: pointer;
}

/* The restaurant name link stretches over the whole card, so a tap
   anywhere runs selectRestaurant(). Real controls sit above this layer
   and keep their own behaviour — no JS event juggling needed. */
.restaurant-card .card-stretch-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Lift the real controls above the stretched link.
   NOTE: never add z-index to .restaurant-info-trigger-wrapper — it would
   create a low stacking context that re-traps the fixed mobile popup
   beneath the overlay. Only the button itself is raised. */
.restaurant-card .gift-card-btn,
.restaurant-card .restaurant-info-trigger,
.restaurant-card .js-expandable-toggle,
.restaurant-card .js-expandable-content a {
    position: relative;
    z-index: 2;
}

.restaurant-card .book-advance-btn {
    z-index: 2;
}

/* Premium info / open-hours trigger */
.restaurant-card .restaurant-info-trigger {
    gap: 4px;
    border-color: rgba(253, 92, 2, 0.25);
    background: rgba(253, 92, 2, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: color 0.2s ease, background-color 0.2s ease,
                border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.restaurant-card .restaurant-info-trigger:hover {
    color: #ffffff;
    background: #FD5C02;
    border-color: #FD5C02;
    box-shadow: 0 4px 10px rgba(253, 92, 2, 0.3);
    transform: translateY(-1px);
}

.restaurant-card .restaurant-info-trigger:active {
    transform: translateY(0);
}

/* Restaurant Logo */
.restaurant-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: contain;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

/* Favorite Heart Button */
.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(253, 92, 2, 0.25);
}

.favorite-btn:active {
    transform: scale(0.9);
}

.favorite-btn .favorite-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #FD5C02;
    stroke-width: 2;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.favorite-btn.is-favorite .favorite-icon {
    fill: #FD5C02;
    stroke: #FD5C02;
}

.favorite-btn.is-loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Heart pop animation on toggle */
@keyframes heartPop {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.favorite-btn.animate-pop {
    animation: heartPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Offset status badge when favorite btn is present */
.restaurant-card:has(.favorite-btn) .status-badge {
    top: 52px;
}

/* Status Badge */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* Book in Advance Button */
.book-advance-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
}

/* Discount Badge */
.discount-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    background: linear-gradient(135deg, #FD5C02, #CA4901);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(253, 92, 2, 0.3);
    z-index: 10;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 51;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Datetime Input */
.datetime-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    color: #374151;
    background: #f9fafb;
    transition: all 0.2s ease;
    cursor: pointer;
}

.datetime-input:focus {
    outline: none;
    border-color: #FD5C02;
    box-shadow: 0 0 0 3px rgba(253, 92, 2, 0.12);
    background: white;
}

.datetime-input.active {
    border-color: #FD5C02;
    background: white;
}

/* Mobile Filter Button */
.mobile-filter-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    box-shadow: 0 4px 20px rgba(253, 92, 2, 0.35);
}

/* Fade Animations */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Logo Placeholder */
.logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

/* ============================================
   Responsive adjustments
   ============================================ */

@media (max-width: 768px) {
    .restaurant-logo {
        width: 70px;
        height: 70px;
    }

    .search-section .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Mobile popup positioning */
    .restaurant-info-popup {
        position: fixed;
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) scale(0.95);
        min-width: 300px;
        max-width: calc(100vw - 32px);
    }

    .restaurant-info-popup.active {
        transform: translate(-50%, -50%) scale(1);
    }

    /* Hide arrow on mobile (centered modal style) */
    .popup-arrow {
        display: none;
    }

    /* Add close button on mobile */
    .popup-close-mobile {
        display: block;
    }

    .popup-hours-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile overlay for popup */
.restaurant-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.restaurant-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Desktop: reposition popup if it would overflow right edge */
@media (min-width: 769px) {
    .restaurant-info-popup.flip-left {
        left: auto;
        right: calc(100% + 12px);
    }

    .restaurant-info-popup.flip-left .popup-arrow {
        left: auto;
        right: -8px;
        border-right: none;
        border-left: 10px solid #2c8dc7;
    }

    /* Flip to top if needed */
    .restaurant-info-popup.flip-top {
        top: auto;
        bottom: 0;
        transform: translateY(0);
    }

    .restaurant-info-popup.flip-bottom {
        top: 0;
        bottom: auto;
        transform: translateY(0);
    }
}
/* Lift the active card above its neighbours so the absolutely-positioned
   desktop popup isn't overlapped. On mobile the popup is portaled to
   <body> (see restaurant_info_popup.js), so this :has() no longer matches
   there and the card stays in normal flow. */
.restaurant-card:has(.restaurant-info-popup.active) {
    z-index: 10;
}
