/* =============================================
   MenToyPlay — Header v3.0
   ============================================= */

/* ── Announcement bar ────────────────── */
.announcement-bar {
    background: var(--primary);
    color: rgba(255,255,255,0.85);
    text-align: center;
    padding: 9px 24px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font-head);
    letter-spacing: 0.02em;
}
.announcement-bar strong { color: var(--orange-light); }
.announcement-bar a {
    color: rgba(255,255,255,0.9);
    text-decoration: underline;
    transition: color var(--transition);
}
.announcement-bar a:hover { color: var(--white); }

/* ── Main header ─────────────────────── */
#main-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    transition: box-shadow var(--transition);
}
#main-header.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,0.08); }

.header-main { padding: 0; }
.header-inner {
    display: flex;
    align-items: center;
    height: 68px;
    gap: 12px;
}

/* ── Logo ────────────────────────────── */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-head);
    font-size: 21px;
    font-weight: 900;
    color: var(--primary);
    flex-shrink: 0;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--white);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255,107,53,0.35);
}
.logo-text span { color: var(--orange); }

/* ── Search (Mockup Style) ───────────────── */
.header-search {
    flex: 1;
    max-width: 480px;
    position: relative;
    margin: 0 24px;
}
.header-search input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border: none;
    border-radius: 50px;
    font-size: 13.5px;
    font-family: var(--font-sans);
    color: var(--gray-800);
    background: var(--bg-light); /* F1F5F9 or similar */
    outline: none;
    transition: all var(--transition);
}
.header-search input:focus {
    background: var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}
.header-search input::placeholder { color: var(--gray-400); font-weight: 500; }
.header-search-btn {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    width: 38px; height: 38px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background var(--transition), transform 0.1s;
    border: none;
    cursor: pointer;
}
.header-search-btn:hover { background: var(--primary-dark); transform: translateY(-50%) scale(1.05); }

/* Search results */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 600;
    overflow: hidden;
    display: none;
    max-height: 320px;
    overflow-y: auto;
}
.search-results.show { display: block; }
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    color: inherit;
}
.search-result-item:hover { background: var(--gray-50); }
.search-result-img {
    width: 44px; height: 44px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    flex-shrink: 0;
}
.search-result-name { font-size: 13px; font-weight: 700; font-family: var(--font-head); color: var(--gray-800); }
.search-result-price { font-size: 12px; color: var(--orange); font-weight: 700; font-family: var(--font-head); }
.search-result-empty { padding: 20px; text-align: center; color: var(--gray-400); font-size: 13px; }

/* ── Nav ─────────────────────────────── */
#nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
}
#nav-menu li a {
    display: block;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-head);
    color: var(--gray-600);
    border-radius: 50px;
    transition: all var(--transition);
    white-space: nowrap;
}
#nav-menu li a:hover { color: var(--primary); background: var(--bg-light); }
#nav-menu li a.active { color: var(--primary); background: #E0F2FE; }

/* ── Header actions ──────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
}
.h-icon-btn {
    position: relative;
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--gray-600);
    font-size: 17px;
    transition: all var(--transition);
    text-decoration: none;
}
.h-icon-btn:hover { background: var(--gray-100); color: var(--primary); }
.h-icon-btn.wa { color: #25D366; }
.h-icon-btn.wa:hover { background: #ECFDF5; }

/* Cart badge */
.cart-badge {
    position: absolute;
    top: 3px; right: 3px;
    min-width: 18px; height: 18px;
    background: #EF4444; /* Rojo para notificaciones */
    color: var(--white);
    font-size: 10px;
    font-weight: 800;
    font-family: var(--font-head);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    opacity: 0;
    transform: scale(0.4);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cart-badge.show { opacity: 1; transform: scale(1); }
.cart-badge.bump { animation: cartBump 0.3s ease; }
@keyframes cartBump {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.3); }
}

/* ── Menu toggle ─────────────────────── */
.menu-toggle {
    display: none;
    width: 40px; height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--gray-600);
    font-size: 19px;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: none;
}
.menu-toggle:hover { background: var(--gray-100); }

