/* ==========================================================================
   tienda.css  -  Estilos de la página de catálogo (Cavi Hogar)
   Se carga DESPUÉS de style.css, por lo que complementa / pisa lo necesario.
   Usa la variable global --primary definida en style.css.
   ========================================================================== */

.tienda-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 14px 60px;
    font-family: 'Quicksand', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;            /* mejor comportamiento en Safari iPhone */
    box-sizing: border-box;
}

.tienda-section h2 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.9rem;
}

.tienda-subtitle {
    margin-bottom: 28px;
    color: #bdb49a;
    font-size: 1rem;
}

/* ============================  BARRA DE FILTROS  ========================== */

.filter-bar {
    background: #151207;
    padding: 18px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    margin-bottom: 32px;
    border: 1px solid #3d3514;
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: flex-end;
    box-sizing: border-box;
}

.filter-bar label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 7px;
    color: var(--primary);
    text-transform: uppercase;
}

.input-busqueda-contenedor {
    flex: 1 1 280px;
    min-width: 220px;
    position: relative;
}

/* Lupa dentro del buscador */
.input-busqueda-contenedor::after {
    content: "🔍";
    position: absolute;
    right: 16px;
    bottom: 12px;
    font-size: 15px;
    opacity: 0.6;
    pointer-events: none;
}

.filter-select-wrapper {
    flex: 1 1 170px;
    min-width: 150px;
    position: relative;
}

/* Flechita custom de los select */
.filter-select-wrapper::after {
    content: "▾";
    position: absolute;
    right: 16px;
    bottom: 11px;
    color: var(--primary);
    font-size: 14px;
    pointer-events: none;
}

.filter-bar input[type="text"],
.filter-bar select {
    width: 100%;
    padding: 12px 38px 12px 16px;
    background: #1e1a0a;
    border: 1px solid #4a3f18;
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    color: #f5f0db;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.filter-bar input[type="text"]::placeholder {
    color: #8a8164;
}

.filter-bar input[type="text"]:focus,
.filter-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(244, 162, 97, 0.18);
}

.filter-bar select {
    cursor: pointer;
}

.filter-bar select option {
    background: #1e1a0a;
    color: #f5f0db;
}

/* Contador de resultados */
.resultados-info {
    color: #9c937a;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ===============================  GRILLA  ================================= */

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
}

