/* Main Styles relying on Theme Variables */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: var(--font-family, 'Inter', sans-serif);
    background-color: var(--bg-color, #fff);
    color: var(--text-color, #333);
    line-height: 1.6;
    padding-bottom: 80px;
}

/* Header / Hero */
/* Header / Hero */
.hero-banner {
    width: 100%;
    height: 180px;
    /* Reduced height */
    position: relative;
    overflow: hidden;
    border-bottom-left-radius: 30px;
    /* Rounded corners */
    border-bottom-right-radius: 30px;
    background: none !important;
}

.hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.restaurant-info-card {
    background: white;
    margin: -50px auto 0;
    width: 90%;
    max-width: 800px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
}

.restaurant-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.restaurant-details h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.restaurant-details p {
    font-size: 0.85rem;
    color: #666;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

/* Status: Open (Green) */
.status-badge.status-open {
    background-color: #e8f5e9;
    color: #2e7d32;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(46, 125, 50, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0);
    }
}

.cashback-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 5px;
    box-shadow: 0 2px 5px rgba(39, 174, 96, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: bounce-subtle 3s infinite ease-in-out;
}

@keyframes bounce-subtle {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-2px);
    }
}

@keyframes pulse-text {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Status: Closed (Red) */
.status-badge.status-closed {
    background-color: #ffcdd2 !important;
    color: #b71c1c !important;
    animation: pulse-red 2s infinite;
    border: 1px solid #ef5350;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(183, 28, 28, 0.5);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(183, 28, 28, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(183, 28, 28, 0);
    }
}

.badges-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.info-badge {
    background-color: #f5f5f5;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #e0e0e0;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.social-links-header {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-icon-link {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    transition: transform 0.2s, filter 0.2s;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.social-icon-link:hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}

.social-instagram {
    background: #E1306C;
}

.social-facebook {
    background: #1877F2;
}

.social-tiktok {
    background: #000000;
}

.social-youtube {
    background: #FF0000;
}

.social-site {
    background: #3498db;
}

.social-twitter {
    background: #000000;
}

.social-threads {
    background: #000000;
}

.social-ifood {
    background: #ea1d2c;
}

.social-99food {
    background: #ff8b00;
}

.hours-display {
    font-size: 0.85rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffdb4d;
    padding: 8px 18px;
    border-radius: 50px;
    border: 2px solid #f1c40f;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(241, 196, 15, 0.2);
}

.hours-display i {
    color: #333;
    font-size: 0.9rem;
}

/* Category Sections */
.category-section {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 15px;
}

.category-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #222;
}

/* Product List */
.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.product-item:hover {
    transform: translateY(-2px);
}

.product-info {
    flex: 1;
    padding-right: 15px;
}

.product-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 5px;
}

.product-desc {
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-weight: 700;
    color: var(--primary-color);
}

.product-image-container {
    width: 90px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.add-to-cart-btn-pill {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
}

/* Modal / Cart Drawer */
.cart-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    justify-content: flex-end;
}

