/* Stayu Food ERP — Landing pública post-QR
   Diseño intuitivo para público general (incluye 50+ años):
   - Botones enormes (56px+) y textos grandes (16-18px base)
   - Alto contraste, jerarquía visual clara
   - Mobile-first responsive
   - Escapa cualquier container del theme con width:100vw + margin negativos */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --accent: #ff5a1f;
    --accent-hover: #ea4c14;
    --accent-soft: #fff5f0;
    --success: #22c55e;
    --success-hover: #16a34a;
    --danger: #ef4444;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.22);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --safe-top: env(safe-area-inset-top, 0);
    --base-font: 17px; /* más grande que 16px para legibilidad */
}

/* ============ Reset + escape de theme ============ */
.sf-landing, .sf-landing * {
    box-sizing: border-box;
}
.sf-landing {
    /* ESCAPA cualquier container del theme:
       - Si el padre es display:block, esto se ve como width:100%
       - Si el padre es display:grid, grid-column:1/-1 ocupa TODAS las columnas
       - Si el padre es display:flex, width:100% funciona igual */
    display: block;
    width: 100%;
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--base-font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 110px; /* espacio para cart bar fija */
    overflow-x: hidden;
}

/* ============ HERO ============ */
.sf-hero {
    position: relative;
    width: 100%;
    min-height: 280px;
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
    overflow: hidden;
    color: #fff;
}
.sf-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sf-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.65) 100%);
}
.sf-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 720px;
    margin: 0 auto;
    padding: calc(20px + var(--safe-top)) 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sf-hero-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.sf-hero-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    flex-shrink: 0;
}
.sf-hero-logo-fallback {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--accent);
    display: grid;
    place-items: center;
    font-size: 32px;
    flex-shrink: 0;
}
.sf-hero-name {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.sf-hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    width: fit-content;
    padding: 4px 12px;
    border-radius: 999px;
}
.sf-hero-status.is-open {
    background: rgba(34, 197, 94, 0.95);
    color: #fff;
}
.sf-hero-status.is-closed {
    background: rgba(239, 68, 68, 0.95);
    color: #fff;
}
.sf-hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: sf-pulse 1.8s ease-in-out infinite;
}
@keyframes sf-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.sf-hero-meta {
    margin: 0;
    font-size: 15px;
    opacity: 0.95;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.sf-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.sf-hero-chip {
    background: rgba(255,255,255,0.95);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* ============ BUSCADOR ============ */
.sf-search-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    padding: 14px 16px 4px;
    width: 100%;
}
.sf-search-wrap {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 0 16px;
    height: 56px;
    box-shadow: var(--shadow);
    transition: border-color 0.15s;
}
.sf-search-wrap:focus-within {
    border-color: var(--accent);
}
.sf-search-icon {
    font-size: 18px;
    margin-right: 10px;
    color: var(--muted);
}
.sf-search {
    flex: 1;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 17px;
    color: var(--text);
    outline: none;
    height: 100%;
    min-width: 0;
}
.sf-search::placeholder { color: var(--muted); }

/* ============ CHIPS DE CATEGORÍAS ============ */
.sf-cat-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 16px 14px;
    scrollbar-width: none;
    background: var(--bg);
    position: sticky;
    top: 70px;
    z-index: 25;
}
.sf-cat-nav::-webkit-scrollbar { display: none; }
.sf-cat-chip {
    flex-shrink: 0;
    height: 44px;
    padding: 0 18px;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.sf-cat-chip:hover { border-color: var(--accent); }
.sf-cat-chip-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ============ MENÚ LISTADO ============ */
.sf-menu {
    max-width: 720px;
    margin: 0 auto;
    padding: 8px 16px 24px;
}
.sf-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 17px;
}

.sf-cat {
    margin-bottom: 28px;
}
.sf-cat-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.3px;
}
.sf-cat-desc {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--muted);
}
.sf-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============ ITEM CARD — para 50+ años ============ */
.sf-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: stretch;
    box-shadow: var(--shadow);
    transition: border-color 0.15s;
}
.sf-item:hover { border-color: var(--accent); }

.sf-item-open {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    align-items: center;
    min-width: 0;
}
.sf-item-img {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--surface-2);
    display: block;
}
.sf-item-img-fallback {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    display: grid;
    place-items: center;
    font-size: 36px;
}
.sf-item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.sf-item-name {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
}
.sf-item-desc {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sf-item-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-top: 4px;
}

/* Botón + enorme para que un señor de 50 años no falle el tap */
.sf-item-add {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: 0;
    font-size: 32px;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(255, 90, 31, 0.4);
    transition: transform 0.1s, background 0.15s;
    align-self: center;
}
.sf-item-add:active {
    background: var(--accent-hover);
    transform: scale(0.92);
}

/* ============ BOTTOM BAR (carrito) ============ */
.sf-cart-bar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(16px + var(--safe-bottom));
    z-index: 40;
    animation: sf-cart-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sf-cart-in {
    from { transform: translateY(140%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.sf-cart-bar-btn {
    width: 100%;
    background: #0f172a;
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font: inherit;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
    min-height: 64px;
}
.sf-cart-bar-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}
.sf-cart-bar-count { font-size: 13px; opacity: 0.7; }
.sf-cart-bar-count strong { font-weight: 800; font-size: 15px; }
.sf-cart-bar-total { font-size: 20px; font-weight: 800; }
.sf-cart-bar-action {
    background: var(--accent);
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
}

/* ============ MODAL ============ */
.sf-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: end center;
    padding: 0;
}
@media (min-width: 640px) {
    .sf-modal { place-items: center; padding: 16px; }
}
/* hidden wins over display:grid */
.sf-modal[hidden] { display: none !important; }

.sf-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: sf-fade 0.2s ease-out;
}
@keyframes sf-fade { from { opacity: 0; } to { opacity: 1; } }