/* ══════════════════════════════════════════════
   CART SIDEBAR
   ══════════════════════════════════════════════ */
#cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    z-index: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(3px);
}
#cart-overlay.open { opacity: 1; pointer-events: all; }

#cart-sidebar {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 400px;
    max-width: 100vw;
    background: var(--white);
    z-index: 900;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
}
#cart-sidebar.open { transform: translateX(0); }

/* Cart header */
.cart-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.cart-hd-title {
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 900;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.cart-hd-title i { color: var(--orange); }
.cart-hd-count {
    background: var(--orange-bg);
    color: var(--orange);
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 20px;
}
.cart-close {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--gray-400);
    font-size: 16px;
    transition: all var(--transition);
    cursor: pointer;
}
.cart-close:hover { background: var(--gray-100); color: var(--gray-700); }

/* Cart body */
.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 22px;
}
.cart-body::-webkit-scrollbar { width: 4px; }
.cart-body::-webkit-scrollbar-track { background: transparent; }
.cart-body::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }

/* Empty state */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 100%;
    min-height: 260px;
    color: var(--gray-400);
    text-align: center;
    padding: 32px;
}
.cart-empty i { font-size: 52px; }
.cart-empty strong { display: block; font-family: var(--font-head); font-size: 16px; color: var(--gray-600); margin-bottom: 4px; }
.cart-empty p { font-size: 13px; line-height: 1.5; }

/* Cart item */
.cart-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeUp 0.25s ease;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
    width: 68px; height: 68px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-cat {
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-400);
    margin-bottom: 3px;
}
.cart-item-name {
    font-size: 13.5px;
    font-weight: 700;
    font-family: var(--font-head);
    color: var(--gray-800);
    line-height: 1.3;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.qty-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.qty-btn {
    width: 28px; height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--gray-500);
    background: var(--gray-50);
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    font-family: var(--font-head);
    font-weight: 700;
}
.qty-btn:hover { background: var(--primary-bg); color: var(--primary); }
.qty-val {
    width: 30px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-head);
    color: var(--gray-800);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--white);
    line-height: 28px;
}
.cart-item-price {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 900;
    color: var(--primary);
}
.cart-item-remove {
    width: 26px; height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--gray-300);
    font-size: 12px;
    transition: all var(--transition);
    cursor: pointer;
    background: none;
    border: none;
    margin-left: 8px;
    flex-shrink: 0;
}
.cart-item-remove:hover { color: var(--stock-out); background: #FEF2F2; }

/* Cart footer */
.cart-ft {
    padding: 18px 22px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cart-ft-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--gray-500);
}
.cart-ft-row.total {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 900;
    color: var(--primary);
    padding-top: 10px;
    border-top: 2px solid var(--border);
}
.cart-ft-row.total span:last-child { color: var(--orange); }
.cart-wa-note {
    font-size: 11px;
    color: var(--gray-400);
    text-align: center;
    line-height: 1.4;
}
.cart-clear-btn {
    font-size: 11px;
    color: var(--gray-400);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    font-family: var(--font-head);
    transition: color var(--transition);
}
.cart-clear-btn:hover { color: var(--stock-out); }

/* ── Responsive ──────────────────────── */
@media (max-width: 1024px) {
    .header-search { max-width: 300px; }
    #nav-menu li a { padding: 7px 8px; font-size: 12.5px; }
}
@media (max-width: 900px) {
    .menu-toggle { display: flex; }
    #main-nav {
        position: fixed;
        top: 68px; left: 0; right: 0;
        background: var(--white);
        border-top: 1px solid var(--border);
        padding: 10px 16px 16px;
        z-index: 499;
        display: none;
        box-shadow: var(--shadow-lg);
    }
    #main-nav.open { display: block; }
    #nav-menu { flex-direction: column; align-items: stretch; gap: 2px; }
    #nav-menu li a { padding: 11px 16px; }
    .header-search { display: none; }
}
@media (max-width: 640px) {
    .h-icon-btn.cuenta-icon { display: none; }
    #cart-sidebar { width: 100vw; }
}