/* =====================================================
   PC Store Header — Frontend Styles (Fusionado)
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; }

#pc-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    font-family: var(--pch-font);
}

/* ── Barra principal ─────────────────────────────── */
.pch-bar {
    background: var(--pch-bg);
    border-bottom: 1px solid color-mix(in srgb, var(--pch-text) 10%, transparent);
    transition: box-shadow 0.2s ease;
}

#pc-header.is-scrolled .pch-bar {
    box-shadow: 0 2px 12px color-mix(in srgb, var(--pch-text) 10%, transparent);
}

.pch-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 1rem;
}

/* ── Logo ────────────────────────────────────────── */
.pch-logo {
    text-decoration: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.pch-logo-img {
    height: 36px;
    width: auto;
    display: block;
}

.pch-logo-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--pch-text);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

/* ── Navegación desktop ──────────────────────────── */
.pch-nav {
    display: flex;
    align-items: stretch;
    flex: 1;
    justify-content: center;
    height: 60px;
}

.pch-nav-item {
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: var(--pch-nav-size, 13.5px);
    font-weight: 400;
    color: var(--pch-nav-color, var(--pch-text));
    opacity: 1;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.pch-nav-item:hover {
    color: var(--pch-text);
    border-bottom-color: color-mix(in srgb, var(--pch-text) 20%, transparent);
}

.pch-nav-item.is-active {
    color: var(--pch-text);
    font-weight: 500;
    border-bottom-color: var(--pch-accent);
}

/* ── Botones de acción ───────────────────────────── */
.pch-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.pch-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--pch-text);
    cursor: pointer;
    transition: background 0.15s;
}

.pch-btn:hover {
    background: color-mix(in srgb, var(--pch-text) 6%, transparent);
}

.pch-btn:focus-visible {
    outline: 2px solid var(--pch-accent);
    outline-offset: 2px;
}

/* Badge del carrito */
.pch-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    background: var(--pch-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* Hamburger: solo en mobile */
.pch-hamburger {
    display: none;
}

/* ── Barra de búsqueda ───────────────────────────── */
.pch-search-bar {
    background: var(--pch-bg);
    border-bottom: 1px solid color-mix(in srgb, var(--pch-text) 10%, transparent);
    padding: 10px 0;
    animation: pch-slide-down 0.18s ease;
}

@keyframes pch-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pch-search-bar .pch-inner {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding-top: 0;
    padding-bottom: 0;
}

.pch-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--pch-text) 16%, transparent);
    border-radius: 8px;
    padding: 0 14px;
    height: 42px;
    background: color-mix(in srgb, var(--pch-bg) 85%, var(--pch-text) 15%);
    transition: border-color 0.15s, background 0.15s;
}

.pch-search-wrap:focus-within {
    border-color: var(--pch-accent);
    background: var(--pch-bg);
}

.pch-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: var(--pch-font);
    color: var(--pch-text);
    outline: none;
}

.pch-search-input::placeholder {
    color: color-mix(in srgb, var(--pch-text) 42%, transparent);
}

#pch-search-results {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
}

/* ── Menú mobile (drawer) ────────────────────────── */
.pch-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--pch-bg);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pch-mobile-menu.is-open {
    transform: translateX(0);
}

.pch-mobile-item {
    display: block;
    padding: 14px 1.5rem;
    font-size: 15px;
    color: var(--pch-text);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.pch-mobile-item:hover {
    background: color-mix(in srgb, var(--pch-text) 5%, transparent);
}

.pch-mobile-item.is-active {
    border-left-color: var(--pch-accent);
    font-weight: 500;
    color: var(--pch-accent);
}

/* ── Overlay ─────────────────────────────────────── */
.pch-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    animation: pch-fade-in 0.2s ease;
}

@keyframes pch-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Panel del carrito ───────────────────────────── */
.pch-cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100vh;
    background: var(--pch-bg);
    z-index: 10001;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.pch-cart-panel.is-open {
    transform: translateX(0);
}

