/* =========================================
   VARIABLES DE PALETAS DE COLORES POR GIRO
   ========================================= */
#demo-pizzeria {
    --primary-color: #1a1a1a;
    --accent-color: #e5a93d;
}
#demo-cafeteria {
    --primary-color: #3e2723;
    --accent-color: #d7ccc8;
}
#demo-carniceria {
    --primary-color: #212121;
    --accent-color: #d32f2f;
}
#demo-farmacia {
    --primary-color: #004d40;
    --accent-color: #80cbc4;
}

/* =========================================
   ESTILOS GENERALES Y MODERNIZACIÓN
   ========================================= */
:root {
    --text-color: #2d3748;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* =========================================
   SELECTOR MAESTRO Y SIMULADOR MÓVIL
   ========================================= */
.demo-switcher {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.switcher-btn {
    background: transparent;
    border: 2px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switcher-btn:hover {
    background-color: #f0f0f0;
}

.switcher-btn.active {
    background-color: #1a1a1a;
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* Botón Simulador de Celular */
.preview-btn {
    background: #1a1a1a;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    margin-left: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-btn:hover {
    background: #333;
}

.preview-btn.active {
    background: #e5a93d;
    color: #1a1a1a;
}

/* Ocultar botón de simulador en dispositivos que YA SON móviles */
@media (max-width: 768px) {
    .preview-btn {
        display: none !important;
    }
}

/* Envoltura Principal de la App (Para el Simulador) */
.app-wrapper {
    width: 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Clase para el Simulador Móvil */
.app-wrapper.mobile-mode {
    height: 75vh; 
    max-height: 850px; 
    min-height: 500px;
    aspect-ratio: 9 / 19; 
    
    /* LA SOLUCIÓN AL ANCHO: Forzamos a que respete la proporción y lo centramos */
    width: auto !important; 
    max-width: 450px; /* Límite de seguridad por si el aspect-ratio falla en algún navegador */
    margin: 2rem auto; 
    
    border-radius: 35px;
    box-shadow: 0 0 0 14px #1a1a1a, 0 20px 40px rgba(0,0,0,0.2);
    overflow-y: auto; 
    overflow-x: hidden;
    background-color: var(--bg-color);
    position: relative;
    
    /* OCULTAR BARRA DE SCROLL EN FIREFOX Y EDGE */
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}

/* OCULTAR BARRA DE SCROLL EN CHROME, SAFARI Y OPERA */
.app-wrapper.mobile-mode::-webkit-scrollbar {
    display: none;
}

/* Ajuste del menú pegajoso en el celular simulado */
.app-wrapper.mobile-mode .categories {
    top: 0;
}

/* Animación y visibilidad de Demos (CORREGIDO PARA EVITAR AMONTONAMIENTO) */
.demo-wrapper {
    display: none !important; 
    animation: slideUpFade 0.4s ease forwards;
}
.demo-wrapper.active {
    display: block !important; 
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Encabezado */
.header {
    text-align: center;
    background-color: var(--primary-color);
    color: white;
    padding: 5rem 1rem 4rem;
    position: relative;
}

.header.with-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.welcome-text {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    font-weight: 700;
}

.logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--accent-color);
    margin-bottom: 1.5rem;
    object-fit: cover;
    background-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}

/* =========================================
   NAVEGACIÓN Y TOGGLE (DISEÑO APP)
   ========================================= */
.categories {
    display: flex;
    flex-direction: column; /* Toggle debajo de los botones */
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 61px; /* Altura del demo-switcher */
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    z-index: 100;
}

.cat-links {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 0.2rem;
}
.cat-links::-webkit-scrollbar {
    display: none;
}

.cat-link {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    background-color: #f1f3f5;
    transition: all 0.3s ease;
}

.cat-link:hover, .cat-link:active {
    background-color: var(--primary-color);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Toggle Switch Estilo iOS / App Nativa */
.view-toggle {
    display: flex;
    background-color: #e9ecef; 
    border-radius: 30px;
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.toggle-btn {
    background: transparent;
    border: none;
    border-radius: 26px;
    padding: 6px 16px;
    font-size: 1rem;
    color: #868e96;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn.active {
    background: #ffffff;
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* =========================================
   TARJETAS DE MENÚ (VISTA LISTA)
   ========================================= */
.menu-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

.menu-section h2 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.menu-item {
    display: flex;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.02);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item img {
    width: 140px;
    height: 140px; 
    object-fit: cover; 
    border-radius: 16px 0 0 16px; 
}

.item-details {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-header h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.price {
    font-weight: 700;
    color: var(--primary-color);
    background-color: var(--accent-color);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 1rem;
    display: inline-block;
    margin-bottom: 0.5rem;
    align-self: flex-start;
}

.item-details p {
    font-size: 0.9rem;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================
   VISTA DE CUADRÍCULA (GRID VIEW)
   ========================================= */
.menu-section.grid-view .menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.menu-section.grid-view .menu-item {
    flex-direction: column;
    margin-bottom: 0;
    height: 100%;
}

.menu-section.grid-view .menu-item img {
    width: 100%;
    height: 180px; 
    border-radius: 16px 16px 0 0; 
}

/* Pie de página */
.footer {
    padding: 4rem 1rem;
    background-color: var(--primary-color);
    color: #ffffff;
    text-align: center;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    margin-top: 2rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
    transform: translateY(-5px);
}

/* =========================================
   RESPONSIVIDAD MÓVIL (EXPERIENCIA 100% APP)
   ========================================= */
/* =========================================
   RESPONSIVIDAD MÓVIL Y SIMULADOR EN PC
   ========================================= */
/* 1. Reglas para dispositivos móviles reales */
@media (max-width: 600px) {
    .menu-item { flex-direction: row; height: 120px; }
    .menu-item img { width: 110px; height: 100%; border-radius: 16px 0 0 16px; }
    .item-details { padding: 0.8rem; }
    .item-header h3 { font-size: 0.95rem; line-height: 1.2; }
    .price { font-size: 0.85rem; padding: 0.1rem 0.5rem; }
    .item-details p { font-size: 0.75rem; -webkit-line-clamp: 2; line-clamp: 2; }
    
    .menu-section.grid-view .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
    .menu-section.grid-view .menu-item { flex-direction: column; height: 100%; }
    .menu-section.grid-view .menu-item img { width: 100%; height: 110px; border-radius: 16px 16px 0 0; }
}

/* 2. Reglas idénticas para FORZAR la vista móvil dentro del Simulador en PC */
.app-wrapper.mobile-mode .menu-item { flex-direction: row; height: 120px; }
.app-wrapper.mobile-mode .menu-item img { width: 110px; height: 100%; border-radius: 16px 0 0 16px; }
.app-wrapper.mobile-mode .item-details { padding: 0.8rem; }
.app-wrapper.mobile-mode .item-header h3 { font-size: 0.95rem; line-height: 1.2; }
.app-wrapper.mobile-mode .price { font-size: 0.85rem; padding: 0.1rem 0.5rem; }
.app-wrapper.mobile-mode .item-details p { font-size: 0.75rem; -webkit-line-clamp: 2; line-clamp: 2; }

.app-wrapper.mobile-mode .menu-section.grid-view .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
.app-wrapper.mobile-mode .menu-section.grid-view .menu-item { flex-direction: column; height: 100%; }
.app-wrapper.mobile-mode .menu-section.grid-view .menu-item img { width: 100%; height: 110px; border-radius: 16px 16px 0 0; }