/* ===== Paleta de marca Jalapeno's (tomada del logo) ===== */
:root {
    --logo-red: #C41517;         /* rojo del chile */
    --logo-red-soft: #E3494C;    /* rojo mas suave para acentos */
    --logo-green: #00732C;       /* verde de la palabra */
    --logo-green-bright: #BACF55;/* verde del tallo */
    --logo-amber: #E2A531;       /* amarillo mostaza del fondo del logo */
    --logo-amber-soft: #F0C463;  /* ambar mas claro */
    --logo-cream: #FFF7EC;       /* crema (contorno) */

    --text-dark: #3a2c22;        /* texto sobre superficies claras */
    --text-gray: #6b5f57;        /* texto secundario calido */
    --text-soft: #8a7a6d;        /* texto terciario calido */
    --surface-placeholder: #efe0c7; /* placeholder calido de imagenes */
    --border-warm: rgba(58, 44, 34, 0.15); /* bordes sutiles calidos */
    --shadow-warm: rgba(120, 78, 12, 0.28); /* sombra calida de tarjetas */
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    /* Fondo calido tipo food-truck mexicano: ambar del logo + blobs organicos */
    background-color: var(--logo-amber);
    background-image:
        radial-gradient(closest-side at 80% 12%, rgba(190, 132, 26, 0.55), transparent 72%),
        radial-gradient(closest-side at 12% 55%, rgba(190, 132, 26, 0.45), transparent 72%),
        radial-gradient(closest-side at 60% 85%, rgba(244, 200, 110, 0.40), transparent 70%);
    background-attachment: fixed;
    color: var(--text-dark);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--logo-cream);
    box-shadow: 0 4px 14px rgba(120, 78, 12, 0.18);
}

/* Header */
.header {
    border-bottom: 1px solid var(--border-warm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    height: 34px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-dark);
}

.logo-accent {
    color: var(--logo-green);
    font-weight: 700;
}

.header-title {
    font-size: 1rem;
    color: var(--text-gray);
    font-weight: 400;
}

.cart-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--logo-green);
    border-radius: 999px;
    background: rgba(0, 115, 44, 0.08);
    color: var(--logo-green);
    box-shadow: 0 2px 8px rgba(120, 78, 12, 0.15);
}

.cart-toggle-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.cart-toggle-count {
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 999px;
    background-color: var(--logo-red);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cart-toggle-count:not(.visible) {
    opacity: 0.3;
}

.cart-toggle:hover {
    background: rgba(0, 115, 44, 0.14);
}

/* Category Navigation */
.category-nav {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-warm);
}

.category-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 20px;
    max-width: 600px;
    margin: 0 auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

.category-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    border: 1px solid rgba(58, 44, 34, 0.25);
    border-radius: 25px;
    background-color: transparent;
    color: var(--text-gray);
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: rgba(58, 44, 34, 0.45);
    background-color: rgba(226, 165, 49, 0.15);
}

.category-btn.active {
    background-color: var(--logo-green);
    color: #ffffff;
    border-color: var(--logo-green);
    font-weight: 500;
    box-shadow: 0 3px 10px rgba(0, 115, 44, 0.35);
}

/* Product Container */
.product-container {
    padding-bottom: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.product-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Product Card */
.product-card {
    background-color: var(--logo-cream);
    border: none;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 18px var(--shadow-warm);
}

.product-card:active {
    transform: scale(0.98);
    box-shadow: 0 8px 22px rgba(120, 40, 10, 0.4);
}

.product-image-container {
    flex-shrink: 0;
    width: 110px;
    height: 110px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    background-color: var(--surface-placeholder);
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--logo-green);
    margin-bottom: 6px;
    line-height: 1.3;
}

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

.product-price {
    font-size: 1.1rem;
    font-weight: 800;
    font-style: italic;
    color: var(--logo-red);
}

.product-badge {
    display: inline-block;
    width: fit-content;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--logo-amber) 0%, var(--logo-amber-soft) 100%);
    color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(20, 15, 12, 0.25);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    gap: 12px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 247, 236, 0.6);
    border-top-color: var(--logo-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-indicator p {
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* End Message */
.end-message {
    text-align: center;
    padding: 30px;
    color: rgba(58, 44, 34, 0.6);
    font-size: 0.9rem;
}

/* Initial Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--logo-green);
    background-image:
        radial-gradient(closest-side at 80% 22%, rgba(0, 90, 34, 0.55), transparent 72%),
        radial-gradient(closest-side at 15% 78%, rgba(0, 90, 34, 0.45), transparent 72%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    padding: 20px;
}

.loading-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(0, 60, 22, 0.45);
    margin-bottom: 30px;
}

.loading-logo-icon {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(0, 60, 22, 0.4);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.03); }
}

.loading-bar-container {
    width: 200px;
    height: 6px;
    background-color: rgba(255, 247, 236, 0.4);
    border-radius: 3px;
    margin: 0 auto 20px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--logo-green-bright) 0%, var(--logo-amber-soft) 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.loading-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

/* Error Screen */
.error-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--logo-amber);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.error-content {
    text-align: center;
    padding: 20px;
}

.error-icon {
    width: 60px;
    height: 60px;
    border: 3px solid var(--logo-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    font-weight: bold;
    color: var(--logo-red);
}

.error-content h2 {
    color: var(--text-dark);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.error-content p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.retry-btn {
    padding: 12px 30px;
    background-color: var(--logo-green);
    color: #ffffff;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 115, 44, 0.35);
}

.retry-btn:hover {
    background-color: #008a36;
    box-shadow: 0 6px 18px rgba(0, 115, 44, 0.45);
}

/* Product Detail Modal */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--logo-cream);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
}

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

.modal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    justify-content: flex-end;
    padding: 16px;
    background: linear-gradient(to bottom, rgba(255, 247, 236, 0.95) 0%, transparent 100%);
}

