:root {
    --blue: #164587;
    --dark: #18243c;
    --yellow: #f5c518;
    --yellow-hover: #e6b000;
    --nav-bg: #f8f9fb;
    --border: #e4e7ec;
}

.header-container {
    position: static;
}

.header {
    position: fixed; /* cambia sticky → fixed */
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.header__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
    height: 64px;
    /* max-width: 1400px; */
    margin: 0 auto;
}

/* Logo */
.header__logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-mark {
    width: 38px;
    height: 38px;
    background: var(--blue);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 17px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.3px;
}

/* Divider */
.header__divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0;
}

/* Categorías btn */
.btn-categories {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: 9999px;
    background: #fff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    text-decoration: none;
}

.btn-categories svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    flex-shrink: 0;
}

.btn-categories:hover {
    border-color: var(--blue);
    background: #eef2ff;
    color: var(--blue);
}

/* Search */
.header__search {
    flex: 1;
    min-width: 0;
    order: 0; /* posición normal entre categorías y acciones */
}

.search-form {
    display: flex;
    align-items: center;
    height: 44px;
    background: var(--nav-bg);
    border: 1.5px solid var(--border);
    border-radius: 9999px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-form:focus-within {
    background: #fff;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(22, 69, 135, 0.1);
}

.search-form input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    outline: none;
    padding: 0 14px 0 20px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--dark);
}

.search-form input::placeholder {
    color: #a0aab4;
}

.search-btn {
    flex: 0 0 44px;
    height: 100%;
    width: 44px;
    background: var(--yellow);
    border: none;
    border-radius: 0 9999px 9999px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    transition: background 0.18s, transform 0.15s;
}

.search-btn:hover {
    background: var(--yellow-hover);
}
.search-btn:active {
    transform: scale(0.9);
}
.search-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 2.2;
}

/* Right actions */
.header__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    transition: background 0.18s;
    text-decoration: none;
}

.icon-btn:hover {
    background: var(--nav-bg);
}
.icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
}

.x-bagde {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--yellow);
    color: var(--dark);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    line-height: 1;
    animation: bounce-badge 1.8s ease-in-out infinite;
}

@keyframes bounce-badge {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-5px) scale(1.15);
    }
    50% {
        transform: translateY(-2px) scale(1);
    }
    75% {
        transform: translateY(-4px) scale(1.08);
    }
}

.btn-login {
    padding: 9px 18px;
    border-radius: 9999px;
    border: 1.5px solid var(--blue);
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.btn-login:hover {
    background: var(--blue);
    color: #fff !important;
}

.btn-register {
    padding: 9px 18px;
    border-radius: 9999px;
    border: none;
    background: var(--yellow);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700 !important;
    color: var(--dark);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.btn-register:hover {
    background: var(--yellow-hover);
}
.btn-register:active {
    transform: scale(0.96);
}

/* Avatar (logged in) */
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: 2px solid var(--border);
    transition: border-color 0.2s;
}

.avatar:hover {
    border-color: var(--blue);
}

/* ═══════════════════════════════
     SUB NAV
  ═══════════════════════════════ */
/* .subnav {
    background: #fff;
    border-bottom: 1px solid var(--border);
} */

.subnav {
    position: fixed;
    top: 64px; /* justo debajo del header */
    left: 0;
    right: 0;
    z-index: 99;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.subnav__inner {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 28px;
    height: 44px;
    /* max-width: 1400px; */
    margin: 0 auto;
}

.subnav__link {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}

.subnav__link:hover {
    background: var(--nav-bg);
    color: var(--dark);
}
.subnav__link.active {
    background: #eef2fb;
    color: var(--blue);
}

.subnav__pill {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--yellow);
    color: var(--dark);
    text-decoration: none;
    letter-spacing: 0.2px;
    transition: background 0.18s;
}

.subnav__pill:hover {
    background: var(--yellow-hover);
}

.typeahead-standalone {
    width: 100%;
}

/* ── User dropdown ── */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 230px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(24, 36, 60, 0.13);
    padding: 8px;
    z-index: 200;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.user-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* User info header */
.dropdown-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.dropdown-user .avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dropdown-user-info {
    line-height: 1.3;
    min-width: 0;
}
.dropdown-user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dropdown-user-email {
    font-size: 11.5px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Menu items */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--nav-bg);
    color: var(--dark);
}

.dropdown-item svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    flex-shrink: 0;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dropdown-item .item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--nav-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.dropdown-item:hover .item-icon {
    background: #e8edf7;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

.dropdown-item.danger {
    color: #dc2626;
}
.dropdown-item.danger:hover {
    background: #fff5f5;
    color: #dc2626;
}
.dropdown-item.danger:hover .item-icon {
    background: #fee2e2;
}

.mobile-row2 {
    padding-bottom: 4px;
    position: fixed;
    top: 65px; /* justo debajo del header */
    background: #fff;
    width: 100%;
    padding: 5px 10px;
    z-index: 99;
    display: none;
}

@media (max-width: 768px) {
    .header {
        height: 110px;
    }

    .header__inner {
        display: flex !important; /* sigue siendo flex, pero... */
        flex-wrap: wrap; /* permite que los items salten de línea */
        padding: 10px 12px;
        gap: 8px;
    }

    /* Fila 1: logo + categorías van juntos a la izquierda */
    .header__logo {
        order: 1;
    }

    .header__divider {
        order: 2;
    }

    .btn-categories {
        order: 3;
    }

    /* El buscador "salta" a la segunda fila ocupando todo el ancho */
    .header__search {
        order: 4;
        flex: 0 0 100%; /* ocupa el 100% → fuerza salto de línea */
        width: 100%;
    }

    /* Acciones (carrito, auth) van a la derecha de la fila 1 */
    .header__actions {
        order: 3;
        margin-left: auto;
    }

    .subnav__inner {
        padding: 0 12px;
        gap: 0;
        order: 5;
        flex: 0 0 100%;
        overflow-x: auto;
    }

    .subnav__inner a {
        font-size: 11px;
    }

    .btn-categories {
        font-size: 13px;
    }

    .subnav {
        top: 110px;
    }

    /* Botón categorías: solo ícono */
    .btn-categories .cat-label { display: none; }
}
