/* ============================================================
   ESTILOS FRONTEND - TIENDA
   Diseño unificado basado en el sistema Luvis + portada Q Venedor
   ============================================================ */

:root {
    --primary:     #e74c3c;   /* sobreescrito por PHP desde config */
    --dark:        #444b52;
    --beige:       #c5a980;
    --text:        #333333;
    --text-light:  #777777;
    --border:      #eeeeee;
    --bg-light:    #f8f8f8;
    --white:       #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; color: var(--text); background: var(--white); line-height: 1.6; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── HEADER ──────────────────────────────────────────────── */
header {
    padding: 0;
    border-bottom: 1px solid var(--border);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    font-weight: 700;
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo img { height: 44px; width: auto; object-fit: contain; }
.logo span { color: var(--primary); }

/* Nav principal */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 6px;
    align-items: center;
}
.main-nav a {
    display: block;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #444;
    border-radius: 3px;
    transition: background .2s, color .2s;
}
.main-nav a:hover { background: var(--bg-light); color: var(--primary); }

/* Dropdown categorías */
.nav-item { position: relative; }
.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    z-index: 200;
}
.nav-dropdown a {
    display: block;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    border-bottom: 1px solid var(--border);
}
.nav-dropdown a:last-child { border-bottom: none; }
.nav-item:hover .nav-dropdown { display: block; }

/* Iconos cabecera */
.header-icons {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 16px;
    color: #555;
}
.header-icons a { color: #555; transition: color .2s; }
.header-icons a:hover { color: var(--primary); }

/* ── BREADCRUMB ──────────────────────────────────────────── */
.breadcrumb-section {
    background: var(--bg-light);
    padding: 10px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.bc-list {
    display: flex;
    list-style: none;
    gap: 6px;
    font-size: 12px;
    color: var(--text-light);
    flex-wrap: wrap;
}
.bc-list a { color: var(--text-light); }
.bc-list a:hover { color: var(--primary); }
.bc-list li:not(:last-child)::after {
    content: '›';
    margin-left: 6px;
    color: #ccc;
}

/* ── PORTADA ─────────────────────────────────────────────── */
.main-collage {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 350px;
}

.grid-item {
    position: relative;
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
    transition: opacity 1.5s ease-in-out;
}
.grid-item img.hidden { opacity: 0; }
.grid-item img.active  { opacity: 1; }

.span-2-2 { grid-column: span 2; grid-row: span 2; }
.span-1-2 { grid-column: span 1; grid-row: span 2; }
.span-2-1 { grid-column: span 2; grid-row: span 1; }

.block-beige { background: var(--beige); color: #fff; text-align: center; }
.block-dark  { background: var(--dark);  color: #fff; text-align: center; }

.overlay-content {
    position: relative;
    z-index: 10;
    padding: 24px;
    pointer-events: none;
}
.overlay-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: #fff;
}
.sale-text {
    font-family: 'Playfair Display', serif;
    font-size: 80px;
    line-height: 1;
    color: #fff;
}

/* Sección debajo del collage */
.home-sections { padding: 60px 0; }
.section-title {
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    margin-bottom: 8px;
}
.section-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 36px;
}

/* ── TARJETAS DE PRODUCTO ────────────────────────────────── */
.products-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.product-card {
    width: calc(25% - 15px);
    border: 1px solid transparent;
    padding: 12px;
    text-align: center;
    transition: border-color .25s, box-shadow .25s;
    cursor: pointer;
    display: block;
    color: inherit;
    text-decoration: none;
}
.product-card:hover {
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.product-card .card-img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    margin-bottom: 12px;
}
.card-name {
    color: var(--primary);
    font-size: 13px;
    margin-bottom: 4px;
    font-weight: 500;
}
.card-code {
    color: var(--text-light);
    font-size: 11px;
    margin-bottom: 6px;
}
.card-price { font-size: 15px; font-weight: 600; }
.card-price-old {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    font-weight: 400;
    margin-left: 6px;
}
.card-brand { font-size: 11px; color: #aaa; margin-top: 4px; }

/* ── CATÁLOGO ────────────────────────────────────────────── */
.catalog-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 30px;
    padding-bottom: 60px;
}

/* Sidebar */
.sidebar { align-self: start; }
.sidebar-box {
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.sidebar-box h3 {
    background: #000;
    color: #fff;
    padding: 10px 16px;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.sidebar-list { list-style: none; }
.sidebar-list li {
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list a {
    display: flex;
    justify-content: space-between;
    padding: 9px 16px;
    color: var(--text);
    transition: color .2s, background .2s;
}
.sidebar-list a:hover,
.sidebar-list a.active { color: var(--primary); background: var(--bg-light); }
.sidebar-list .count { color: #aaa; font-size: 11px; }

/* Subcategorías */
.sub-list { list-style: none; }
.sub-list a {
    display: block;
    padding: 6px 16px 6px 28px;
    font-size: 12px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}
.sub-list a:hover { color: var(--primary); }

/* Toolbar catálogo */
.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.catalog-toolbar h2 { font-size: 18px; font-weight: 500; }
.catalog-count { font-size: 12px; color: var(--text-light); }

/* ── DETALLE DE PRODUCTO ─────────────────────────────────── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    padding-bottom: 50px;
}

.detail-img-box {
    border: 1px solid var(--border);
    padding: 24px;
}
.detail-img-box img { width: 100%; display: block; }

.detail-info h1 {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 20px;
    line-height: 1.3;
}

.meta-list {
    list-style: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
    margin-bottom: 18px;
}
.meta-list li { font-size: 13px; margin-bottom: 7px; }
.meta-list b { width: 110px; display: inline-block; font-weight: 500; }
.meta-link { color: var(--primary); }

.price-big { font-size: 26px; font-weight: 700; margin-bottom: 20px; }
.price-old { font-size: 15px; color: #999; text-decoration: line-through; font-weight: 400; margin-left: 8px; }

/* Descripción */
.prod-descripcion {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 24px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

/* Botón WhatsApp */
.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #25D366;
    color: #fff;
    border: none;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border-radius: 3px;
    transition: background .2s, transform .1s;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}
.btn-whatsapp:hover { background: #1ebe5d; transform: translateY(-1px); }
.btn-whatsapp i { font-size: 20px; }

/* Social share */
.social-share { display: flex; gap: 6px; margin-top: 24px; }
.social-btn {
    width: 28px; height: 28px;
    border-radius: 3px;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    text-decoration: none;
}

/* Tabs */
.tabs-section { margin-top: 40px; border: 1px solid var(--border); }
.tabs-header {
    display: flex;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
}
.tab-btn {
    padding: 10px 22px;
    font-size: 13px;
    cursor: pointer;
    border-top: 2px solid transparent;
    color: var(--text-light);
    transition: .2s;
    background: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
    font-family: inherit;
}
.tab-btn.active {
    background: #fff;
    border-top-color: var(--primary);
    color: var(--text);
    font-weight: 600;
}
.tab-body { padding: 28px; font-size: 13px; color: var(--text-light); line-height: 1.9; display: none; }
.tab-body.active { display: block; }

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
    background: var(--dark);
    color: #bbb;
    padding: 60px 0 30px;
    margin-top: 60px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}
.footer-grid h4 {
    color: #fff;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 18px;
}
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 8px; font-size: 13px; }
.footer-grid a { color: #bbb; }
.footer-grid a:hover { color: #fff; }
.footer-copy {
    text-align: center;
    font-size: 12px;
    border-top: 1px solid #555;
    padding-top: 20px;
    color: #888;
}

/* ── MENÚ HAMBURGUESA (mobile) ───────────────────────────── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 6px;
    background: none;
    border: none;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: .3s;
}

/* Menú móvil desplegable */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 12px 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
    display: block;
    padding: 11px 24px;
    font-size: 13px;
    color: #333;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { color: var(--primary); background: var(--bg-light); }

/* ── LIGHTBOX ────────────────────────────────────────────── */
#lb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
#lb-overlay.lb-open { display: flex; }

#lb-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
    cursor: zoom-out;
}
#lb-img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity .25s;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Botones del lightbox */
#lb-close,
#lb-prev,
#lb-next {
    position: fixed;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    transition: background .2s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#lb-close:hover, #lb-prev:hover, #lb-next:hover {
    background: rgba(255,255,255,.28);
    transform: scale(1.1);
}

#lb-close {
    top: 18px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 28px;
}
#lb-prev  {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    font-size: 36px;
}
#lb-next  {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    font-size: 36px;
}
#lb-prev:hover { transform: translateY(-50%) scale(1.1); }
#lb-next:hover { transform: translateY(-50%) scale(1.1); }

#lb-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.7);
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 1px;
    pointer-events: none;
}

/* Spinner loader */
#lb-loader {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.lb-spin {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lb-rotate 0.7s linear infinite;
}
@keyframes lb-rotate { to { transform: rotate(360deg); } }

