/* Estilos específicos para la página de carta/menú */

/* Estilos para secciones con imagen destacada */
/* Imagen en el lateral izquierdo */
.menu-section-with-image-left {
    position: relative;
    margin-bottom: 4rem;
    min-height: 320px; /* Altura mínima para evitar superposiciones */
    padding-bottom: 2rem; /* Espacio adicional al final de la sección */
}

@media (max-width: 768px) {
    /* Eliminamos altura mínima en móvil para evitar espacios en blanco */
    .menu-section-with-image-left,
    .menu-section-with-image-right,
    .menu-section-with-image {
        min-height: auto;
        padding-top: 1rem; /* Añadimos padding superior para dar más espacio al título */
    }
}

.menu-section-with-image-left .section-header {
    margin-bottom: 1.5rem;
}

.menu-section-with-image-left .menu-content {
    margin-left: 300px; /* Espacio para la imagen en el lateral izquierdo */
}

.menu-section-with-image-left .menu-image {
    position: absolute;
    left: 0;
    top: 50%; /* Centrado vertical */
    transform: translateY(-50%); /* Ajusta el centrado vertical */
    width: 280px;
    max-height: 280px; /* Limitar altura de la imagen */
}

/* Imagen en el lateral derecho */
.menu-section-with-image-right {
    position: relative;
    margin-bottom: 4rem;
    min-height: 320px; /* Altura mínima para evitar superposiciones */
    padding-bottom: 2rem; /* Espacio adicional al final de la sección */
}

.menu-section-with-image-right .section-header {
    margin-bottom: 1.5rem;
}

.menu-section-with-image-right .menu-content {
    margin-right: 300px; /* Espacio para la imagen en el lateral derecho */
}

.menu-section-with-image-right .menu-image {
    position: absolute;
    right: 0;
    top: 50%; /* Centrado vertical */
    transform: translateY(-50%); /* Ajusta el centrado vertical */
    width: 280px;
    max-height: 280px; /* Limitar altura de la imagen */
}

/* Estilos comunes para ambas variantes */
.menu-section-with-image {
    position: relative;
    margin-bottom: 4rem;
    min-height: 320px;
    padding-bottom: 2rem;
}

.menu-section-with-image .menu-image img,
.menu-section-with-image-left .menu-image img,
.menu-section-with-image-right .menu-image img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--primary-color);
    max-height: 280px;
    object-fit: cover;
}

@media (max-width: 768px) {
    /* Cambio radical: convertir todos los layouts a flexbox en columnas para móvil */
    .menu-section-with-image,
    .menu-section-with-image-left,
    .menu-section-with-image-right {
        display: flex;
        flex-direction: column;
        position: relative;
        margin-bottom: 6rem;
        min-height: auto; /* Quitamos altura mínima fija */
        padding-bottom: 3rem;
    }
    
    /* Orden de los elementos en móvil: siempre header > imagen > contenido */
    .menu-section-with-image .section-header,
    .menu-section-with-image-left .section-header,
    .menu-section-with-image-right .section-header {
        order: 1;
        position: relative;
        z-index: 5; /* Aseguramos que el título esté por encima */
        margin-bottom: 0; /* Eliminamos el margen inferior del encabezado */
    }
    
    /* Estilos adicionales para separar más el título */
    .menu-section-with-image h3,
    .menu-section-with-image-left h3,
    .menu-section-with-image-right h3 {
        margin-bottom: 0.5rem;
    }
    
    .menu-section-with-image .menu-image,
    .menu-section-with-image-left .menu-image,
    .menu-section-with-image-right .menu-image {
        order: 2;
        position: relative; /* Cambiamos de absolute a relative */
        left: auto;
        right: auto;
        top: auto;
        transform: none !important;
        width: 100%;
        max-width: 280px;
        margin: 5rem auto 0.5rem auto; /* Aumentamos aún más el margen superior para bajar las imágenes */
        text-align: center;
        z-index: 1; /* Aseguramos que la imagen esté por debajo del título */
    }
    
    .menu-section-with-image .menu-content,
    .menu-section-with-image-left .menu-content,
    .menu-section-with-image-right .menu-content {
        order: 3;
        margin-left: 0;
        margin-right: 0;
        margin-top: 0.5rem; /* Ajustamos el espacio entre la imagen y la lista de platos */
        padding-top: 0;
    }
    
    /* Ajustes estéticos */
    .menu-section h3 {
        font-size: 1.5rem;
        margin-bottom: 1.2rem;
    }
    
    #entradas, #criollos, #pescados, #chifa, #especiales, #promociones, #bebidas, #cervezas {
        margin-top: 3rem; /* Espaciado entre secciones */
    }
    
    /* Ajuste para mejorar legibilidad del texto */
    .menu-item-name, .menu-item-price {
        background-color: #000000;
        padding: 0 5px;
        z-index: 1;
    }
}

/* Clearfix para evitar superposiciones entre secciones */
.clearfix {
    clear: both;
    display: block;
    height: 20px; /* Espacio adicional entre secciones */
}

