/* site-nav.css - Menú principal: Inicio · Marcas ▾ · Categorías ▾ · Ofertas · Tutoriales · Nosotros.
   Los paneles se ubican bajo el header (que es position: fixed), centrados. */

.header .nav {
    align-items: center;
    gap: 0.25rem;
}

.header .nav .nav-link {
    padding: 0.5rem 0.85rem;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 500;
    color: var(--primary-black, #141414);
    cursor: pointer;
    white-space: nowrap;
}

.nav-mega {
    position: static;
    display: flex;
    align-items: center;
}

.nav-mega-trigger::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 7px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: translateY(-3px) rotate(45deg);
    transition: transform 0.2s ease;
}

.nav-mega.is-open .nav-mega-trigger::after {
    transform: translateY(0) rotate(225deg);
}

.nav-mega.is-open .nav-mega-trigger,
.header .nav .nav-link:hover {
    background: var(--m-alt, #f3efe9);
}

.header .nav .nav-link--offer {
    color: #b42318;
    font-weight: 600;
}

/* ---------- Panel ---------- */
.mega-panel {
    position: absolute;
    top: calc(100% - 4px);
    left: 50%;
    z-index: 1100;
    width: min(1080px, calc(100vw - 48px));
    padding: 24px;
    border: 1px solid var(--m-line, #e7e2da);
    border-radius: 18px;
    background: var(--m-card, #fff);
    box-shadow: 0 24px 48px rgba(20, 20, 20, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}

.nav-mega.is-open .mega-panel {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.mega-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.mega-head h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--m-ink, #141414);
}

.mega-head a,
.mega-all {
    color: var(--m-ink, #141414);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}

.mega-head a:hover,
.mega-all:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Marcas: grilla con logos */
.mega-brands {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.mega-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--m-line, #e7e2da);
    border-radius: 14px;
    color: var(--m-ink, #141414);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.mega-brand:hover,
.mega-brand:focus-visible {
    border-color: var(--m-ink, #141414);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(20, 20, 20, 0.08);
}

.mega-brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    margin-bottom: 4px;
    border-radius: 10px;
    background: var(--m-soft, #f1ede7);
    overflow: hidden;
}

.mega-brand-logo img {
    max-width: 85%;
    max-height: 52px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.mega-brand-logo span {
    padding: 0 8px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
}

.mega-brand-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.mega-brand-count {
    font-size: 0.78rem;
    color: var(--m-muted, #6e6a64);
}

/* Categorías: grupos + tarjeta de ofertas */
.mega-categories {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 24px;
}

.mega-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 24px;
}

.mega-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mega-group-title {
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--m-ink, #141414);
    text-decoration: none;
}

.mega-group-title small {
    margin-left: 4px;
    font-weight: 500;
    color: var(--m-muted, #6e6a64);
}

.mega-group-title:hover,
.mega-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.mega-link {
    padding: 3px 0;
    font-size: 0.9rem;
    color: var(--m-muted, #6e6a64);
    text-decoration: none;
}

.mega-link:hover {
    color: var(--m-ink, #141414);
}

.mega-offer {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    min-height: 190px;
    padding: 20px;
    border-radius: 16px;
    background: var(--m-ink, #141414);
    color: #fff;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.mega-offer:hover {
    transform: translateY(-2px);
}

.mega-offer span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.7;
}

.mega-offer strong {
    font-size: 1.6rem;
    line-height: 1.1;
}

.mega-offer small {
    font-size: 0.85rem;
    opacity: 0.8;
}

.mega-offer em {
    margin-top: 8px;
    font-style: normal;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ---------- Menú lateral (celular) ---------- */
.mnav {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-nav .mnav .nav-link {
    justify-content: space-between;
    margin: 0.2rem 0;
    background: transparent;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
}

.mnav-toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.mnav-section.is-open .mnav-toggle::after {
    transform: rotate(225deg);
}

.mnav-panel {
    display: none;
    flex-direction: column;
    padding: 0 0 0.5rem 1.5rem;
}

.mnav-section.is-open .mnav-panel {
    display: flex;
}

.mnav-panel a {
    padding: 0.55rem 0;
    color: var(--m-muted, #555);
    text-decoration: none;
    font-size: 0.98rem;
}

.mnav-panel a.mnav-all {
    color: var(--m-ink, #141414);
    font-weight: 600;
}

.mobile-nav .mnav .mnav-offer {
    color: #b42318;
    font-weight: 600;
}

.mnav-offer span {
    padding: 2px 8px;
    border-radius: 999px;
    background: #fdecec;
    font-size: 0.75rem;
}

/* Pantallas medianas: se ajusta el espacio para que entren los 7 elementos */
@media (max-width: 1366px) and (min-width: 769px) {
    .header .nav { gap: 0.1rem; }
    .header .nav .nav-link { padding: 0.45rem 0.55rem; font-size: 0.9rem; }
    .mega-brands { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .mega-categories { grid-template-columns: 1fr; }
    .mega-offer { min-height: 0; }
}

/* Más angosto aún: se aprieta un poco más para que no choque con el carrito */
@media (max-width: 1140px) and (min-width: 1025px) {
    .header .nav .nav-link { padding: 0.4rem 0.4rem; font-size: 0.85rem; }
}

/* Tablet (769–1024): con 7 ítems el nav de escritorio ya no entra junto al
   carrito, así que se usa el mismo menú hamburguesa que en celular (el panel
   lateral .mobile-nav se abre por JS en cualquier ancho). */
@media (min-width: 769px) and (max-width: 1024px) {
    .header > .nav { display: none !important; }

    .header {
        display: grid !important;
        grid-template-columns: auto 1fr auto !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .menu-toggle {
        display: inline-flex !important;
        order: 1 !important;
        margin-right: 0 !important;
    }

    .logo-container {
        order: 2 !important;
        position: static !important;
        transform: none !important;
        justify-self: center !important;
        margin: 0 auto !important;
    }

    .user-actions {
        order: 3 !important;
        justify-self: end !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mega-panel,
    .nav-mega.is-open .mega-panel { transition: none; }
}

/* "Sigue tu pedido" al final del menú lateral, separado del resto */
.mobile-nav .mnav .mnav-track {
    margin-top: 0.6rem;
    border-top: 1px solid var(--m-line, #e7e2da);
    border-radius: 0;
    padding-top: 1.1rem;
    font-weight: 600;
}
