/* ==========================================================================
   POSIT CONTROL — UNIVERSAL MULTI-COMMERCE DESIGN SYSTEM
   Modern, Clean, Spacious & Adaptable to Any Industry
   ========================================================================== */

:root {
    /* Neutral & Modern Canvas Tokens */
    --bg-body: var(--color-bg);
    --bg-surface: var(--color-card);
    --bg-surface-subtle: var(--color-bg);
    --bg-surface-hover: var(--color-bg);

    /* Brand & Accent Neutrals */
    --brand-dark: var(--color-dark);
    --brand-primary: var(--color-dark);
    --brand-accent: var(--color-dark);
    --brand-accent-hover: var(--color-dark);
    --brand-accent-light: var(--color-bg);
    --brand-accent-border: var(--color-line);

    /* Typography Colors */
    --text-heading: var(--color-dark);
    --text-body: var(--color-dark);
    --text-muted: var(--color-text-muted);
    --text-light: var(--color-card);
    --text-light-muted: var(--color-line);
    --price-color: var(--color-dark);

    /* Status Colors */
    --success: var(--color-ok);
    --success-bg: var(--color-ok-bg);
    --success-border: var(--color-ok-bg);

    /* Borders & Outlines */
    --border-subtle: var(--color-line);
    --border-medium: var(--color-line);
    --border-focus: var(--color-dark);

    /* Radii */
    --radius-xl: 12px;
    --radius-lg: 12px;
    --radius-md: 10px;
    --radius-sm: 10px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: var(--font-sans);
    --font-mono: 'JetBrains Mono', monospace;

    /* Shadows */
    --shadow-subtle: 0 1px 3px color-mix(in srgb, var(--color-dark) 4%, transparent), 0 1px 2px color-mix(in srgb, var(--color-dark) 2%, transparent);
    --shadow-card: 0 4px 12px -2px color-mix(in srgb, var(--color-dark) 5%, transparent), 0 2px 6px -1px color-mix(in srgb, var(--color-dark) 3%, transparent);
    --shadow-card-hover: 0 10px 24px -4px color-mix(in srgb, var(--color-dark) 8%, transparent), 0 4px 10px -2px color-mix(in srgb, var(--color-dark) 4%, transparent);
    --shadow-floating: 0 12px 30px -4px color-mix(in srgb, var(--color-dark) 12%, transparent), 0 4px 10px -2px color-mix(in srgb, var(--color-dark) 4%, transparent);
    --shadow-sheet: 0 -8px 30px color-mix(in srgb, var(--color-dark) 18%, transparent);
    --menu-page-gutter: clamp(1rem, 2.5vw, 3rem);
}

/* --- BASE RESETS --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-body);
    color: var(--text-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- PRELOADER LIMPIO --- */
#loader {
    position: fixed;
    inset: 0;
    background-color: var(--color-dark);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    transition: opacity 0.35s ease, visibility 0.35s;
}

.loader-spinner-box {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-spinner {
    position: absolute;
    inset: 0;
    border: 3px solid color-mix(in srgb, var(--color-card) 10%, transparent);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-icon {
    font-size: 1.5rem;
    color: var(--color-card);
}

.loader-brand {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-card);
    letter-spacing: 1px;
}

.loader-brand span {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--color-accent);
    letter-spacing: 2.5px;
    display: block;
    text-align: center;
    margin-top: 3px;
    font-weight: 700;
}

/* --- HEADER / HERO BANNER --- */
.store-header-container {
    position: relative;
    background-color: var(--brand-dark);
    background-size: cover;
    background-position: center;
    color: var(--text-light);
    padding: 3rem var(--menu-page-gutter) 4rem;
    border-bottom: 1px solid var(--border-subtle);
    overflow: hidden;
}

.header-overlay-ambient {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--color-dark) 84%, transparent);
    pointer-events: none;
}

.store-header-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
}

.store-branding {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.store-logo-wrapper {
    position: relative;
}

.store-logo {
    width: 86px;
    height: 86px;
    border-radius: var(--radius-xl);
    background: var(--color-card);
    border: 3px solid var(--color-card);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--color-dark) 25%, transparent);
    color: var(--brand-dark);
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    flex-shrink: 0;
}

.store-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.posit-partner-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: color-mix(in srgb, var(--color-card) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-card) 20%, transparent);
    color: var(--color-card);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 0.4rem;
    backdrop-filter: blur(8px);
}

.posit-partner-badge i {
    color: var(--color-accent);
}

.store-name {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--color-card);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.store-address {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-light-muted);
}

.store-address i {
    color: var(--color-accent);
}

.store-contacts {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: color-mix(in srgb, var(--color-card) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-card) 15%, transparent);
    border-radius: var(--radius-lg);
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.contact-item i {
    font-size: 0.95rem;
    color: var(--color-accent);
}