.modal-close {
    width: 44px;
    height: 44px;
    border: 1px solid var(--logo-green);
    border-radius: 50%;
    background-color: rgba(255, 247, 236, 0.9);
    color: var(--logo-green);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(120, 78, 12, 0.25);
}

.modal-close:active {
    transform: scale(0.95);
    box-shadow: 0 4px 14px rgba(120, 78, 12, 0.35);
}

.modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-image-container {
    width: 100%;
    aspect-ratio: 1;
    max-height: 50vh;
    overflow: hidden;
    background-color: var(--surface-placeholder);
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info {
    flex: 1;
    padding: 24px 20px;
    background-color: var(--logo-cream);
    border-top: 1px solid var(--border-warm);
    box-shadow: 0 -5px 20px rgba(120, 78, 12, 0.12);
}

.modal-badge {
    display: none;
    width: fit-content;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, var(--logo-amber) 0%, var(--logo-amber-soft) 100%);
    color: var(--text-dark);
    box-shadow: 0 2px 10px rgba(20, 15, 12, 0.25);
}

.modal-badge.visible {
    display: inline-block;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--logo-green);
    margin-bottom: 16px;
    line-height: 1.3;
}

.modal-description {
    font-size: 1rem;
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-price {
    font-size: 1.8rem;
    font-weight: 800;
    font-style: italic;
    color: var(--logo-red);
    margin-bottom: 16px;
}

.modal-category {
    font-size: 0.85rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 24px;
}

.quantity-control {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    border: 1px solid rgba(58, 44, 34, 0.2);
    border-radius: 999px;
    overflow: hidden;
    background: #ffffff;
}

.quantity-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--logo-green);
    font-size: 1.4rem;
    font-weight: 600;
}

.quantity-value {
    min-width: 48px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.add-to-cart-btn,
.send-order-btn {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: 16px;
    background-color: var(--logo-green);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 115, 44, 0.35);
}

.add-to-cart-btn:disabled,
.send-order-btn:disabled {
    opacity: 0.5;
    box-shadow: none;
}

.cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 1002;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background: rgba(58, 44, 34, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cart-drawer.open {
    opacity: 1;
    visibility: visible;
}

.cart-drawer-panel {
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    background: var(--logo-cream);
    border-top: none;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 30px rgba(120, 78, 12, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-warm);
}

.cart-drawer-header h2 {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.cart-drawer-header p {
    font-size: 0.85rem;
    color: var(--text-gray);
    line-height: 1.4;
}

.cart-drawer-close {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(58, 44, 34, 0.2);
    border-radius: 50%;
    background: #ffffff;
    color: var(--text-dark);
    font-size: 1.3rem;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(58, 44, 34, 0.12);
    border-radius: 16px;
    background: #ffffff;
}

.cart-item-image {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-placeholder);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-info h3 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.cart-item-price {
    display: inline-block;
    color: var(--logo-red);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.cart-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-soft);
}

.remove-cart-item {
    border: none;
    background: transparent;
    color: var(--logo-red);
    font-size: 0.8rem;
    font-weight: 700;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cart-quantity-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--logo-green);
    border-radius: 50%;
    background: transparent;
    color: var(--logo-green);
    font-size: 1rem;
    font-weight: 700;
}

.cart-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 220px;
    padding: 24px 20px;
    text-align: center;
    color: var(--text-soft);
}

.cart-empty p {
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 600;
}

.cart-summary {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border-warm);
    background: linear-gradient(to top, var(--logo-cream) 0%, #fffdf6 100%);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-gray);
}

.cart-summary-row strong {
    color: var(--text-dark);
}

/* Safe area support for modal */
@supports (padding-top: env(safe-area-inset-top)) {
    .modal-header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .modal-info {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body.cart-open {
    overflow: hidden;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Image Loading Placeholder */
.product-image.loading {
    background: linear-gradient(90deg, #efe0c7 25%, #f7ecd9 50%, #efe0c7 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Adjustments */
@media screen and (max-width: 380px) {
    .header-content {
        padding: 14px 16px;
        gap: 10px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .logo-icon {
        height: 30px;
    }

    .logo-text {
        font-size: 0.95rem;
    }

    .cart-toggle {
        padding: 9px 12px;
    }

    .category-scroll {
        padding: 0 16px;
        gap: 8px;
    }

    .category-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .product-list {
        padding: 12px;
        gap: 12px;
    }

    .product-card {
        padding: 12px;
        gap: 12px;
    }

    .product-image-container {
        width: 90px;
        height: 90px;
    }

    .product-name {
        font-size: 1rem;
    }

    .product-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .product-price {
        font-size: 1rem;
    }

    .cart-drawer-header,
    .cart-items,
    .cart-summary {
        padding-left: 16px;
        padding-right: 16px;
    }

    .cart-item {
        align-items: flex-start;
    }

    .cart-item-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media screen and (min-width: 601px) {
    .product-card {
        padding: 20px;
    }

    .product-image-container {
        width: 130px;
        height: 130px;
    }

    .product-name {
        font-size: 1.2rem;
    }

    .modal-content {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }

    .cart-drawer-panel {
        border-radius: 24px 24px 0 0;
    }
}

/* Safe area for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: env(safe-area-inset-top);
    }

    .product-container {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }

    .cart-drawer-panel {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Touch feedback */
.category-btn:active,
.retry-btn:active {
    opacity: 0.8;
}

/* Prevent text selection on interactive elements */
.category-btn,
.product-card,
.retry-btn {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