.card.item-producto {
    text-align: left;
    padding: 14px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    background: #2d270f;
    border: 1px solid #3d3514;
    border-radius: 16px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card.item-producto:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.badge-destacado {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #151207;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 800;
    border-radius: 20px;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ----------------------------  CARRUSEL  --------------------------------- */

.carousel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;          /* todas las fotos cuadradas y parejas */
    background: #151207;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 1;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;            /* recorta sin deformar -> prolijo */
    display: block;
}

.img-placeholder {
    width: 100%;
    height: 100%;
    background: #1e1a0a;
    border: 2px dashed #4a3f18;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6347;
    font-size: 14px;
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(21, 18, 7, 0.78);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.carousel-container:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow:hover {
    background: var(--primary);
    color: #151207;
}

.carousel-arrow.prev { left: 8px; }
.carousel-arrow.next { right: 8px; }

/* En touch las flechas siempre visibles (no hay hover) */
@media (hover: none) {
    .carousel-arrow { opacity: 1; }
}

/* ----------------------------  TEXTOS CARD  ------------------------------ */

.txt-categoria {
    font-size: 12px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.producto-titulo {
    margin: 5px 0 8px;
    font-size: 1.2rem;
    color: #fff;
    line-height: 1.25;
}

.producto-descripcion {
    font-size: 13.5px;
    color: #c4bca3;
    margin-bottom: 14px;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-footer-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    gap: 10px;
}

.producto-precio {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.35rem;
    white-space: nowrap;
}

.btn-comprar {
    padding: 10px 16px;
    font-size: 14px;
    width: auto;
    background: var(--primary);
    color: #151207;
    border: none;
    border-radius: 22px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: filter 0.2s, transform 0.1s;
}

.btn-comprar:hover { filter: brightness(1.08); }
.btn-comprar:active { transform: scale(0.96); }

/* ============================  PAGINADOR  ================================ */

.paginacion-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
}

.paginacion-wrapper button {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #2d270f;
    border: 1px solid #4a3f18;
    color: #f5f0db;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.paginacion-wrapper button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.paginacion-wrapper button.activo {
    background: var(--primary);
    border-color: var(--primary);
    color: #151207;
    cursor: default;
}

.paginacion-wrapper button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.paginacion-wrapper .puntos-suspensivos {
    color: #8a8164;
    padding: 0 4px;
}

/* ===========================  MENSAJE VACÍO  ============================= */

.msg-alerta-filtros {
    grid-column: 1 / -1;
    text-align: center;
    width: 100%;
    padding: 50px 0;
    color: #8a8164;
    font-size: 15px;
}

/* ===============================  MODAL  ================================= */

#fotoModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 14px;
    box-sizing: border-box;
}

#fotoModal.abierto { display: flex; }

.modal-body-wrapper {
    background: #2d270f;
    border: 1px solid #3d3514;
    width: 100%;
    max-width: 920px;
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    position: relative;
    max-height: 92vh;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    color: #f5f0db;
    background: rgba(0, 0, 0, 0.45);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    z-index: 5;
    transition: background 0.2s;
}

.modal-close-btn:hover { background: var(--primary); color: #151207; }

.modal-visual-column {
    position: relative;
    background: #151207;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}

.modal-visual-column img {
    width: 100%;
    height: 100%;
    object-fit: contain;          /* en el modal se ve la foto COMPLETA */
    max-height: 92vh;
}

.modal-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-nav-arrow:hover { background: var(--primary); color: #151207; }
#modalPrevBtn { left: 14px; }
#modalNextBtn { right: 14px; }

#modalContador {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 12px;
    border-radius: 20px;
}

.modal-info-column {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: 'Quicksand', sans-serif;
    text-align: left;
    box-sizing: border-box;
}

#modalProdCategoria {
    font-size: 12px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
    letter-spacing: 0.4px;
}

#modalProdNombre {
    color: #fff;
    font-size: 1.55rem;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.2;
}

#modalProdPrecio {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.6rem;
    margin-bottom: 18px;
}

.modal-descripcion-container {
    border-top: 1px solid #3d3514;
    padding-top: 16px;
    margin-bottom: 22px;
}

.modal-descripcion-container h4 {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

#modalProdDescripcion {
    font-size: 14px;
    color: #f5f0db;
    line-height: 1.55;
    white-space: pre-line;
}

#modalBtnAgregarCarrito {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    background: var(--primary);
    color: #151207;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    margin-top: auto;
    font-family: inherit;
    transition: filter 0.2s;
}

#modalBtnAgregarCarrito:hover { filter: brightness(1.08); }

/* ============================  BOTÓN CARRITO  =========================== */

.carrito-btn-float {
    position: fixed;
    bottom: 99px;
    right: 24px;
    background: #2A9D8F;
    color: #fff;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    text-decoration: none;
    z-index: 99998;
    box-sizing: border-box;
    transition: transform 0.2s;
    margin-bottom: env(safe-area-inset-bottom);
}

.carrito-btn-float:hover { transform: scale(1.08); }

/* ===============================  TOAST  ================================= */

#toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 360px;
}

.toast {
    background: #2d270f;
    border: 1px solid var(--primary);
    border-left: 5px solid var(--primary);
    color: #f5f0db;
    padding: 13px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    width: 100%;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================  RESPONSIVE  ============================== */

@media (max-width: 768px) {
    .modal-body-wrapper {
        grid-template-columns: 1fr;
        max-height: 95vh;
    }
    .modal-visual-column {
        min-height: auto;
        max-height: 45vh;
    }
    .modal-visual-column img { max-height: 45vh; }
    .modal-info-column { padding: 20px 18px; }
}

@media (max-width: 600px) {
    .filter-bar { padding: 16px; gap: 14px; }
    .input-busqueda-contenedor,
    .filter-select-wrapper {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .grid-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }
    .card.item-producto { min-width: 0; }
    .card-footer-action { flex-wrap: wrap; }
    .producto-titulo { font-size: 1rem; }
    .producto-precio { font-size: 1.15rem; }
    .btn-comprar { padding: 9px 12px; font-size: 13px; }
}

@media (max-width: 380px) {
    .grid-container { grid-template-columns: 1fr; }
}
