/* Ubicación: public_html/css/global.css */

@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600&display=swap');

:root {
    /* Paleta de Colores NAGI (Extraída del Brandboard) */
    --nagi-bg: #F9F8F6; /* Fondo Hueso/Crema */
    --nagi-text: #1A1A1A; /* Gris Carbón Oscuro (Textos principales) */
    --nagi-text-muted: #666666; /* Gris Secundario (Descripciones) */
    --nagi-accent: #E5E0D8; /* Arena/Beige (Fondos secundarios) */
    --nagi-white: #FFFFFF;
    
    /* Variables de Estructura */
    --font-main: 'Jost', sans-serif;
    --transition: all 0.3s ease;
    --max-width: 1200px;
}

/* =========================================
   Reset y Configuración Base
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--nagi-bg);
    color: var(--nagi-text);
    font-family: var(--font-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* =========================================
   Header (Navegación Superior)
========================================= */
.site-header {
    background-color: var(--nagi-bg);
    padding: 0.8rem 4%;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.header-logo {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.header-logo-img {
    height: 165px;
    max-height: 165px;
    width: auto;
    display: block;
    object-fit: contain;
    margin: -48px 0;
}

.header-nav {
    flex: 2;
    display: none; /* Oculto en móviles, visible en PC */
    justify-content: center;
    align-items: center;
}

.header-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.2rem;
    margin: 0;
    padding: 0;
}

.header-nav a {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nagi-text-muted);
    white-space: nowrap;
    display: inline-block;
    padding: 1rem 0; /* Aumenta el área de hover */
}

.header-nav a:hover {
    color: var(--nagi-text);
}

.header-icons {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
}

.header-icons svg {
    width: 20px;
    height: 20px;
    cursor: pointer;
    stroke: var(--nagi-text);
}

/* =========================================
   Botones Globales
========================================= */
.btn-primary {
    display: inline-block;
    background-color: var(--nagi-text);
    color: var(--nagi-white);
    padding: 1rem 2.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: #333333;
}

/* =========================================
   Media Queries (PC)
========================================= */
@media (min-width: 1024px) {
    .header-nav {
        display: block;
    }
}

/* =========================================
   Mega Menu (Desplegable 2 Niveles Desktop Centrado)
========================================= */
.has-megamenu {
    position: static !important;
}

.caret-down {
    font-size: 0.7rem;
    margin-left: 3px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.megamenu-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 90vw;
    max-width: 1100px;
    background-color: var(--nagi-white, #FFFFFF);
    border: 1px solid var(--nagi-border, #DCD7CD);
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.06);
    padding: 2rem 2.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999;
}

.has-megamenu:hover .megamenu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Puente invisible para mantener el hover */
.megamenu-dropdown::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.has-megamenu:hover .caret-down {
    transform: rotate(180deg);
}

.megamenu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem 1.8rem;
}

.megamenu-column {
    display: flex;
    flex-direction: column;
}

.megamenu-parent-title {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--nagi-text, #1A1A1A) !important;
    display: block;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--nagi-accent, #E5E0D8);
    padding-bottom: 0.4rem;
}

.megamenu-parent-title:hover {
    color: var(--nagi-text-muted, #666666) !important;
}

.megamenu-sublist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.megamenu-sublist a {
    font-size: 0.82rem !important;
    color: #555555 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 400 !important;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.megamenu-sublist a:hover {
    color: #111111 !important;
    transform: translateX(3px);
}

/* =========================================
   Grilla Responsiva de Productos (Tienda Pública)
========================================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 1rem;
}

@media (min-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem 1.2rem;
    }
}

@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem 1.8rem;
    }
}

.product-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease;
}

.product-card:hover {
    transform: translateY(-4px);
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    margin-bottom: 0.8rem;
}

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

.product-card-category {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #888888;
    margin-bottom: 0.25rem;
}

.product-card-title {
    font-size: 0.88rem;
    font-weight: 400;
    color: #111111;
    margin-bottom: 0.4rem;
    line-height: 1.35;
}

.product-card-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111111;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .product-card-title {
        font-size: 0.82rem;
    }
    .product-card-price {
        font-size: 0.88rem;
    }
}

/* =========================================
   Mobile Drawer & Acordeón Minimalista
========================================= */
.mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: none;
    padding: 4px;
}
.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background-color: var(--nagi-white, #FFFFFF);
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    z-index: 9999;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
}

