﻿/* ============================================
   RESET Y ESTILOS GLOBALES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Spartan', Arial, Helvetica, sans-serif;
    background: #f0ebeb;
    min-height: 100vh;
    color: #232323;
    line-height: 1.4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    width: 100vw;
    max-width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    position: relative;
    background: #fff url('../img/header.webp') center center / cover no-repeat;
    background-image: image-set(url('../img/header.webp') type('image/webp'), url('../img/header.png') type('image/png'));
    padding: 70px 0 56px;
    border-radius: 0 0 12px 12px;
    margin-bottom: 32px;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 12px 12px;
}

.header-content,
.header-text {
    position: relative;
    z-index: 1;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 220px;
    text-align: center;
}

.header-logo {
    height: 120px;
    object-fit: contain;
    flex-shrink: 0;
    mix-blend-mode: multiply;
}

.header-text {
    color: #fff;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7), 0 1px 0 #000;
}

.header-text h1 {
    font-size: 2.6em;
    font-weight: 700;
}

.header-text p {
    font-size: 1.2em;
    color: #FFF;
}

.google-address {
    font-size: 0.9em;
    color: #FFF;
}

.google-address-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

.google-address-link:hover {
    text-decoration: underline;
}

.google-address-icon {
    width: 1.4em;
    height: 1.4em;
    flex-shrink: 0;
    color: #EA4335;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.google-rating {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(0, 0, 0, 0.40);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 4px 10px 0 10px;
    margin-bottom: 20px;
    color: #FFF;
    font-size: 0.95em;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

.lang-switcher {
    position: absolute;
    top: 12px;
    right: 16px;
    display: flex;
    gap: 5px;
    z-index: 2;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    background: rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    color: #fff;
    font-size: 0.75em;
    font-weight: 500;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.2s, border-color 0.2s;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.lang-btn-active {
    background: rgba(255, 255, 255, 0.38);
    border-color: rgba(255, 255, 255, 0.75);
    font-weight: 700;
    cursor: default;
}

.lang-flag {
    font-size: 1.1em;
    line-height: 1;
}

.lang-code {
    letter-spacing: 0.02em;
}

@media (max-width: 480px) {
    .lang-switcher { top: 8px; right: 8px; gap: 4px; }
    .lang-code     { display: none; }
    .lang-btn      { padding: 4px 6px; }
}

.google-rating-score {
    font-weight: 700;
    font-size: 1em;
    line-height: 1;
}

.google-rating-stars {
    font-size: 1em;
    letter-spacing: 1px;
    color: #FFD700;
    line-height: 1;
}

.half-star {
    display: inline-block;
    overflow: hidden;
    width: 7px;
    vertical-align: top;
}

.google-rating-count {
    font-size: 0.85em;
    opacity: 0.85;
}

.google-rating-sep {
    opacity: 0.5;
    font-size: 0.85em;
}

.google-rating-link {
    font-size: 0.82em;
    color: #FFF;
    text-decoration: none;
    white-space: nowrap;
}

.google-rating-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ============================================
   CONTROLES (BUSQUEDA Y FILTROS)
   ============================================ */

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
    position: relative;
}

.search-box {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.35em;
    color: #999;
    pointer-events: none;
    z-index: 2;
}

.search-box input {
    width: 100%;
    padding: 15px 20px 15px 44px;
    border: 1.5px solid #e0e0e0;
    border-radius: 32px;
    background: #fafbfc;
    font-size: 1em;
    transition: border-color 0.3s, background 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #bdbdbd;
    background: #fff;
}

.search-box input::placeholder {
    color: #999;
}

.btn-reset {
    width: 50px;
    height: 50px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #f2f2f2;
    color: #232323;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.btn-reset:hover {
    background: #fff;
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 50px;
    border: none;
    border-radius: 32px;
    background: #f2f2f2;
    color: #232323;
    font-size: 1em;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

.btn-filter:hover {
    background: #fff;
}

.btn-filter-active {
    background: #232323 !important;
    color: #fff !important;
}

.btn-filter-active:hover {
    background: #444 !important;
}

.filter-wrapper {
    position: relative;
}

.alergenos-filter-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.13);
    padding: 10px 12px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 100%;
    max-height: 320px;
    overflow-y: auto;
}

.alergenos-panel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 2px 0;
}

.alergenos-panel-item input[type="checkbox"] {
    accent-color: #232323;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.alergenos-panel-item .alergeno-item {
    transition: opacity 0.2s;
}

/* ============================================
   MENU
   ============================================ */

main.menu {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 40px;
    padding-bottom: 8px;
    overflow: hidden;
}

.menu-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 28px 0;
    margin-bottom: 12px;
}

.menu-loader.is-hidden,
.google-rating.is-hidden,
.menu.is-hidden,
.alergenos-filter-panel.is-hidden {
    display: none;
}

.spinner {
    display: flex;
    gap: 7px;
    align-items: center;
}

.spinner::before,
.spinner::after,
.spinner span {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #555;
    animation: dot-bounce 1s ease-in-out infinite;
}

