﻿nav {
    position: sticky;
    top: 0;
    z-index: 1100;
    background-color: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--brand-border);
    box-shadow: 0 8px 24px rgba(31, 41, 55, 0.08);
    backdrop-filter: blur(6px);
}

.nav-shell {
    height: 10vh;
    min-height: 72px;
    width: min(92%, 1400px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 1rem;
    padding: 25px 20px;
}

.nav-shell.has-user {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--brand-border);
    border-radius: 10px;
    background: #ffffff;
    padding: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--brand-ink);
    border-radius: 99px;
    transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.centro {
    justify-self: center;
    transform: translateY(-30px);
}

.centro a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.centro img {
    width: 90px;
    height: auto;
}

.nav-desktop {
    display: block;
}

.izquierda {
    justify-self: start;
    min-width: 0;
}

.derecha {
    justify-self: end;
    min-width: 0;
}

nav ul {
    display: flex;
    list-style: none;
    gap: clamp(0.65rem, 1.5vw, 1.35rem);
    align-items: center;
    flex-wrap: nowrap;
}

nav ul li a {
    text-decoration: none;
    color: var(--brand-ink);
    font-weight: 700;
    padding: 4px;
    transition: color 180ms ease, border-color 180ms ease;
    white-space: nowrap;
}

nav ul li a:hover {
    color: var(--brand-accent-dark);
    border-bottom: solid 2px var(--brand-accent);
}

.account-item {
    position: relative;
    max-width: 220px;
    min-width: 0;
}

#accountDesktopTrigger {
    display: inline-block;
    border-radius: 999px;
    padding: 8px 12px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-item.has-user #accountDesktopTrigger {
    background: rgba(217, 70, 239, 0.12);
    border: 1px solid rgba(217, 70, 239, 0.25);
}

.nav-cart-item.hidden {
    display: none;
}

.nav-cart-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.04);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.nav-cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--brand-accent);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.account-submenu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    display: none;
    background: #ffffff;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(31, 41, 55, 0.16);
    padding: 8px;
    z-index: 1200;
}

.account-item.open .account-submenu {
    display: grid;
}

.account-submenu a,
.account-submenu button {
    display: block;
    width: 100%;
    text-align: left;
    text-decoration: none;
    color: var(--brand-ink);
    font-size: 14px;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}

.account-submenu a:hover,
.account-submenu button:hover {
    background: var(--brand-accent-soft);
    border-color: var(--brand-border);
    color: var(--brand-accent-dark);
}

.nav-mobile {
    display: none;
}

.mobile-account-block {
    display: grid;
    gap: 2px;
}

.mobile-account-welcome {
    font-weight: 700;
    color: var(--brand-accent-dark);
    padding: 10px;
}

.mobile-account-block button {
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    color: var(--brand-ink);
    font-weight: 600;
    padding: 12px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.mobile-account-block button:hover {
    background: var(--brand-accent-soft);
    border-color: var(--brand-border);
    color: var(--brand-accent-dark);
}

@media (max-width: 1220px) {
    nav ul {
        gap: 0.8rem;
    }

    nav ul li a {
        font-size: 14px;
    }

    .centro img {
        width: 78px;
    }
}

@media (max-width: 980px) {
    .nav-shell {
        width: 100%;
        margin-left: 0;
        grid-template-columns: auto 1fr auto;
        height: 74px;
        padding: 12px 14px;
    }

    .centro {
        transform: translateY(0);
    }

    .nav-toggle {
        display: inline-flex;
        order: 1;
        justify-self: start;
    }

    .centro {
        order: 2;
    }

    .nav-desktop {
        display: none;
    }

    .nav-cart-item {
        display: none !important;
    }

    .nav-mobile {
        display: block;
        max-height: 0;
        overflow: hidden;
        background: #ffffff;
        border-bottom: 1px solid var(--brand-border);
        transition: max-height 260ms ease;
    }

    .nav-mobile.active {
        max-height: 80vh;
    }

    .nav-mobile-inner {
        display: grid;
        gap: 2px;
        padding: 8px 14px 14px;
    }

    .nav-mobile-inner a {
        text-decoration: none;
        color: var(--brand-ink);
        font-weight: 600;
        padding: 12px 10px;
        border-radius: 10px;
        border: 1px solid transparent;
    }

    .nav-mobile-inner a:hover {
        background: var(--brand-accent-soft);
        border-color: var(--brand-border);
        color: var(--brand-accent-dark);
    }

    body.menu-open {
        overflow: hidden;
    }
}