.mobile-menu-drawer.active,
.mobile-menu-drawer.open {
    right: 0 !important;
}

/* =========================================
   Slide-Over Cart Drawer Responsive (100dvh & Safe Area)
========================================= */
#nagi-cart-drawer {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

#cart-drawer-header {
    flex-shrink: 0;
}

#cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    max-height: none;
    min-height: 0;
}

#cart-drawer-footer {
    flex-shrink: 0;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* =========================================
   Atributos Chips / Pills UI (NAGI Redesign)
========================================= */
.chip-btn {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    user-select: none;
    text-align: center;
    text-transform: uppercase;
}


.chip-btn:hover:not(.out-of-stock):not(.active) {
    border-color: #111827;
}

.chip-btn.active {
    background-color: #111827;
    border-color: #111827;
    color: #ffffff;
    font-weight: 600;
}

.chip-btn.out-of-stock {
    background-color: #f3f4f6;
    border-color: #f3f4f6;
    color: #9ca3af;
    text-decoration: line-through;
    cursor: not-allowed;
    opacity: 0.6;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--nagi-border, #DCD7CD);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333333;
}

.mobile-accordion-item {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
}

.mobile-parent-link {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #111111;
}

.mobile-accordion-toggle {
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform 0.2s ease;
}

.mobile-accordion-toggle.open {
    transform: rotate(180deg);
}

.mobile-accordion-body {
    list-style: none;
    padding: 0 0 0.8rem 1rem;
    margin: 0;
    display: none;
}

.mobile-accordion-body.open {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.mobile-accordion-body a {
    font-size: 0.82rem;
    color: #666666;
    text-transform: none;
}

@media (max-width: 1023px) {
    .site-header {
        padding: 0.5rem 1rem;
    }
    .header-logo {
        flex: 1;
        justify-content: flex-start;
        margin-right: auto;
        min-width: 0;
    }
    .header-logo-img {
        height: 65px;
        max-height: 65px;
        margin: 0;
        object-position: left center;
    }
    .header-icons {
        flex: 0 0 auto;
        gap: 0.75rem;
        position: relative;
        z-index: 20;
    }
    .mobile-menu-btn {
        display: block;
    }
}
/* =========================================
   Theme Kirel (TIENDA_ID = 2)
========================================= */
body[data-tienda="2"] {
    --nagi-bg: #050505;
    --nagi-text: #ffffff;
    --nagi-text-inv: #ffffff;
    --nagi-text-muted: #a1a1aa;
    --nagi-accent: #111111;
    --nagi-brand: #7000FF;
    --nagi-border: #222222;
    --nagi-surface: #0a0a0a;
}

body[data-tienda="2"] .site-header {
    border-bottom: 1px solid var(--nagi-border);
}

body[data-tienda="2"] .nav-submenu {
    background: var(--nagi-surface);
    border-color: var(--nagi-border);
}

body[data-tienda="2"] .nav-submenu li a {
    color: var(--nagi-text);
}

body[data-tienda="2"] .nav-submenu li a:hover {
    background: var(--nagi-accent);
}

body[data-tienda="2"] .megamenu-dropdown {
    background: var(--nagi-surface);
    border-color: var(--nagi-border);
}

body[data-tienda="2"] .nagi-search-container {
    background: var(--nagi-surface);
    border-color: var(--nagi-border);
}

body[data-tienda="2"] .nagi-search-input {
    background: var(--nagi-bg);
    color: var(--nagi-text);
    border-color: var(--nagi-border);
}

body[data-tienda="2"] .nagi-search-item {
    color: var(--nagi-text);
    border-bottom-color: var(--nagi-border);
}

body[data-tienda="2"] .nagi-search-item:hover {
    background: var(--nagi-accent);
}

body[data-tienda="2"] .nagi-search-price {
    color: var(--nagi-text-muted);
}

body[data-tienda="2"] .nagi-search-results {
    background: var(--nagi-surface);
}

body[data-tienda="2"] .mobile-menu-drawer {
    background: var(--nagi-surface);
    color: var(--nagi-text);
}

body[data-tienda="2"] .mobile-accordion-header {
    border-bottom-color: var(--nagi-border);
}