/* Estilo específico para la sección de desayunos - imagen bajada para evitar superposición con el título */
#desayunos .menu-image {
    top: calc(50% + 30px) !important; /* Bajada 30px para evitar superposición */
    transform: translateY(-50%) !important;
}

/* Estilo específico para la sección de entradas - imagen bajada */
#entradas .menu-image {
    top: calc(50% + 25px) !important; /* Bajada 25px */
    transform: translateY(-50%) !important;
}

/* Estilo específico para la sección de platos criollos - imagen bajada */
#criollos .menu-image {
    top: calc(50% + 25px) !important; /* Bajada 25px */
    transform: translateY(-50%) !important;
}

/* Estilo específico para la sección de promociones de pollo - imagen bajada */
#promociones .menu-image {
    top: calc(50% + 25px) !important; /* Bajada 25px */
    transform: translateY(-50%) !important;
}

/* Estilo específico para la sección de bebidas - imagen bajada */
#bebidas .menu-image {
    top: calc(50% + 25px) !important; /* Bajada 25px */
    transform: translateY(-50%) !important;
}

/* Estilo específico para la sección de cervezas - imagen bajada */
#cervezas .menu-image {
    top: calc(50% + 25px) !important; /* Bajada 25px */
    transform: translateY(-50%) !important;
}

/* Estilos específicos para secciones con problemas de superposición en móvil */
@media (max-width: 768px) {
    #desayunos .menu-image,
    #entradas .menu-image,
    #criollos .menu-image,
    #promociones .menu-image,
    #bebidas .menu-image,
    #cervezas .menu-image {
        margin-top: 7rem !important; /* Margen superior extra para estas secciones específicas */
    }
}

/* Ajustes adicionales para el modo móvil */
@media (max-width: 576px) {
    /* Ajustes para las secciones del menú */
    .menu-section-with-image,
    .menu-section-with-image-left,
    .menu-section-with-image-right {
        display: flex;
        flex-direction: column;
    }

    /* Contenedor para títulos independientes de la imagen */
    .menu-section-with-image .section-header,
    .menu-section-with-image-left .section-header,
    .menu-section-with-image-right .section-header {
        position: relative;
        width: 100%;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    /* Contenido del menú */
    .menu-section-with-image .menu-content,
    .menu-section-with-image-left .menu-content,
    .menu-section-with-image-right .menu-content {
        margin-top: 0.5rem;
    }
    
    .menu-section-with-image .menu-image img,
    .menu-section-with-image-left .menu-image img,
    .menu-section-with-image-right .menu-image img {
        max-height: 220px; /* Reducimos la altura máxima de las imágenes */
    }
    
    .menu-categories {
        gap: 0.5rem;
    }
    
    .category-btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }
}

body {
    background-color: #000000;
    color: #ffffff;
}

.menu-header {
    height: 40vh;
    background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../img/menu-header.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--light-color);
    margin-top: 80px;
    border-bottom: 1px solid var(--primary-color);
}

.menu-categories {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.category-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0;
}

.category-btn.active, .category-btn:hover {
    background-color: var(--primary-color);
    color: #000000;
}

.menu-section {
    margin-bottom: 3rem;
}

.menu-section h3 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    position: relative;
}

.menu-item-name {
    position: relative;
    padding-right: 10px;
    background-color: #000000;
    z-index: 1;
    display: flex;
    align-items: center;
    color: #ffffff;
    flex-wrap: nowrap;
    max-width: 75%; /* Evita que el nombre ocupe demasiado espacio */
}

.menu-item-name::before {
    content: '•';
    color: var(--primary-color);
    margin-right: 10px;
    font-weight: bold;
}

.menu-item-price {
    color: var(--primary-color);
    font-weight: bold;
    background-color: #000000;
    padding-left: 10px;
    z-index: 1;
    position: relative;
    white-space: nowrap; /* Evita que el precio se divida en múltiples líneas */
}

.menu-item::after {
    content: '';
    position: absolute;
    border-bottom: 1px dotted #444;
    width: 100%;
    left: 0;
    bottom: 6px;
    z-index: 0;
}

.menu-item-description {
    font-size: 0.85rem;
    color: #aaaaaa;
    font-style: italic;
    margin-top: 3px;
    margin-left: 15px;
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

.menu-note {
    font-style: italic;
    margin-bottom: 20px;
    color: #aaaaaa;
}

/* Mobile stacking fix: center images and prevent overlap */
@media (max-width: 768px) {
    .menu-section-with-image,
    .menu-section-with-image-left,
    .menu-section-with-image-right {
        align-items: center;
    }

    .menu-section-with-image .menu-image,
    .menu-section-with-image-left .menu-image,
    .menu-section-with-image-right .menu-image {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
        max-width: 320px;
        width: 100%;
        margin: 1.5rem auto 1rem auto !important;
        text-align: center;
    }

    .menu-section-with-image .menu-content,
    .menu-section-with-image-left .menu-content,
    .menu-section-with-image-right .menu-content {
        width: 100%;
        margin: 0;
    }
}