/* Cursor en imágenes con lightbox */
[data-lightbox] { cursor: zoom-in; }

/* ── RESPONSIVE ──────────────────────────────────────────── */

/* Tablet grande (901–1100px) */
@media (max-width: 1100px) {
    .product-card { width: calc(33.33% - 14px); }
}

/* Tablet (601–900px) */
@media (max-width: 900px) {
    /* Catálogo */
    .catalog-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    /* Detalle de producto */
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    /* Collage portada */
    .main-collage {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 240px;
    }
    .span-2-2 { grid-column: span 2; grid-row: span 2; }
    .span-1-2 { grid-column: span 1; grid-row: span 2; }
    .span-2-1 { grid-column: span 2; grid-row: span 1; }

    /* Productos */
    .product-card { width: calc(50% - 10px); }

    /* Footer */
    .footer-grid { grid-template-columns: 1fr 1fr; }

    /* Lightbox flechas más pequeñas en tablet */
    #lb-prev, #lb-next { width: 44px; height: 44px; font-size: 28px; }
}

/* Mobile (≤600px) */
@media (max-width: 600px) {
    /* Header */
    .main-nav   { display: none; }   /* se reemplaza por hamburguesa */
    .hamburger  { display: flex; }

    /* Collage: una columna, filas más cortas */
    .main-collage       { grid-template-columns: 1fr; grid-auto-rows: 220px; }
    .span-2-2,
    .span-1-2,
    .span-2-1           { grid-column: span 1; grid-row: span 1; }
    .sale-text          { font-size: 52px; }

    /* Catálogo */
    .sidebar            { grid-template-columns: 1fr; }
    .product-card       { width: calc(50% - 8px); }

    /* Producto detalle */
    .detail-layout      { gap: 20px; }

    /* Footer */
    .footer-grid        { grid-template-columns: 1fr; gap: 28px; }

    /* Lightbox: flechas en la parte inferior en mobile */
    #lb-prev {
        left: 12px;
        top: auto;
        bottom: 56px;
        transform: none;
        width: 42px; height: 42px; font-size: 26px;
    }
    #lb-next {
        right: 12px;
        top: auto;
        bottom: 56px;
        transform: none;
        width: 42px; height: 42px; font-size: 26px;
    }
    #lb-prev:hover { transform: scale(1.08); }
    #lb-next:hover { transform: scale(1.08); }
    #lb-img        { max-width: 96vw; max-height: 75vh; }
}

/* Mobile muy pequeño */
@media (max-width: 380px) {
    .product-card { width: 100%; }
    .header-inner { padding: 14px 14px; }
}
