@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tema Oscuro (Predeterminado) */
body, body.theme-dark {
    color-scheme: dark;
    --bg-main: #0a0c10;
    --bg-card: #12161f;
    --bg-header: rgba(10, 12, 16, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --glass-bg: rgba(18, 22, 31, 0.75);
    --glass-border: rgba(255, 255, 255, 0.05);
    --bg-pill: rgba(255, 255, 255, 0.03);
    --input-bg: rgba(255, 255, 255, 0.04);
    --shadow-main: rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.4);
    --cart-footer-bg: rgba(10, 12, 16, 0.95);
    --divider-color: rgba(255, 255, 255, 0.05);
}

/* Tema Claro */
body.theme-light {
    color-scheme: light;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-header: rgba(248, 250, 252, 0.8);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);
    --bg-pill: rgba(0, 0, 0, 0.03);
    --input-bg: rgba(0, 0, 0, 0.02);
    --shadow-main: rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.08);
    --cart-footer-bg: rgba(255, 255, 255, 0.95);
    --divider-color: rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-card);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 20px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Header & Hero Section */
.hero-banner {
    position: relative;
    height: 380px;
    width: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 40px 20px;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(10, 12, 16, 0.2) 0%, rgba(10, 12, 16, 0.95) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
}

.restaurant-info {
    display: flex;
    align-items: center;
    gap: 25px;
    text-align: left;
    width: 100%;
}

.restaurant-logo-container {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.restaurant-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.restaurant-logo-container.initials {
    background: var(--primary);
    color: #fff;
    font-size: 2.8rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.restaurant-details-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.restaurant-name-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.restaurant-name-status-row h1 {
    margin: 0 !important;
}

.restaurant-info h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 30%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.restaurant-info p {
    color: var(--text-muted);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.restaurant-badge {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #2ecc71;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: none;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: currentColor;
    border-radius: 50%;
    display: inline-block;
}

.btn-share-store {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    transition: all 0.2s ease;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-share-store:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.btn-share-store:active {
    transform: translateY(0);
}

.payment-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    gap: 12px;
    transition: all 0.2s ease;
    flex-wrap: wrap;
}

.payment-detail-row:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.payment-detail-row span {
    flex-grow: 1;
    word-break: break-word;
}

.copyable-text {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copy-btn.primary {
    width: auto;
    padding: 0 16px;
    gap: 8px;
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.95rem;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.copy-btn.primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.theme-light .payment-detail-row {
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.theme-light .payment-detail-row:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.theme-light .copyable-text {
    color: var(--text-main);
}

.theme-light .copy-btn {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.theme-light .copy-btn:hover {
    background: #f1f5f9;
    color: var(--primary);
    border-color: #cbd5e1;
}

/* Category Navigation (Sticky) */
.category-navbar-wrapper {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
}

.category-navbar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.category-navbar::-webkit-scrollbar {
    display: none;
}

.category-pill {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-pill);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.category-pill:hover, .category-pill.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

/* Product Catalog Grid */
.main-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.category-section {
    margin-bottom: 50px;
    scroll-margin-top: 100px; /* Offset for sticky navbar */
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 25px;
    position: relative;
    padding-left: 15px;
    display: flex;
    align-items: center;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    width: 5px;
    height: 70%;
    background: var(--primary);
    border-radius: 10px;
}

.products-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    align-items: stretch;
}

/* Premium Product Card */
.product-card {
    flex: 0 1 calc(33.333% - 14px);
    width: 100%;
    min-width: 280px;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    position: relative;
}

/* For non-restaurant templates (stores, clothing, etc), use 4 columns */
body.template-product .product-card {
    flex: 0 1 calc(25% - 15px);
    min-width: 220px;
}

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

.product-img-wrapper {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.product-card:hover img {
    transform: scale(1.08);
}

.featured-tag {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--secondary);
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 1;
}

.product-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.product-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.product-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.product-price {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
}

.btn-add-to-cart {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-add-to-cart:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Floating Cart Trigger */
.cart-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition-smooth);
}

.cart-floating-btn.active {
    display: flex;
    animation: bounce 1.5s infinite alternate;
}

.cart-floating-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    background: var(--primary-hover);
}

.cart-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--secondary);
    color: #000;
    font-size: 0.8rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-main);
}

.pulse-animation {
    animation: badge-pulse 0.4s ease-out;
}

/* Glassmorphism Drawer (Cart Panel) */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -450px; /* Initially hidden */
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-left: 1px solid var(--glass-border);
    z-index: 100;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transition: cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

.cart-drawer.active {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-overlay.active {
    display: block;
    opacity: 1;
}

.cart-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close-drawer {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-close-drawer:hover {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

/* Cart Items List */
.cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.cart-empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.3;
}

.cart-item-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cart-item-qty-controls {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 2px;
}

.btn-qty {
    background: none;
    border: none;
    color: var(--text-main);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-qty:hover {
    background: var(--primary);
    color: #fff;
}

.qty-number {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0 8px;
    min-width: 20px;
    text-align: center;
}

.cart-item-total {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary);
    min-width: 70px;
    text-align: right;
}

.btn-remove-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    border-radius: 50%;
}
.btn-remove-item:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.15);
}

