/* ========================================
   MENU.CSS - LAYOUT, FILTROS Y TARJETAS V10
   ======================================== */

/* --- 1. LAYOUT GENERAL --- */
.menu-layout {
    display: flex;
    max-width: 1200px;
    margin: 40px auto;
    gap: 30px;
    padding: 0 20px;
    position: relative;
    align-items: flex-start; /* Evita que el sidebar se estire */
}

/* --- 2. SIDEBAR DE FILTROS --- */
.sidebar-filters {
    width: 250px;
    flex-shrink: 0;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    height: fit-content;
    position: sticky;
    top: 100px; /* Sticky desktop */
    z-index: 100;
}

.filter-group {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.filter-group h4 {
    color: #5e1c26;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    align-items: center;
}

.clear-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.sidebar-filters label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.sidebar-filters input[type='checkbox'] {
    accent-color: #5e1c26;
    margin-right: 8px;
    width: 16px;
    height: 16px;
}

/* Inputs de búsqueda y precio */
.search-wrapper {
    position: relative;
}
.search-input {
    width: 100%;
    padding: 10px 35px 10px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.filter-select {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
}
.btn-reset-all {
    width: 100%;
    padding: 10px;
    background: #eee;
    border: none;
    border-radius: 6px;
    color: #555;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: 0.3s;
}
.btn-reset-all:hover {
    background: #e0e0e0;
    color: #333;
}

/* Elementos móviles ocultos en desktop */
.mobile-filter-btn,
.sidebar-header-mobile,
.btn-apply-mobile {
    display: none;
}

/* Toggles especiales (Switch) */
.toggle-row {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 10px;
}
.toggle-row input {
    display: none;
}
.slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: 0.4s;
}
.slider:before {
    position: absolute;
    content: '';
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.4s;
}
input:checked + .slider {
    background-color: #5e1c26;
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* --- 3. GRILLA DE PRODUCTOS --- */
.products-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); /* Ajustado para mejor fit */
    gap: 25px;
    align-content: start;
    width: 100%;
}

/* --- 4. ESTILOS TARJETA V10 (CARTA + ÍCONOS CONSECUTIVOS) --- */
:root {
    --vino: #5e1c26;
    --crema: #fffac2;
    --blanco: #ffffff;
    --shadow-card: 0 10px 20px rgba(0, 0, 0, 0.08);
}

/* Contenedor Tipo Carta */
.product-card-container {
    background-color: var(--blanco);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    width: 100%;
    /* max-width removido para que llene la grilla */
    font-family: 'Montserrat', sans-serif;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative; /* Importante para posicionamiento */
}

.product-card-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

/* Imagen y Overlay */
.card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.product-card-container:hover .card-image-wrapper img {
    transform: scale(1.08);
}

/* Overlay Color Vino */
.overlay-hover {
    position: absolute;
    inset: 0;
    background: rgba(94, 28, 38, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}
.product-card-container:hover .overlay-hover,
.overlay-hover.visible {
    opacity: 1;
}

/* Íconos (Badges) */
/* --- CORRECCIÓN EN MENU.CSS --- */
.badges-row {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
    z-index: 30; /* <--- CAMBIAR ESTO A 30 (Antes era 10) */
}

/* Asegúrate también de que el tooltip tenga un z-index alto */
.tooltip-text {
    /* ... resto de propiedades ... */
    z-index: 40; /* <--- Aseguramos que el texto flote sobre todo */
}
.icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: help;
    position: relative;
}

.tooltip-container {
    background: var(--crema);
    color: var(--vino);
}
.offer-badge {
    background: var(--vino);
    color: var(--crema);
}

/* Tooltip */
.tooltip-text {
    visibility: hidden;
    background-color: var(--vino);
    color: var(--crema);
    text-align: center;
    padding: 6px 10px;
    border-radius: 6px;
    position: absolute;
    z-index: 30;
    top: 0;
    left: 115%;
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.tooltip-text::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    margin-top: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent var(--vino) transparent transparent;
}
.icon-badge:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Contenido de Texto */
.card-info-content {
    padding: 15px 20px 20px;
    text-align: left;
}