.cart-sidebar {
    width: 100%;
    max-width: 420px;
    background: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.btn-checkout {
    width: 100%;
    background: var(--primary-color);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

/* Cart Item */
.cart-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.cart-item-img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    margin-right: 15px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.cart-item-price {
    color: var(--primary-color);
    font-weight: 600;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* Checkout Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
}

.option-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-card {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
}

.option-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-card i {
    font-size: 1.2rem;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-card span {
    font-size: 1rem;
    font-weight: 600;
    color: #444;
}

.option-card:hover {
    background: #fdfdfd;
}

.option-card:has(input:checked) {
    border-color: var(--primary-color);
    background-color: #fff8f6;
}

.option-card:has(input:checked) i,
.option-card:has(input:checked) span {
    color: var(--primary-color);
}


/* Footer */
.main-footer {
    background-color: var(--light-gray);
    color: #666;
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* Floating Cart Bar */
.floating-cart-bar {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    /* Limit width on larger screens */
    background: var(--primary-color);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(255, 69, 0, 0.4);
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    z-index: 900;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

.floating-cart-bar:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 15px 35px rgba(255, 69, 0, 0.5);
}

/* Category Quick Nav */
.category-nav {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 12px;
    padding: 15px 10px;
    margin: 10px auto 25px;
    max-width: 800px;
    /* Alinhado com o corpo do site */
    width: 95%;
    /* Pequena margem nas laterais em telas menores */
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* Firefox: Barra fina */
    scrollbar-color: var(--primary-color) #f0f0f0;
}

/* Estilização da barra de rolagem para Chrome/Edge/Safari (Desktop) */
.category-nav::-webkit-scrollbar {
    height: 4px;
    /* Barra bem fininha e elegante */
    display: block;
    /* Garante que apareça no desktop */
}

.category-nav::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.category-nav::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* No celular, mantemos a barra escondida para o visual ficar limpo como estava */
@media (max-width: 768px) {
    .category-nav::-webkit-scrollbar {
        display: none;
    }

    .category-nav {
        scrollbar-width: none;
    }
}

/* =========================================
   PREMIUM MODAL STYLES
   ========================================= */

.modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 10000 !important;
    align-items: center;
    /* Center on desktop default */
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    display: flex;
    /* overridden by JS usually, but here for reference */
    opacity: 1;
}

.modal-card {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-grabber {
    display: none;
    width: 40px;
    height: 5px;
    background: #e0e0e0;
    border-radius: 10px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

.modal-overlay.open .modal-card {
    transform: translateY(0);
}

/* Mobile specific for drawer effect */
@media (max-width: 600px) {
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-card {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding: 20px 24px;
        max-height: 90vh;
        /* Safe area */
    }
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
    /* Side breathing room */
    margin-bottom: 15px;
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
    width: 5px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Addon Selection Cards */
.addon-list,
.addon-group {
    margin: 15px 0;
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Space between items */
}

.addon-group {
    margin: 0 0 20px 0;
    /* Margin between groups */
}

.addon-option {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #fdfdfd;
    border: 2px solid #f1f3f5;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.addon-option:hover {
    background: #fff;
    border-color: #eee;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Hidden real checkbox */
.addon-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* State when checked (handled by JS toggling a class or :has selector) */
.addon-option.selected {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.15);
    /* fallback */
}

/* The indicator circle */
.check-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ddd;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.addon-option.selected .check-indicator {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.check-indicator::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: none;
}

.addon-option.selected .check-indicator::after {
    display: block;
}

.addon-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.addon-name {
    font-weight: 600;
    color: var(--text-color);
}

.addon-price {
    font-weight: 700;
    color: var(--primary-color);
}

/* Modal Headers */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--heading-color);
}

.modal-price-tag {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
}

.modal-subtitle {
    background: #fdf2f2;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    padding: 8px 15px;
    border-radius: 50px;
    margin: 15px 0 10px;
    border: 1px solid rgba(255, 65, 108, 0.1);
    letter-spacing: 0.5px;
    display: table;
    /* To allow center with margin auto if needed, or stick to block */
    width: 100%;
}

/* Modal Actions */
.modal-actions {
    margin-top: auto;
    display: grid;
    gap: 12px;
    flex-shrink: 0;
}

.btn-confirm {
    width: 100%;
    padding: 18px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.btn-confirm:active {
    transform: scale(0.98);
}

.btn-cancel {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #888;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel:hover {
    color: #333;
}

.cat-nav-item {
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.cat-nav-item:hover,
.cat-nav-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Header WhatsApp Button */
.btn-header-wa {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #25d366;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 50px;
    margin-top: 0;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-header-wa:hover {
    transform: scale(1.05);
}

/* =========================================
   MOBILE IMPROVEMENTS (Only affects screens < 768px)
   ========================================= */
@media (max-width: 768px) {

    /* 1. Header Layout - Stacked & Centered */
    .restaurant-info-card {
        flex-direction: column;
        text-align: center;
        margin-top: -40px;
        gap: 15px;
        padding: 20px 15px;
        width: 94%;
    }

    .restaurant-logo {
        width: 90px;
        height: 90px;
        margin-top: -55px;
        /* Pull higher */
        border-width: 4px;
    }

    .restaurant-details h1 {
        font-size: 1.3rem;
    }

    .badges-row,
    .action-row {
        justify-content: center;
        gap: 8px;
    }

    .btn-header-wa {
        padding: 10px 20px;
        font-size: 0.9rem;
        flex-grow: 1;
        /* Bigger touch target */
        justify-content: center;
        min-width: 140px;
    }

    /* 2. Category Navigation - Edge-to-Edge */
    .category-nav {
        margin: 10px -15px 20px;
        /* Negative margin to bleed */
        padding: 5px 15px 15px;
        justify-content: flex-start;
    }

    .cat-nav-item {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    /* 3. Product List - Better Spacing */
    .product-item {
        padding: 12px;
        gap: 12px;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    .product-image-container {
        width: 90px;
        height: 90px;
        /* Square image looks better on mobile */
    }

    .product-name {
        font-size: 1rem;
        line-height: 1.3;
    }

    .product-desc {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    /* 4. Modal (Add Product) - Fixed Footer Issue */
    .modal-overlay {
        align-items: flex-end;
        /* Bottom sheet style */
        padding: 0;
    }

    .modal-card {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        width: 100%;
        max-width: 100%;
        max-height: 80vh;
        /* Reduced a bit for premium feel */
        display: flex;
        flex-direction: column;
        padding: 0;
        position: relative;
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
    }

    .modal-grabber {
        display: block;
    }

    .modal-header {
        flex-shrink: 0;
        padding: 15px 20px;
        background: white;
        z-index: 10;
        border-bottom: 1px solid #f0f0f0;
    }

    /* Scrollable Content Area */
    .addon-list {
        flex: 1;
        overflow-y: auto;
        padding: 5px 20px 20px;
        margin: 0;
        /* Reset margins */
        -webkit-overflow-scrolling: touch;
        min-height: 0;
        /* Critical fix for flex child scrolling */
    }

    .modal-subtitle {
        padding: 10px 20px 0;
        margin-bottom: 5px;
        font-size: 0.85rem;
    }

    .modal-price-tag {
        font-size: 1.1rem;
    }

    .modal-title {
        font-size: 1.2rem;
    }

    /* Fixed Footer Actions */
    .modal-actions {
        flex-shrink: 0;
        padding: 15px 20px;
        background: white;
        border-top: 1px solid #f0f0f0;
        z-index: 10;
        padding-bottom: max(15px, env(safe-area-inset-bottom));
        /* iOS Safe Area */
    }
}

/* 5. Floating Cart Visibility */
.floating-cart-bar {
    bottom: 20px;
    width: 90%;
    padding: 12px 20px;
    font-size: 0.95rem;
}

/* FIX: Force Modal Subtitle Centering on Mobile */
@media screen and (max-width: 768px) {

    #product-modal p.modal-subtitle,
    #addons-subtitle,
    .modal-subtitle {
        text-align: center !important;
        display: block !important;
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        float: none !important;
        padding-top: 10px;
        padding-bottom: 10px;
    }
}