.contact-item:hover {
    background: color-mix(in srgb, var(--color-card) 18%, transparent);
    border-color: color-mix(in srgb, var(--color-card) 35%, transparent);
    transform: translateY(-2px);
}

.social-channels {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.social-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--color-card) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-card) 15%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.social-icon-btn:hover {
    background: var(--color-card);
    color: var(--brand-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-dark) 15%, transparent);
}

/* --- BARRA FLOTANTE DE MODALIDAD Y HORARIOS --- */
.delivery-status-card {
    width: 100%;
    margin: -1.75rem auto 1.5rem auto;
    padding: 0 var(--menu-page-gutter);
    position: relative;
    z-index: 10;
}

.delivery-toggle-group {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    box-shadow: var(--shadow-floating);
}

.delivery-toggle-option {
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.delivery-toggle-option i {
    font-size: 1.05rem;
}

.delivery-toggle-option:hover {
    color: var(--text-heading);
    background: var(--bg-surface-subtle);
}

.delivery-toggle-option.active {
    background: var(--brand-dark);
    color: var(--color-card);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-dark) 18%, transparent);
}

.delivery-toggle-option.active i {
    color: var(--color-accent);
}

.delivery-details-row {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    color: var(--text-muted);
    box-shadow: var(--shadow-subtle);
}

.status-indicator-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.badge-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.badge-status-pill.closed {
    background: var(--color-closed-bg);
    border-color: var(--color-line);
    color: var(--color-closed);
}

.badge-status-pill.closed .pulse-dot {
    background-color: var(--color-closed);
    animation: none;
}

.badge-status-pill.unknown {
    background: var(--color-bg);
    border-color: var(--color-line);
    color: var(--color-text-muted);
}

.badge-status-pill.unknown .pulse-dot {
    background-color: var(--color-closed);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--success);
    animation: statusPulse 1.8s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.8; }
}

.hours-text {
    font-weight: 400;
}

.estimated-time-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.time-label {
    font-weight: 700;
    color: var(--text-heading);
}

.delivery-time-select {
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-subtle);
    color: var(--text-body);
    font-size: 0.82rem;
    font-weight: 400;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
}

.delivery-time-select:focus {
    border-color: var(--brand-dark);
}

/* --- MAIN APP DUAL-COLUMN LAYOUT --- */
.menu-app-wrapper {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--menu-page-gutter) 4rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(360px, 27vw, 440px);
    gap: clamp(1.25rem, 2vw, 2.25rem);
    align-items: start;
}

.menu-discovery {
    grid-column: 1 / -1;
    min-width: 0;
}

/* --- COLUMNA DE CATÁLOGO --- */
.menu-catalog-column {
    min-width: 0;
}

/* Smart Search Bar */
.search-container {
    margin-bottom: 1.25rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.25rem 0.5rem;
    box-shadow: var(--shadow-subtle);
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-dark) 8%, transparent);
}

.search-box i {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-left: 0.75rem;
}

.search-box input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 0.65rem 0.75rem;
    font-size: 0.92rem;
    color: var(--text-heading);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* --- GRILLA COMPLETA DE CATEGORÍAS EN DESKTOP --- */
.category-section-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-subtle);
}

.category-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.category-header-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-swipe-hint {
    display: none;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.category-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.category-count-badge {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-surface-subtle);
    color: var(--text-body);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* Categorías amplias y visibles en escritorio */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    min-height: 54px;
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.category-tab-icon {
    font-size: 0.95rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.category-tab-name {
    font-family: var(--font-sans);
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-body);
    overflow-wrap: anywhere;
}

.category-tab:focus-visible {
    outline: 3px solid var(--brand-accent);
    outline-offset: 2px;
}

.category-tab:hover {
    border-color: var(--border-medium);
    background: var(--color-card);
    color: var(--text-heading);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px color-mix(in srgb, var(--color-dark) 4%, transparent);
}

.category-tab.active {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-dark) 15%, transparent);
}

.category-tab.active .category-tab-name {
    color: var(--color-card);
}

.category-tab.active .category-tab-icon {
    color: var(--color-accent);
}

/* --- PRODUCT SECTIONS & CARDS --- */
.menu-sections {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
}

.menu-section {
    scroll-margin-top: 70px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
}

/* Tarjeta de Producto Universal */
.product-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-subtle);
}

.product-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.product-name {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.3;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    background: var(--brand-accent-light);
    color: var(--brand-accent);
    border: 1px solid var(--brand-accent-border);
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

.product-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    gap: 0.5rem;
}

.product-price {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--price-color);
    letter-spacing: -0.3px;
}

/* Botón Universal "+ Agregar" */
.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-heading);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-btn i {
    font-size: 0.85rem;
}

.add-btn:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: var(--color-card);
    transform: scale(1.02);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--color-dark) 15%, transparent);
}

/* Imagen del Producto */
.product-img-wrapper {
    width: 95px;
    height: 95px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}