.card-info-content h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
    font-weight: 700;
    line-height: 1.3;
}

.meta-info {
    font-size: 0.75rem;
    color: #999;
    margin: 5px 0 10px;
    letter-spacing: 0.5px;
    font-weight: 600;
    text-transform: uppercase;
}

.price-row {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--vino);
    display: flex;
    align-items: center;
}
.price-old {
    text-decoration: line-through;
    color: #ccc;
    font-size: 0.9rem;
    margin-right: 8px;
    font-weight: 400;
}

/* Botones dentro de la tarjeta */
.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80%;
}

.btn-card-solid {
    background-color: var(--crema);
    color: var(--vino);
    border: 2px solid var(--crema);
    padding: 10px;
    border-radius: 50px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    font-size: 0.95rem;
    transition: transform 0.2s;
    display: block;
}
.btn-card-solid:hover {
    transform: scale(1.05);
}

.btn-card-outline {
    background: transparent;
    color: var(--crema);
    border: 2px solid var(--crema);
    padding: 10px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
}
.btn-card-outline:hover {
    background: rgba(255, 250, 194, 0.2);
}

/* Texto Agotado */
.soldout-text {
    color: var(--crema);
    font-size: 1.5rem;
    font-weight: 900;
    border: 3px solid var(--crema);
    padding: 10px 30px;
    transform: rotate(-10deg);
}
.product-card-container.sold-out .card-image-wrapper img {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* --- 5. RESPONSIVE MOBILE --- */
@media (max-width: 800px) {
    .menu-layout {
        flex-direction: column;
        padding: 0 15px;
        margin-top: 20px;
    }

    /* Botón flotante o superior para abrir filtros */
    .mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 12px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        font-weight: 600;
        color: #5e1c26;
        margin-bottom: 20px;
        cursor: pointer;
    }

    /* Sidebar móvil (Off-canvas) */
    .sidebar-filters {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        z-index: 5000;
        border-radius: 0;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: block;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar-filters.active {
        transform: translateX(0);
    }

    .sidebar-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
    }

    .sidebar-header-mobile h3 {
        margin: 0;
        color: #5e1c26;
    }

    .close-filters {
        background: none;
        border: none;
        font-size: 28px;
        color: #333;
        cursor: pointer;
        padding: 0 5px;
    }

    .btn-apply-mobile {
        display: block;
        width: 100%;
        margin-top: 15px;
        padding: 15px;
        background: #5e1c26;
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
    }
}

/* Añade esto a tu CSS si no existe */
.product-card-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}
.product-card-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
}
.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.3s;
}
.product-card-container:hover .card-image-wrapper img {
    transform: scale(1.05);
}

.card-info-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.card-info-content h3 {
    margin: 0 0 5px;
    font-size: 16px;
    color: #5e1c26;
    line-height: 1.3;
}
.meta-info {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.price-row {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}
.price-main {
    font-size: 18px;
    font-weight: 800;
    color: #5e1c26;
}
.price-old {
    font-size: 14px;
    text-decoration: line-through;
    color: #aaa;
}
.price-main.offer {
    color: #d35400;
}

.btn-card-outline {
    width: 100%;
    padding: 10px;
    border: 2px solid #5e1c26;
    background: transparent;
    color: #5e1c26;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-card-outline:hover {
    background: #5e1c26;
    color: white;
}

.soldout-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #555;
    font-size: 20px;
    letter-spacing: 2px;
}
.sold-out {
    opacity: 0.8;
    filter: grayscale(0.8);
}

/* --- BOTÓN AGOTADO (DISEÑO COHERENTE) --- */
.btn-card-disabled {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0; /* Mismo grosor que el activo */
    background: #f9f9f9; /* Fondo muy sutil */
    color: #999; /* Texto gris */
    font-weight: 700;
    border-radius: 8px; /* Mismo radio */
    cursor: not-allowed;
    font-size: 1rem; /* Mismo tamaño de letra */
    text-transform: uppercase; /* Mismo estilo de texto */
    transition: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Opcional: Imagen en escala de grises si está agotado */
.product-card-container.sold-out .card-image-wrapper img {
    filter: grayscale(100%);
    opacity: 0.8;
}
