/* ============================================================
   NAVBAR CUSTOM (reemplaza la de Blocksy)
   Cada link se resalta en hover con el color de acento de su
   sección (--nav-accent, tripleta RGB), respetando los heroes.
   ============================================================ */

.tpc-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    background: #fff;
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.tpc-skip-link:focus {
    left: 16px;
    top: 16px;
}

.tpc-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.tpc-nav__inner {
    /* Ancho fijo, independiente de --container (que algunas páginas —ej.
       contacto— redefinen, lo que desplazaba los items de la navbar). */
    width: min(1180px, calc(100% - 48px));
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: var(--navbar-height);
}

.tpc-nav__brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.tpc-nav__brand img {
    height: 42px;
    width: auto;
}

.tpc-nav__menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex: 1;
}

.tpc-nav__list {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* --- Links con acento por sección --- */
.tpc-nav__link {
    --nav-accent: var(--rgb-blue);
    position: relative;
    display: inline-block;
    padding: 8px 8px;
    font-family: var(--theme-font-family), Inter, system-ui, sans-serif;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #3A4F66;
    white-space: nowrap;
    transition: color .18s ease;
}

.tpc-nav__link::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 5px;
    height: 2px;
    border-radius: 2px;
    background: rgb(var(--nav-accent));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .2s ease;
}

.tpc-nav__link:hover,
.tpc-nav__link:focus-visible {
    color: rgb(var(--nav-accent));
}

.tpc-nav__link:hover::after,
.tpc-nav__link.is-active::after {
    transform: scaleX(1);
}

.tpc-nav__link.is-active {
    color: rgb(var(--nav-accent));
}

/* --- Paleta de acentos por sección --- */
.tpc-accent--blue   { --nav-accent: var(--rgb-blue); }
.tpc-accent--coral  { --nav-accent: var(--rgb-coral); }
.tpc-accent--teal   { --nav-accent: var(--rgb-teal); }
.tpc-accent--pink   { --nav-accent: var(--rgb-pink); }
.tpc-accent--violet { --nav-accent: var(--rgb-violet); }
.tpc-accent--amber  { --nav-accent: var(--rgb-amber); }
.tpc-accent--cyan   { --nav-accent: var(--rgb-cyan); }
.tpc-accent--purple { --nav-accent: var(--rgb-purple); }

/* --- Acciones (carrito, cuenta, CTA) --- */
.tpc-nav__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.tpc-nav__icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--muted);
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.tpc-nav__icon:hover {
    background: var(--soft);
    color: var(--text);
}

.tpc-nav__icon .material-icons {
    font-size: 20px;
}

.tpc-nav__cart-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    line-height: 1;
}

/* --- Toggle mobile --- */
.tpc-nav__toggle {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.tpc-nav__toggle .material-icons {
    font-size: 26px;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 1080px) {
    .tpc-nav__toggle {
        display: grid;
        order: 3;
    }

    .tpc-nav__menu {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 14px 20px 22px;
        background: #fff;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        max-height: calc(100vh - var(--navbar-height));
        overflow-y: auto;
        display: none;
    }

    .tpc-nav.is-open .tpc-nav__menu {
        display: flex;
    }

    .tpc-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .tpc-nav__link {
        display: block;
        padding: 12px 14px;
        font-size: 15px;
    }

    .tpc-nav__link::after {
        display: none;
    }

    .tpc-nav__actions {
        margin-top: 12px;
        padding-top: 14px;
        border-top: 1px solid var(--border);
        justify-content: flex-start;
    }
}

/* ============================================================
   MINI-MENÚ DE CUENTA (usuario logueado)
   ============================================================ */
.tpc-nav__account {
    position: relative;
}

.tpc-account-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 176px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 6px;
    display: none;
    z-index: 200;
}

.tpc-nav__account.is-open .tpc-account-menu {
    display: block;
}

.tpc-account-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.tpc-account-menu a:hover {
    background: var(--soft);
}

/* ============================================================
   MODAL DE LOGIN / REGISTRO (invitado)
   ============================================================ */
.tpc-auth[hidden] {
    display: none;
}

.tpc-auth {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
}

.tpc-auth__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.tpc-auth__dialog {
    position: relative;
    width: min(420px, 100%);
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow);
    /* Más padding arriba para que el botón cerrar no se pise con las tabs. */
    padding: 52px 28px 28px;
    animation: tpc-auth-in .18s ease;
}

@keyframes tpc-auth-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tpc-auth__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    background: none;
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.tpc-auth__close:hover {
    background: var(--soft);
    color: var(--text);
}

.tpc-auth__tabs {
    display: flex;
    gap: 4px;
    background: var(--soft);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.tpc-auth__tab {
    flex: 1;
    padding: 10px;
    border: 0;
    background: none;
    border-radius: 9px;
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.tpc-auth__tab.is-active {
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

.tpc-auth__form[hidden] {
    display: none;
}

.tpc-auth__title {
    margin: 0 0 18px;
    font-size: 20px;
    letter-spacing: -.3px;
}

.tpc-auth__form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.tpc-auth__form input {
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    background: #fbfcfe;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.tpc-auth__form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, .14);
    background: #fff;
}

.tpc-auth__feedback {
    font-size: 13px;
    font-weight: 600;
    min-height: 18px;
    margin-bottom: 8px;
}

.tpc-auth__feedback.is-error { color: #dc2626; }
.tpc-auth__feedback.is-ok    { color: #16a34a; }

.tpc-auth__submit {
    width: 100%;
    padding: 13px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: filter .15s ease, transform .1s ease;
}

.tpc-auth__submit:hover { filter: brightness(1.05); }
.tpc-auth__submit:active { transform: translateY(1px); }
.tpc-auth__submit:disabled { opacity: .6; cursor: not-allowed; }
