/* CSS Variables & Basic Reset */
:root {
    --primary-color: #FDB813; /* Amarillo/Dorado de la imagen */
    --background-dark: #1e1e1e; /* Fondo principal oscuro */
    --card-background: #2c2c2c; /* Fondo de tarjetas/secciones */
    --text-light: #f0f0f0;
    --text-secondary: #bdbdbd;
    --text-dark: #333; /* Para texto sobre fondos claros si es necesario */
    --font-title-main: 'Alfa Slab One', cursive;
    --font-title-sub: 'Oswald', sans-serif;
    --font-section-script: 'Lobster Two', cursive;
    --font-body: 'Montserrat', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--background-dark);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden; /* Evitar scroll horizontal por animaciones */
}

.hidden {
    display: none !important; /* Para ocultar inicialmente el contenido */
}

/* Loader / Splash Screen */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out 1.5s; /* Fade out after 1.5s delay */
}

#loader-logo {
    width: 100px; /* Ajusta según tu logo */
    height: 100px; /* Ajusta según tu logo */
    object-fit: contain;
    margin-bottom: 20px;
    animation: popIn 0.8s ease-out forwards;
}

.restaurant-title-loader {
    text-align: center;
    opacity: 0;
    animation: fadeInText 0.8s ease-out 0.5s forwards; /* Delay after logo pops */
}

.tasty-food-loader {
    font-family: var(--font-title-main);
    font-size: 3rem; /* Ajusta según necesidad */
    color: var(--primary-color);
    display: block;
    line-height: 1.1;
    letter-spacing: 1px;
}

.restaurant-text-loader {
    font-family: var(--font-title-sub);
    font-size: 1.5rem; /* Ajusta según necesidad */
    color: var(--text-light);
    letter-spacing: 5px; /* Como en la imagen de referencia */
    font-weight: 300;
    display: block;
    margin-top: -5px; /* Ajuste visual */
    text-transform: uppercase;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeInText {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

#loader-wrapper.fade-out {
    opacity: 0;
    pointer-events: none; /* Importante para que no bloquee clics después */
}


/* Header */
#main-header {
    /* background-color: var(--card-background); */ /* Opcional si quieres un fondo */
    padding: 15px 20px;
    text-align: center;
    /* Podrías querer mover el logo aquí después de la animación */
}

/* Main Content Sections */
main {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

section {
    margin-bottom: 40px;
    background-color: var(--card-background); /* Fondo para las secciones internas */
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.section-title-script {
    font-family: var(--font-section-script);
    color: var(--primary-color);
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 25px;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}
.section-title-script::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-color);
    opacity: 0.7;
}


/* Sugeridos Carousel (Historias) */
.carousel {
    display: flex;
    overflow-x: auto;
    padding-bottom: 15px;
    gap: 20px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}
.carousel::-webkit-scrollbar {
    height: 8px;
}
.carousel::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}
.carousel::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.sugerido-item {
    flex: 0 0 auto; /* No crecer, no encoger, base automática */
    width: 100px; /* Ancho de las "historias" */
    height: 100px; /* Alto de las "historias" */
    border-radius: 50%; /* Círculos */
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.sugerido-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.sugerido-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.sugerido-item:hover img {
    transform: scale(1.1);
}

.sugerido-item .sugerido-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: var(--text-light);
    font-size: 0.8em;
    text-align: center;
    padding: 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Categorías */
#categorias-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}

.categoria-principal, .subcategoria-item {
    background-color: rgba(255,255,255,0.1);
    color: var(--text-light);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.categoria-principal:hover, .subcategoria-item:hover {
    background-color: var(--primary-color);
    color: var(--background-dark);
    transform: translateY(-2px);
}

.categoria-principal.active, .subcategoria-item.active {
    background-color: var(--primary-color);
    color: var(--background-dark);
    font-weight: 700;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.subcategorias-lista {
    display: none; /* Ocultas por defecto, JS las maneja si decides implementarlas así */
    margin-top: 10px;
    padding-left: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.categoria-principal.open > .subcategorias-lista { /* Para mostrar subcategorías */
    display: flex;
}


/* Productos */
#productos-titulo {
    margin-top: 40px;
    margin-bottom: 25px;
}

#productos-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.producto-card {
    background-color: var(--card-background); /* Ya está en la sección, pero por si acaso */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1); /* Borde sutil */
}

.producto-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.producto-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.no-image { /* Estilo para cuando no hay imagen */
    width: 100%;
    height: 200px;
    background-color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-style: italic;
}

.producto-card-content {
    padding: 15px;
}

.producto-card h4 {
    font-size: 1.3em;
    margin-bottom: 8px;
    color: var(--text-light);
    font-weight: 700;
}

.producto-card p {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    min-height: 3.6em; /* Para 2-3 líneas de descripción */
    overflow: hidden;
    text-overflow: ellipsis;
    /* Para truncar a 2-3 líneas con CSS (limitado soporte): */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.price {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: auto; /* Empuja el precio abajo si la tarjeta usa flex */
}


/* Modal Styling */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px); /* Efecto difuminado */
    -webkit-backdrop-filter: blur(5px); /* Para Safari */
    animation: fadeInModalBg 0.3s ease;
}

.modal-content {
    background-color: var(--card-background);
    margin: 10% auto;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    animation: slideInModal 0.4s ease-out;
    color: var(--text-light);
}

.close-button {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    transition: color 0.2s ease;
}
.close-button:hover,
.close-button:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

#modal-img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}
.modal-content .no-image { /* No-image para el modal */
    height: 200px; /* O un valor adecuado para el modal */
    max-height: 300px;
    margin-bottom: 20px;
}

#modal-name {
    font-family: var(--font-section-script);
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}
#modal-description {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.7;
}
#modal-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-align: right;
}

@keyframes fadeInModalBg {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideInModal {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal.fade-out .modal-content {
    animation: slideOutModal 0.3s ease-in forwards;
}
.modal.fade-out {
    animation: fadeOutModalBg 0.3s ease-in forwards;
}
@keyframes slideOutModal {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(50px); opacity: 0; }
}
@keyframes fadeOutModalBg {
    from { opacity: 1; }
    to { opacity: 0; }
}


/* Footer */
#main-footer {
    background-color: var(--card-background);
    color: var(--text-secondary);
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    font-size: 0.9em;
}

/* Loading/Error Messages within sections */
.loading, .error-message {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: var(--text-secondary);
}
.error-message {
    color: #ff6b6b; /* Un color de error más distintivo */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .tasty-food-loader { font-size: 2.5rem; }
    .restaurant-text-loader { font-size: 1.2rem; }
    .section-title-script { font-size: 1.8rem; }

    #productos-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    .producto-card h4 { font-size: 1.1em; }
    .producto-card p { font-size: 0.85em; min-height: 3em; -webkit-line-clamp: 2; }

    .modal-content {
        width: 90%;
        margin: 15% auto;
        padding: 20px;
    }
    #modal-name { font-size: 1.6rem; }
    #modal-description { font-size: 0.9rem; }
}

@media (max-width: 480px) {
    .tasty-food-loader { font-size: 2rem; }
    .restaurant-text-loader { font-size: 1rem; }

    .sugerido-item { width: 80px; height: 80px; }
    .categoria-principal, .subcategoria-item { padding: 8px 15px; font-size: 0.8rem; }

    #productos-container {
        grid-template-columns: 1fr; /* Una columna en pantallas muy pequeñas */
    }
    .producto-card { margin-bottom: 15px; }
}