.spinner::before { animation-delay: 0s; }
.spinner span    { animation-delay: 0.15s; }
.spinner::after  { animation-delay: 0.3s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.4; }
    40%            { transform: translateY(-10px); opacity: 1;   }
}

.menu-info-footer {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    color: #555;
    font-size: 1em;
}

.menu-info-title {
    font-weight: 500;
    color: #232323;
}

.no-results.menu-info-footer {
    border-top: 1.5px solid #e0e0e0;
}

/* ============================================
   CATEGORIAS
   ============================================ */

.categoria {
    background: transparent;
    transition: background 0.18s;
}

.categoria:hover {
    background: #f3f3f3;
}

.categoria-header {
    /* reset de estilos nativos de <button> */
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 0;
    width: 100%;
    text-align: left;
    font-family: inherit;
    /* estilos propios */
    background: #fff;
    color: #232323;
    padding: 14px 22px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 1.13em;
    user-select: none;
    border-bottom: 1.5px solid #e0e0e0;
    transition: background 0.18s;
}

.categoria-header:hover {
    background: #f7f7f7;
}

.toggle-icon {
    font-size: 24px;
    line-height: 24px;
    transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
}

.categoria.active .toggle-icon {
    transform: rotate(180deg);
}

.productos {
    background: #fcfcfd;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(.4, 0, .2, 1), opacity 0.35s cubic-bezier(.4, 0, .2, 1);
}

.categoria.active .productos {
    display: flex;
    flex-direction: column;
    opacity: 1;
    max-height: 2000px;
}

/* ============================================
   PRODUCTOS
   ============================================ */

.producto {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 18px 10px 18px 24px;
    min-height: 80px;
}

.producto:nth-child(even) {
    background: #f8f8f8;
}

.producto-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1 1 0%;
    min-width: 0;
}

.producto-nombre {
    font-size: 1.08em;
    font-weight: 500;
    margin-bottom: 2px;
    line-height: 1.2;
}

.producto-descripcion {
    font-size: 0.97em;
    color: #6d6d6d;
    margin-bottom: 6px;
    line-height: 1.4;
    max-width: 420px;
}

.producto-precio {
    font-size: 0.8em;
    font-weight: 500;
    margin-top: 2px;
}

.producto-imagen {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
    margin-left: 24px;
    flex-shrink: 0;
}

/* ============================================
   ALERGENOS
   ============================================ */

.alergenos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.8em;
}

.alergenos-label {
    font-weight: 500;
    margin-right: 5px;
}

/* Colores estandar UE 1169/2011 */
.alergeno-item {
    display: inline-block;
    padding: 4px 6px 2px;
    margin: 2px 4px 2px 0;
    border-radius: 12px;
    font-size: 0.7em;
    line-height: 1em;
    font-weight: 500;
    color: #fff;
    background: #666;
    vertical-align: middle;
    transition: background 0.2s, color 0.2s;
}

.alergeno-gluten          { background: #F37139 !important; }
.alergeno-crustaceos      { background: #1AB7F1 !important; }
.alergeno-huevo           { background: #F7902C !important; }
.alergeno-pescado         { background: #2941A0 !important; }
.alergeno-cacahuetes      { background: #C17144 !important; }
.alergeno-soja            { background: #03A65B !important; }
.alergeno-leche           { background: #6D361D !important; }
.alergeno-frutosdecascara { background: #D94850 !important; }
.alergeno-apio            { background: #54BF36 !important; }
.alergeno-mostaza         { background: #C09427 !important; }
.alergeno-sesamo          { background: #9B8E6B !important; }
.alergeno-sulfitos        { background: #80104D !important; }
.alergeno-moluscos        { background: #4FC3D0 !important; }
.alergeno-altramuces      { background: #FADE3E !important; color: #232323 !important; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .header {
        padding: 30px 15px;
        border-radius: 0 0 15px 15px;
        margin-bottom: 25px;
    }

    .header-text h1 {
        font-size: 1.5em;
    }

    .header-text p {
        font-size: 0.85em;
    }

    .categoria-header {
        padding: 12px 15px;
        font-size: 1em;
    }

    .producto {
        padding: 10px 5px 10px 10px;
        min-height: 60px;
    }

    .producto-nombre,
    .producto-precio {
        font-size: 1em;
    }

    .producto-imagen {
        width: 48px;
        height: 48px;
        margin-left: 10px;
    }

    .alergenos {
        font-size: 0.8em;
    }
}

/* ============================================
   ERROR BLOCK
   ============================================ */

.error-container {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(220, 38, 38, 0.35);
    border-radius: 10px;
    padding: 24px 28px;
    margin: 32px auto;
    max-width: 560px;
}

.error-icon {
    font-size: 2em;
    line-height: 1;
    flex-shrink: 0;
}

.error-message h3 {
    margin: 0 0 6px;
    font-size: 1.1em;
    font-weight: 600;
    color: #b91c1c;
}

.error-message p {
    margin: 0;
    font-size: 0.95em;
    color: #555;
}
