/**
 * ==============================================================================
 * SISTEMA DE ESTILOS MODULARES - DESPACHO EN .COM
 * ==============================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800;900&display=swap');

:root {
    --brand-primary: #145A32;
    --brand-secondary: #E67E22;
    --brand-bg: #F7F8FA;
    --brand-surface: #FFFFFF;
    --brand-text: #1B2430;
    --brand-muted: #6B7280;
    --brand-border: #E7EAEE;

    --whatsapp-green: #25D366;
    --whatsapp-dark: #128C7E;

    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --shadow-sm: 0 1px 2px rgba(17,24,32,0.06);
    --shadow-md: 0 6px 16px -4px rgba(17,24,32,0.12), 0 2px 6px -2px rgba(17,24,32,0.06);
    --shadow-lg: 0 20px 40px -12px rgba(17,24,32,0.18), 0 6px 12px -4px rgba(17,24,32,0.08);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--brand-bg);
    color: var(--brand-text);
    font-family: var(--font-body);
    line-height: 1.55;
    min-height: 100vh;
    padding-bottom: 90px;
    -webkit-font-smoothing: antialiased;
}

.store-title,
.product-title,
.list-item-title,
.story-overlay h2 {
    font-family: var(--font-heading);
    letter-spacing: -0.2px;
}

/* Estado vacío reutilizable (sin productos, sin categorías, etc.) */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 56px 24px;
    color: var(--brand-muted);
    background: var(--brand-surface);
    border: 1px dashed var(--brand-border);
    border-radius: var(--radius-lg);
}

.empty-state .empty-icon {
    font-size: 34px;
    margin-bottom: 10px;
    opacity: 0.7;
}

.empty-state .empty-title {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--brand-text);
    font-size: 15px;
    margin-bottom: 4px;
}

.empty-state .empty-desc {
    font-size: 13px;
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Insignia de verificación junto al nombre del comercio */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-primary);
    background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    vertical-align: middle;
}

/* ==============================================================================
 * 1. HEADER & STORE IDENTITY
 * ============================================================================== */
.store-header {
    background: var(--brand-surface);
    border-bottom: 1px solid var(--brand-border);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.store-header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.store-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--brand-text);
}

.store-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--brand-primary);
}

.store-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
}

.store-badge {
    font-size: 10.5px;
    color: var(--brand-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.store-socials {
    display: flex;
    gap: 8px;
}

.social-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-bg);
    color: var(--brand-text);
    text-decoration: none;
    font-size: 15px;
    transition: transform .15s ease, background .15s;
}

.social-btn:hover {
    transform: scale(1.08);
    background: var(--brand-primary);
    color: #FFF;
}

/* ==============================================================================
 * 2. CATEGORY PILLS & VIEW MODE SWITCHER
 * ============================================================================== */
.toolbar-container {
    max-width: 1000px;
    margin: 15px auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.category-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

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

.category-pill {
    padding: 9px 18px;
    border-radius: var(--radius-full);
    background: var(--brand-surface);
    color: var(--brand-muted);
    border: 1px solid var(--brand-border);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
    text-decoration: none;
}

.category-pill.active, .category-pill:hover {
    background: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
    box-shadow: 0 4px 10px -2px color-mix(in srgb, var(--brand-primary) 45%, transparent);
}

.view-mode-selector {
    display: flex;
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 4px;
}

.view-mode-btn {
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--brand-muted);
    font-weight: 600;
    transition: all .15s ease;
}

.view-mode-btn.active {
    background: var(--brand-primary);
    color: #FFF;
}

/* ==============================================================================
 * 3. LAYOUT 1: MODO GRID / TARJETAS VISUALES (1:1)
 * ============================================================================== */
.products-grid-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

@media (max-width: 500px) {
    .products-grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 8px 12px;
    }
}

.product-card {
    background: var(--brand-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--brand-primary) 30%, var(--brand-border));
}

.product-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #E5E7EB;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}

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

.product-badge-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: #FFF;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
}

.product-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc {
    font-size: 12px;
    color: var(--brand-muted);
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.product-price {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    color: var(--brand-primary);
}

.btn-add-cart {
    padding: 8px 14px;
    background: var(--brand-primary);
    color: #FFF;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    box-shadow: 0 3px 8px -2px color-mix(in srgb, var(--brand-primary) 55%, transparent);
}

.btn-add-cart:hover {
    opacity: 0.94;
    transform: translateY(-1px);
}

/* ==============================================================================
 * 4. LAYOUT 2: MODO LISTA COMPACTA (Ferreterías / Menús)
 * ============================================================================== */
.products-list-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item-card {
    background: var(--brand-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-border);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.list-item-thumb {
    width: 65px;
    height: 65px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

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

.list-item-title {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-desc {
    font-size: 12px;
    color: var(--brand-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--brand-primary);
    flex-shrink: 0;
    text-align: right;
}

/* ==============================================================================
 * 5. LAYOUT 3: MODO HISTORIAS SOCIALES (9:16 Inmersivo)
 * ============================================================================== */
.stories-slider-container {
    max-width: 480px;
    margin: 10px auto;
    padding: 0 16px;
    position: relative;
}

.story-card-916 {
    background: #000;
    border-radius: var(--radius-lg);
    aspect-ratio: 9 / 16;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.story-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.88;
}

.story-overlay {
    position: relative;
    z-index: 2;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
    padding: 24px 20px;
    color: #FFF;
}

.story-grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: rgba(255,255,255,0.12);
    padding: 8px;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(8px);
    margin: 12px 0;
    font-size: 11px;
    text-align: center;
}

/* ==============================================================================
 * 6. BARRA FLOTANTE & CARRITO DE PEDIDO POR WHATSAPP
 * ============================================================================== */
.floating-bar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    background: #111B21;
    color: #FFF;
    border-radius: var(--radius-full);
    padding: 10px 10px 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 16px 34px rgba(0,0,0,0.38);
    z-index: 999;
    border: 1px solid #222E35;
    animation: floatBarIn .25s ease-out;
}

@keyframes floatBarIn {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.floating-cart-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-count-badge {
    background: var(--whatsapp-green);
    color: #000;
    font-weight: 800;
    font-size: 12px;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-total-amount {
    font-size: 15px;
    font-weight: 700;
    color: #FFF;
}

.btn-whatsapp-order {
    background: linear-gradient(135deg, var(--whatsapp-green), var(--whatsapp-dark));
    color: #FFF;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(37,211,102,0.3);
}

/* ==============================================================================
 * 7. MODAL DE PEDIDO Y CONFIRMACIÓN
 * ============================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-backdrop.active {
    display: flex;
}

.modal-sheet {
    background: var(--brand-surface);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px 20px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp .25s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--brand-bg);
    color: var(--brand-text);
}

.btn-confirm-order {
    width: 100%;
    padding: 14px;
    background: var(--whatsapp-green);
    color: #000;
    font-size: 15px;
    font-weight: 800;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