.pch-cart-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ── Usuario / Dropdown ──────────────────────────── */
.pch-user-wrap { position: relative; }

.pch-user-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: var(--pch-accent);
    border-radius: 50%;
    border: 1.5px solid var(--pch-bg);
}

.pch-user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--pch-bg);
    border: 1px solid color-mix(in srgb, var(--pch-text) 10%, transparent);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.16);
    z-index: 10010;
    overflow: visible;
    animation: pch-slide-down 0.15s ease;
}

.pch-dropdown-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--pch-text) 8%, transparent);
}

.pch-dropdown-greeting {
    font-size: 13px;
    color: color-mix(in srgb, var(--pch-text) 60%, transparent);
}

.pch-dropdown-greeting strong {
    color: var(--pch-text);
    font-weight: 600;
}

.pch-dropdown-body { padding: 6px 0; }

.pch-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--pch-text);
    text-decoration: none;
    transition: background 0.12s;
}

.pch-dropdown-item:hover {
    background: color-mix(in srgb, var(--pch-text) 5%, transparent);
}

.pch-dropdown-divider {
    height: 1px;
    background: color-mix(in srgb, var(--pch-text) 8%, transparent);
    margin: 4px 0;
}

/* Formulario de login interno */
.pch-login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--pch-text) 8%, transparent);
}

.pch-login-form input {
    height: 36px;
    padding: 0 12px;
    border: 1px solid color-mix(in srgb, var(--pch-text) 16%, transparent);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--pch-font);
    color: var(--pch-text);
    background: color-mix(in srgb, var(--pch-bg) 80%, var(--pch-text) 20%);
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

.pch-login-form input:focus {
    border-color: var(--pch-accent);
    background: var(--pch-bg);
}

.pch-login-form button {
    height: 36px;
    background: var(--pch-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--pch-font);
    cursor: pointer;
    transition: opacity 0.15s;
}

.pch-login-form button:hover {
    opacity: 0.88;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
    .pch-nav { display: none; }
    .pch-hamburger {
        display: flex;
        order: -1;
    }
    .pch-inner { justify-content: space-between; }
    .pch-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 480px) {
    .pch-cart-panel { width: 100vw; }
}

/* ── Ocultar cosas innecesarias ──────────────────── */
body { padding-top: 0 !important; margin-top: 0 !important; }
.wp-block-template-part[class*="header"],
header.wp-block-template-part { display: none !important; }
/* ── Dropdown usuario — estilos adicionales ─────── */
.pch-user-wrap { z-index: 10010; }
.pch-dropdown-logout { color: #dc2626 !important; }
.pch-dropdown-logout svg { color: #dc2626 !important; stroke: #dc2626 !important; }
.pch-dropdown-item svg { color: color-mix(in srgb, var(--pch-text) 50%, transparent); flex-shrink: 0; }
.pch-dropdown-links { padding-top: 4px; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVO MÓVIL — Header (buscador, drawer, menú móvil)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    /* Barra de búsqueda: input 16px anti-zoom iOS */
    .pch-search-input { font-size: 16px; }

    /* Logo y navegación sin desbordes */
    .pch-inner { gap: 8px; padding: 0 12px; }
    .pch-logo-text { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }

    /* Botones táctiles */
    .pch-btn { min-width: 40px; min-height: 40px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

    /* Menú móvil y dropdown ocupan bien la pantalla */
    .pch-mobile-menu { overscroll-behavior: contain; }
    .pch-dropdown-body { max-height: 60vh; overflow-y: auto; }

    /* Resultados de búsqueda dentro de la vista */
    #pch-search-results { max-height: 70vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* Modo Logo + texto */
.pch-logo.pch-brand-both .pch-logo-img { margin-right: 10px; }

@media (max-width:640px) {
    .pch-user-dropdown { position:fixed; top:58px; right:10px; left:10px; width:auto; max-height:calc(100dvh - 70px); overflow-y:auto; }
    .pch-mobile-menu { width:min(340px, calc(100vw - 24px)); }
}