/* Cart Footer & Summary */
.cart-footer {
    padding: 20px;
    background: var(--cart-footer-bg);
    border-top: 1px solid var(--border-color);
}

.cart-summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.cart-summary-total-line {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    margin-bottom: 25px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
}

.cart-summary-total-line span:last-child {
    color: var(--secondary);
}

.btn-checkout {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.btn-checkout:hover {
    background: var(--primary-hover);
}

/* Checkout Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 110;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    position: relative;
    animation: modal-slide-up 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
    padding: 25px 25px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
}

.modal-body {
    padding: 25px;
}

/* Modern Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.input-control {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.input-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
}

textarea.input-control {
    resize: vertical;
    min-height: 80px;
}

select.input-control option {
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* Toggle Switcher for Order Type */
.order-type-switch {
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 4px;
    margin-bottom: 25px;
}

.order-type-switch label {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 50px;
    transition: var(--transition-smooth);
    margin-bottom: 0;
}

.order-type-switch input[type="radio"] {
    display: none;
}

.order-type-switch input[type="radio"]:checked + span {
    background: var(--primary);
    color: #fff;
    display: block;
    width: 100%;
    padding: 10px 0;
    border-radius: 50px;
    font-weight: 700;
}

.order-type-switch span {
    display: block;
    width: 100%;
    padding: 10px 0;
    border-radius: 50px;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

/* GPS Button styles */
.gps-btn-container {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.btn-gps {
    background: rgba(247, 181, 56, 0.1);
    border: 1px dashed var(--secondary);
    color: var(--secondary);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
    width: 100%;
}

.btn-gps:hover {
    background: rgba(247, 181, 56, 0.2);
}

.btn-success-gps {
    background: rgba(46, 204, 113, 0.2) !important;
    border: 1px solid #2ecc71 !important;
    color: #2ecc71 !important;
    cursor: default;
}

/* Spinner Loader */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

/* Footer Section */
.footer-restaurant {
    background: #06080b;
    border-top: 1px solid var(--border-color);
    padding: 40px 20px;
    text-align: center;
    margin-top: 80px;
}

.footer-restaurant p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Animations */
@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

@keyframes badge-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

@keyframes modal-slide-up {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsiveness */

/* Tablet & Smaller Laptops */
@media (max-width: 1024px) {
    .hero-banner {
        height: 320px;
    }
    
    .restaurant-info h1 {
        font-size: 2.6rem;
    }
    
    .main-container {
        padding: 0 15px;
    }
    
    .products-grid {
        gap: 20px;
    }
    
    .product-card {
        flex: 0 1 calc(50% - 10px);
        max-width: 450px;
    }
    
    .modal-content {
        max-width: 90%;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .hero-banner {
        height: 320px;
        padding: 30px 15px;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .hero-content {
        justify-content: center;
    }
    
    .restaurant-info {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 12px !important;
    }

    .restaurant-logo-container {
        width: 120px;
        height: 120px;
        margin-bottom: -8px;
    }
    
    .restaurant-logo-container.initials {
        font-size: 1.8rem;
    }

    .restaurant-details-wrapper {
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .restaurant-info h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .restaurant-name-status-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .restaurant-badge {
        margin-bottom: 8px;
    }
    
    .restaurant-info p {
        justify-content: center !important;
        font-size: 1rem;
        margin-top: 4px !important;
    }
    
    .main-container {
        margin: 25px auto;
        padding: 0 15px;
    }

    .category-navbar {
        padding: 0 15px;
        gap: 8px;
    }
    
    .category-pill {
        padding: 8px 16px;
        font-size: 0.95rem;
    }
    
    .products-grid {
        /* 2 columns for mobile */
        flex-direction: row;
        align-items: stretch;
        gap: 12px;
    }
    
    .product-card {
        flex: 0 1 calc(50% - 6px);
        max-width: 50%;
        min-width: 140px;
    }
    
    .product-img-wrapper {
        height: 120px; /* Shorter for 2 column layout */
    }
    
    .product-body {
        padding: 10px;
    }
    
    .product-title {
        font-size: 1rem;
    }
    
    .product-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        margin-bottom: 12px;
    }
    
    .product-price {
        font-size: 1.1rem;
    }
    
    .btn-add-to-cart {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .cart-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    .cart-drawer {
        max-width: 100%;
        right: -100%;
    }

    .cart-header h2 {
        font-size: 1.3rem;
    }

    .modal-overlay {
        padding: 10px;
        align-items: flex-end; /* Bottom sheet effect on mobile */
    }
    
    .modal-content {
        max-height: 90vh;
        width: 100%;
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        animation: modal-slide-up 0.3s ease-out;
    }

    .modal-header {
        padding: 20px 20px 10px;
    }

    .modal-body {
        padding: 20px;
    }

    .footer-restaurant {
        padding: 30px 15px;
        margin-top: 50px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .restaurant-info h1 {
        font-size: 1.8rem;
    }
}

/* 2-column layout for mobile */
@media (max-width: 650px) {
    .products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .product-card, body.template-product .product-card {
        min-width: 0 !important;
        max-width: none;
        width: 100%;
        margin: 0;
    }
    .product-img-wrapper {
        height: 130px !important;
    }
    .product-body {
        padding: 10px;
    }
    .product-title {
        font-size: 0.95rem;
        margin-bottom: 5px;
        line-height: 1.2;
    }
    .product-description {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
        margin-bottom: 8px;
    }
    .product-price {
        font-size: 1rem;
    }
    .product-footer {
        align-items: center;
    }
    .btn-add-to-cart {
        padding: 0;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        font-size: 0; /* hides "Agregar" */
        position: relative;
        display: block;
    }
    .btn-add-to-cart::after {
        content: '+';
        font-size: 1.6rem;
        font-weight: 500;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        transform: translateY(-0.5px);
    }
}

/* --- DESCUENTOS Y OFERTAS --- */
.price-old {
    text-decoration: line-through;
    opacity: 0.6;
    font-size: 0.95rem;
    margin-right: 8px;
    font-weight: 500;
    color: var(--text-muted);
}
.discount-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 2;
}

/* --- BUSCADOR GENERAL --- */
.search-container {
    max-width: 1200px;
    margin: 20px auto 10px;
    padding: 0 20px;
}
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}
.search-input:focus {
    border-color: var(--primary);
}
.search-icon {
    position: absolute;
    left: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

/* --- PLANTILLA DE PRODUCTOS (ROPA, FERRETERÍA, TECNOLOGÍA) --- */
.template-product .product-img-wrapper {
    height: auto;
    aspect-ratio: 3 / 4;
}

@media (max-width: 650px) {
    .template-product .product-img-wrapper {
        height: auto !important;
        aspect-ratio: 3 / 4;
    }
}

/* --- BANNER DE TIENDA CERRADA Y BADGES --- */
.closed-banner {
    position: sticky;
    top: 0;
    z-index: 105;
    background: rgba(239, 68, 68, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 12px 20px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}
.closed-banner svg {
    flex-shrink: 0;
    animation: pulseIcon 1.5s infinite;
}
.closed-banner ~ .category-navbar-wrapper {
    top: 48px;
}
.restaurant-badge.closed {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}
.status-dot.closed {
    background-color: #ef4444;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
@keyframes pulseIcon {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
    .closed-banner {
        font-size: 0.85rem;
        padding: 10px 15px;
    }
    .closed-banner ~ .category-navbar-wrapper {
        top: 60px; /* Adjust for potentially wrapped banner text on mobile */
    }
}

/* Toast Notifications Container */
#toast-container {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 380px;
}

.toast-notification {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.hide {
    opacity: 0;
    transform: translateY(-20px);
}

/* ================================================
   Boton Cerrar Modal (X) - Estilo mejorado
   ================================================ */
.btn-close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.btn-close-modal:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    transform: rotate(90deg) scale(1.1);
}

/* Temas claros */
body.theme-light .btn-close-modal {
    background: rgba(0, 0, 0, 0.05);
    color: #64748b;
}

body.theme-light .btn-close-modal:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ================================================
   Modal de Notificacion / Alerta Personalizada
   ================================================ */
#custom-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#custom-alert-overlay.active {
    display: flex;
    opacity: 1;
}

#custom-alert-box {
    background: var(--bg-card, #1a1f2e);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 18px;
    padding: 32px 28px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
    animation: alert-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

@keyframes alert-pop {
    from { transform: scale(0.85) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0);       opacity: 1; }
}

#custom-alert-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 94, 0, 0.12);
    border: 1px solid rgba(255, 94, 0, 0.2);
    color: var(--primary, #ff5e00);
    flex-shrink: 0;
}

#custom-alert-message {
    font-size: 0.97rem;
    font-weight: 500;
    color: var(--text-main, #f8fafc);
    line-height: 1.55;
    margin: 0;
}

#custom-alert-btn {
    margin-top: 4px;
    width: 100%;
    padding: 13px 20px;
    background: var(--primary, #ff5e00);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.97rem;
    font-weight: 700;
    font-family: var(--font-heading, sans-serif);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(255, 94, 0, 0.35);
}

#custom-alert-btn:hover {
    background: var(--primary-hover, #e05300);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 94, 0, 0.45);
}

#custom-alert-btn:active {
    transform: translateY(0);
}

/* Variante error (rojo) */
#custom-alert-overlay.alert-error #custom-alert-icon {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Variante warning (amarillo) */
#custom-alert-overlay.alert-warning #custom-alert-icon {
    background: rgba(247, 181, 56, 0.12);
    border-color: rgba(247, 181, 56, 0.2);
    color: var(--secondary, #f7b538);
}

/* Tema claro */
body.theme-light #custom-alert-box {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 20px 50px rgba(0,0,0,0.18);
}

body.theme-light #custom-alert-message {
    color: #0f172a;
}