.sf-modal-card {
    position: relative;
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: sf-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}
@media (min-width: 640px) {
    .sf-modal-card {
        border-radius: 24px;
        max-height: 88vh;
    }
}
.sf-modal-card-wide { max-width: 520px; }
.sf-modal-card-narrow { max-width: 380px; padding: 32px 24px; border-radius: 24px; }
@keyframes sf-pop {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.sf-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    z-index: 5;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Modal: item */
.sf-modal-img-wrap {
    background: #1f2937;
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.sf-modal-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sf-modal-body {
    padding: 24px 20px 20px;
    overflow-y: auto;
}
.sf-modal-name {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}
.sf-modal-price {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 6px 14px;
    border-radius: 10px;
    display: inline-block;
}
.sf-modal-desc {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}
.sf-modal-add {
    width: 100%;
    background: #0f172a;
    color: #fff;
    border: 0;
    padding: 18px;
    border-radius: 14px;
    font: inherit;
    font-weight: 800;
    font-size: 17px;
    cursor: pointer;
    min-height: 60px;
}
.sf-modal-add:active { background: #1e293b; }
.sf-modal-h {
    margin: 0 0 18px;
    font-size: 22px;
    font-weight: 800;
}

/* Quantity stepper */
.sf-qty-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 20px;
}
.sf-qty-label { font-weight: 700; font-size: 16px; }
.sf-qty-stepper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sf-qty-btn {
    width: 44px;
    height: 44px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 50%;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text);
    display: grid;
    place-items: center;
}
.sf-qty-btn:active { background: var(--accent); color: #fff; border-color: var(--accent); }
.sf-qty-num {
    font-size: 22px;
    font-weight: 800;
    min-width: 30px;
    text-align: center;
}

/* Cart lines */
.sf-cart-lines {
    max-height: 280px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 4px 0;
    margin-bottom: 16px;
}
.sf-cart-line {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
    font-size: 15px;
}
.sf-cart-line:last-child { border-bottom: 0; }
.sf-cart-line-qty {
    background: var(--accent);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    min-width: 36px;
    text-align: center;
}
.sf-cart-line-name {
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
}
.sf-cart-line-subtotal { font-weight: 800; min-width: 80px; text-align: right; }
.sf-cart-line-remove {
    background: transparent;
    border: 0;
    color: var(--danger);
    cursor: pointer;
    font-size: 22px;
    padding: 0 4px;
    line-height: 1;
}
.sf-cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0 18px;
    font-size: 18px;
}
.sf-cart-total-row strong { font-size: 22px; }

.sf-cart-form { display: flex; flex-direction: column; gap: 14px; }
.sf-cart-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.sf-cart-select, .sf-cart-input, .sf-cart-textarea {
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 14px;
    font: inherit;
    font-size: 17px;
    color: var(--text);
    outline: none;
    width: 100%;
    min-height: 56px;
    transition: border-color 0.15s, background 0.15s;
}
.sf-cart-select:focus, .sf-cart-input:focus, .sf-cart-textarea:focus {
    border-color: var(--accent);
    background: var(--surface);
}
.sf-cart-textarea { resize: vertical; min-height: 70px; padding: 14px; }
.sf-cart-submit {
    width: 100%;
    background: var(--success);
    color: #fff;
    border: 0;
    padding: 18px;
    border-radius: 14px;
    font: inherit;
    font-weight: 800;
    font-size: 18px;
    cursor: pointer;
    margin-top: 6px;
    min-height: 64px;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}
.sf-cart-submit:active { background: var(--success-hover); }
.sf-cart-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Thanks */
.sf-center { text-align: center; }
.sf-thanks-icon {
    font-size: 72px;
    margin-bottom: 16px;
    line-height: 1;
}
.sf-muted { color: var(--muted); }

/* ============ Responsive fine-tuning ============ */
@media (max-width: 380px) {
    .sf-hero-name { font-size: 26px; }
    .sf-hero-logo, .sf-hero-logo-fallback { width: 56px; height: 56px; }
    .sf-item-img, .sf-item-img-fallback { width: 76px; height: 76px; }
    .sf-item-add { width: 50px; height: 50px; font-size: 28px; }
    .sf-item-name { font-size: 16px; }
}

@media (min-width: 1024px) {
    /* En desktop, el cart bar puede ser un poco más compacto */
    .sf-cart-bar { max-width: 720px; left: 50%; transform: translateX(-50%); }
    .sf-modal-card { max-height: 85vh; }
}

/* ============ Language switcher (ES/EN) ============ */
.sf-hero-lang {
    position: absolute;
    top: 14px;
    right: 16px;
    display: flex;
    gap: 6px;
    z-index: 5;
}
.sf-lang-pill {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    display: grid;
    place-items: center;
    font-size: 18px;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.sf-lang-pill:hover { transform: scale(1.08); }
.sf-lang-pill.sf-lang-active {
    border-color: var(--accent);
    background: #fff;
}

/* ============ Print ============ */
@media print {
    .sf-search-bar, .sf-cat-nav, .sf-cart-bar, .sf-modal, .sf-item-add { display: none !important; }
    .sf-item { break-inside: avoid; }
}
