/* 
 * EL CASTILLO DEL SABOR - PREMIUM DESIGN SYSTEM
 * Concept: Premium Fun (High Contrast, Vibrant Colors, Modern UI)
 */

:root {
    /* Brand Colors extracted from Logo */
    --brand-red: #E63946;
    /* CTA, Precios, Acentos Fuertes */
    --brand-gold: #FFB703;
    /* Estrellas, Iconos, Detalles */
    --brand-blue: #14213D;
    /* Fondos profundos */
    --brand-cream: #F1FAEE;
    /* Texto claro alternativo */

    /* UI Colors */
    --bg-main: #0a0a0a;
    /* Fondo Principal (casi negro) */
    --bg-card: #141414;
    /* Tarjetas */
    --bg-card-hover: #1a1a1a;
    /* Tarjetas Hover */
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;

    /* Effects */
    --card-radius: 24px;
    --btn-radius: 50px;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 8px 30px -5px rgba(230, 57, 70, 0.25);
    --border-subtle: 1px solid rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    /* overflow-x: hidden REMOVED because it breaks position:sticky scrolling on iOS Safari */
    /* Fondo sutil con patrón o degradado */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(230, 57, 70, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 183, 3, 0.05) 0%, transparent 20%);
}

/* ================= HEADER ================= */
.app-header {
    text-align: center;
    padding: 0 20px 0;
    /* Sin padding arriba */
    position: relative;
    z-index: 10;
}

.logo-container {
    max-width: 210px;
    /* Un pelín más pequeño */
    margin: 0 auto -65px;
    /* Margen negativo INTENSO */
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.5));
}

.logo-img {
    width: 100%;
    height: auto;
    display: block;
}

.app-header p {
    color: var(--brand-gold);
    /* Dorado para resaltar */
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    font-weight: 400;
    /* Un poco más grueso */
    font-style: italic;
    /* Cursiva elegante */
    margin-top: 0;
    margin-bottom: 12px;
    position: relative;
    z-index: 11;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    /* Sombra para lectura */
}

/* ================= CATEGORIES (Sticky) ================= */
.category-container {
    position: sticky;
    top: 10px;
    z-index: 100;
    margin: 10px 0 10px;
    /* Reduced bottom margin to bring subcategories closer to main categories */
    padding: 0 10px;
}

/* Glassmorphism Container */
.category-filter {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    /* Closer together */
    padding: 8px;
    background: rgba(20, 33, 61, 0.4);
    /* Brand Blue tinted glass */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 50px;
    /* Full pill shape */
    border: 1px solid rgba(255, 255, 255, 0.1);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* Crucial for iOS scroll */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    /* HW Acceleration for iOS Safari repaint bug */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    max-width: 600px;
    margin: 0 auto;
    align-items: center;
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.category-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    /* Pill interior */
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy spring */
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

@media (hover: hover) {
    .category-btn:hover {
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.08);
    }
}

.category-btn.active {
    background: linear-gradient(135deg, var(--brand-red) 0%, #c1121f 100%);
    color: white;
    box-shadow: 0 6px 16px rgba(230, 57, 70, 0.5);
    transform: scale(1.02);
}

/* ================= GRID ================= */
.menu-grid {
    display: grid;
    /* Optimizado para móviles: min 135px permite 2 columnas en pantallas de 360px+ */
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 15px;
    padding: 0 15px 80px;
    /* Más espacio abajo para scroll cómodo en móvil */
    max-width: 1000px;
    margin: 0 auto;
}

/* ================= CARD DESIGN ================= */
.menu-item {
    background-color: var(--bg-card);
    border-radius: var(--card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: var(--border-subtle);
    position: relative;
    height: 100%;
}

@media (hover: hover) {
    .menu-item:hover {
        transform: translateY(-8px);
        background-color: var(--bg-card-hover);
        box-shadow: var(--shadow-glow);
        border-color: rgba(230, 57, 70, 0.3);
    }
}

/* Placeholder / Image Area */
.placeholder-img {
    width: 100%;
    height: 140px;
    background: radial-gradient(circle at center, #252525, #151515);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    position: relative;
}

/* Emoji Background Glow */
.placeholder-img::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--brand-gold);
    filter: blur(30px);
    opacity: 0.15;
    border-radius: 50%;
}

.item-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.item-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Descripcion eliminada */
.item-desc {
    display: none;
}

.bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 4px;
}

.item-price {
    font-size: 1.1rem;
    color: var(--brand-gold);
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* .add-btn — estilos movidos a cards_list.css */

/* ================= ANIMATIONS ================= */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
        scale: 0.95;
    }

    to {
        opacity: 1;
        transform: translateY(0);
        scale: 1;
    }
}

.menu-item {
    animation: fadeIn 0.25s ease backwards;
}

/* Staggered animation delay handled in JS or simplified here */
.menu-item:nth-child(1) {
    animation-delay: 0.02s;
}

.menu-item:nth-child(2) {
    animation-delay: 0.04s;
}

.menu-item:nth-child(3) {
    animation-delay: 0.06s;
}

.menu-item:nth-child(4) {
    animation-delay: 0.08s;
}

.menu-item:nth-child(5) {
    animation-delay: 0.1s;
}

/* Responsive */
@media (min-width: 768px) {
    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 30px;
    }

    .placeholder-img {
        height: 180px;
    }

    .app-header {
        padding-top: 50px;
    }
}

/* ================= LOADER INITIAL (Skeleton) ================= */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-main);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: opacity 0.5s ease;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 183, 3, 0.2);
    border-top-color: var(--brand-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}