/* ===================================================
    HEADER 
   =================================================== */
/* ===== LAYOUT RESET ===== */
a {
    text-decoration: none;
}

/* ===== TOP PROMO BAR ===== */
.toko-promo-bar {
    background-color: var(--toko-green);
    height: 32px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.toko-promo-bar__inner {
    max-width: var(--container-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toko-promo-bar__left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: color-mix(in srgb, var(--white), transparent 8%);
}

.toko-promo-bar__left a {
    color: color-mix(in srgb, var(--white), transparent 8%);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.toko-promo-bar__left a:hover {
    color: var(--white);
}

.toko-promo-bar__left .promo-highlight {
    background: color-mix(in srgb, var(--white), transparent 80%);
    color: var(--white);
    font-weight: 800;
    padding: 1px 8px;
    border-radius: 100px;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.toko-promo-bar__right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toko-promo-bar__right a {
    color: color-mix(in srgb, var(--white), transparent 10%);
    font-size: 12px;
    font-weight: 500;
    transition: color 0.15s;
}

.toko-promo-bar__right a:hover {
    color: var(--white);
}

.toko-promo-bar__divider {
    width: 1px;
    height: 12px;
    background: color-mix(in srgb, var(--white), transparent 65%);
}

/* ===== TOP-LEVEL STICKY HEADER ===== */
header {
    position: sticky;
    top: 0;
    z-index: 10001;
    background: color-mix(in srgb, var(--white), transparent 10%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid color-mix(in srgb, var(--toko-border), transparent 20%);
    width: 100%;
    transition: transform 0.3s ease;
}

/* ===== MAIN HEADER ===== */
.toko-main-header {
    position: relative;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--toko-border);
    box-shadow: 0 1px 4px color-mix(in srgb, var(--black), transparent 94%);
}

.toko-main-header {
    border-bottom: none;
    box-shadow: none;
}

.toko-main-header__inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 16px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: clip;
    /* Prevent horizontal spill */
}

@media (max-width: 1024px) {
    .toko-main-header__inner {
        gap: 8px;
        padding: 0 12px;
    }
}

/* ===== LOGO ===== */
.toko-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.toko-logo img {
    height: 32px;
    width: auto;
    object-fit: contain;
    object-position: left center;
}

.toko-logo__text {
    font-size: 22px;
    font-weight: 800;
    color: var(--toko-green);
    letter-spacing: -0.5px;
    line-height: 1;
}

.toko-logo__text span {
    color: var(--toko-text);
}

/* ===== SEARCH BAR ===== */
.toko-search {
    flex: 1;
    max-width: 680px;
    position: relative;
}

.toko-search__form {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--toko-green);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    background: var(--white);
}

.toko-search__form:focus-within {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--toko-green), transparent 85%);
}

.toko-search__input {
    flex: 1;
    height: 42px;
    padding: 0 16px;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    color: var(--toko-text);
    background: transparent;
}

.toko-search__input::placeholder {
    color: #64748b !important;
    /* WCAG AA: 4.47:1 on white (was #94a3b8 = 2.45) */
    font-size: 14px;
}

.toko-search__btn {
    width: 52px;
    background: var(--toko-green);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toko-search__btn svg {
    color: var(--white);
}

/* Search Dropdowns */
#searchHistoryHeader,
#liveSearchDropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--toko-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--black), transparent 88%);
    z-index: 10002;
    overflow: hidden;
    animation: slideDownFade 0.2s ease-out;
}

/* ===== NAV ICONS ===== */
.toko-nav-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toko-icon-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    color: var(--toko-text);
    gap: 2px;
    border: 1px solid var(--toko-border);
    background: var(--white);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.toko-icon-btn:hover {
    background: var(--toko-surface);
}

.toko-icon-btn i {
    font-size: 20px;
    color: var(--toko-text);
    line-height: 1;
}

.toko-icon-btn__label {
    font-size: 10px;
    font-weight: 500;
    color: var(--toko-text);
    white-space: nowrap;
    line-height: 1;
}

.toko-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    background: var(--toko-red);
    color: var(--white);
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 100px;
    padding: 0 4px;
    border: 1.5px solid var(--white);
    line-height: 1;
}

/* ===== AUTH BUTTONS ===== */
.toko-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.toko-btn-login {
    padding: 9px 20px;
    border-radius: 8px;
    border: 1.5px solid var(--toko-green);
    background: var(--white);
    color: var(--toko-green);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.toko-btn-login:hover {
    background: var(--toko-green-light);
}

.toko-btn-register {
    padding: 9px 20px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    background: var(--toko-green);
    color: var(--white);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.toko-btn-register:hover {
    background: var(--toko-green-dark);
}

/* ===== USER PROFILE ===== */
.toko-user-menu {
    position: relative;
}

.toko-user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.toko-user-trigger:hover {
    background: var(--toko-surface);
}

.toko-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--toko-border);
}

.toko-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--toko-text);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toko-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--white);
    border: 1px solid var(--toko-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 10001;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.toko-user-menu:hover .toko-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toko-dropdown-header {
    padding: 14px 16px;
    background: var(--toko-green-light);
    border-bottom: 1px solid var(--toko-border);
}

.toko-dropdown-tier {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--white);
    color: #B45309;
    /* Consider keeping this if it's a specific brand tier color not in tokens, or map to --product-text-muted if acceptable */
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 100px;
    border: 1px solid #fde68a;
    /* Special tier border color */
    margin-bottom: 4px;
}

.toko-dropdown-points {
    font-size: 12px;
    color: var(--toko-text-secondary);
    font-weight: 600;
}

.toko-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--toko-text);
    transition: background 0.15s;
}

.toko-dropdown-item:hover {
    background: var(--toko-surface);
}

.toko-dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--toko-text-secondary);
    font-size: 14px;
}

.toko-dropdown-item.danger {
    color: var(--danger);
}

.toko-dropdown-item.danger i {
    color: var(--danger);
}

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

/* ===== CATEGORY LITE BAR ===== */
.toko-cat-bar {
    background: var(--toko-white);
    border-bottom: 1px solid var(--toko-border);
}

.toko-cat-bar__inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 16px;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.toko-cat-bar__inner::-webkit-scrollbar {
    display: none;
}

.toko-cat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--toko-text);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--toko-border);
    background: var(--white);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    font-family: inherit;
}

.toko-cat-pill:hover {
    background: var(--toko-green-light);
    color: var(--toko-green);
}

.toko-cat-pill.active {
    background: var(--toko-green-light);
    color: var(--toko-green);
}

.toko-cat-pill i {
    font-size: 13px;
}

/* ===== ALPINE CLOAK ===== */
[x-cloak] {
    display: none !important;
}

/* ===== MEGA MENU ===== */
.toko-mega-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10005;
    /* MUST be higher than header (10001) */
}

/* Base state should be invisible if NOT using x-show, 
   but with x-show we rely on internal Alpine styling. 
   We remove display:none to prevent conflict with Alpine's x-show. */

.toko-mega-overlay {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--black), transparent 60%);
}

.toko-mega-panel {
    position: absolute;
    top: calc(32px + 64px + 40px);
    /* promo + header + catbar */
    left: 0;
    width: 100%;
    background: var(--white);
    box-shadow: 0 8px 32px color-mix(in srgb, var(--black), transparent 88%);
    animation: slideDownFade 0.2s ease-out;
}

.toko-mega-panel__inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 24px 16px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
}

.toko-mega-col h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--toko-text);
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}

.toko-mega-col h4:hover {
    color: var(--toko-green);
}

.toko-mega-col h4 i {
    font-size: 12px;
    color: var(--toko-text-secondary);
}

.toko-mega-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toko-mega-col ul a {
    font-size: 13px;
    color: var(--toko-text-secondary);
    font-weight: 500;
    transition: color 0.15s;
}

.toko-mega-col ul a:hover {
    color: var(--toko-green);
}

/* ===== BOTTOM SHEET (Mobile) ===== */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--black), transparent 50%);
    z-index: 10003;
}

.bottom-sheet-content {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    border-radius: 16px 16px 0 0;
    max-height: 75vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--toko-surface);
    border-radius: 2px;
    margin: 12px auto 0;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--toko-border);
}

.sheet-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--toko-text);
}

.btn-close-sheet {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--toko-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--toko-text);
    transition: background 0.15s;
}

.btn-close-sheet:hover {
    background: var(--toko-surface);
}

.sheet-body {
    padding: 16px 20px;
}

.sheet-category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sheet-cat-group {
    border-bottom: 1px solid var(--toko-surface);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

.sheet-parent {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--toko-text);
    cursor: pointer;
    transition: color 0.15s;
}

.sheet-parent:hover {
    color: var(--toko-green);
}

.sheet-parent i {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.sheet-children {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-left: 36px;
    margin-top: 4px;
}

.sheet-sub-pill {
    padding: 5px 12px;
    border: 1px solid var(--toko-border);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: var(--toko-text);
    background: var(--white);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.sheet-sub-pill:hover:not(:disabled) {
    border-color: var(--toko-green);
    color: var(--toko-green);
    background: var(--toko-green-light);
}

.sheet-sub-pill:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 16px;
    background: var(--toko-green);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 0 0 8px 8px;
    font-size: 14px;
    font-weight: 700;
    z-index: 99999;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* ===== ADDRESS BAR ===== */
.toko-address-bar {
    background: var(--toko-surface);
    border-bottom: 1px solid var(--toko-border);
}

.toko-address-bar__inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 16px;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--toko-text-secondary);
}

.toko-address-bar__city {
    font-weight: 700;
    color: var(--toko-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.toko-address-bar__city:hover {
    color: var(--toko-green);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .toko-mega-panel__inner {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .toko-promo-bar {
        display: none;
    }

    .toko-cat-bar {
        display: none;
    }

    .toko-address-bar {
        display: none;
    }

    .toko-main-header__inner {
        height: 56px;
        gap: 8px;
    }

    .toko-search {
        display: none;
    }

    /* Mobile search in separate row */
    .toko-icon-btn__label {
        display: none;
    }

    .toko-icon-btn {
        width: 42px;
        height: 42px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .toko-auth .toko-btn-register {
        display: none;
    }
}

/* ===== MOBILE SEARCH ROW ===== */
.toko-mobile-search {
    display: none;
    background: var(--toko-white);
    padding: 8px 16px 10px;
    border-bottom: 1px solid var(--toko-border);
}

@media (max-width: 768px) {
    .toko-main-header__inner {
        height: 56px;
    }

    .toko-mobile-search {
        display: block;
        position: relative;
        /* Stick with parent header */
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: 1px solid var(--toko-border);
        box-shadow: 0 4px 6px -1px color-mix(in srgb, var(--black), transparent 94%);
        max-width: 100vw;
    }
}

@media (max-width: 480px) {
    .toko-logo__text {
        font-size: 18px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .toko-btn-register {
        display: none !important;
    }

    .toko-main-header__inner {
        gap: 6px;
        padding: 0 10px;
        height: 52px;
    }

    .toko-auth {
        gap: 4px;
    }

    .toko-btn-login {
        padding: 8px 12px;
        font-size: 13px;
    }

    .toko-mobile-search {
        padding: 6px 10px 8px;
    }
}

.toko-mobile-search .toko-search {
    display: block;
    max-width: 100%;
}

/* ===== MINIMALIST FOOTER REDESIGN ===== */
.minimal-footer {
    background-color: var(--toko-surface);
    color: var(--toko-text);
    font-family: var(--font-body);
    border-top: 1px solid var(--toko-border);
    margin-top: 64px;
}

.container-max {
    max-width: var(--container-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-grid-minimal {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
}

@media (min-width: 640px) {
    .footer-grid-minimal {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer-grid-minimal {
        grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    }
}

.footer-brand-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.footer-brand-title span {
    color: var(--toko-green);
}

.footer-slogan {
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray);
    margin-top: 12px;
}

.footer-col-head {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--dark);
    margin-bottom: 24px;
    display: block;
}

.footer-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-nav-list li {
    margin-bottom: 12px;
}

.footer-nav-list a {
    font-size: 14px;
    color: var(--gray);
    text-decoration: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-nav-list a:hover {
    color: var(--toko-green);
}

.footer-contact-item {
    margin-bottom: 20px;
}

.footer-contact-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--fs-text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.footer-contact-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--toko-text);
    text-decoration: none;
    word-break: break-all;
}

.footer-address-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray);
}

.footer-bottom-minimal {
    border-top: 1px solid var(--toko-border);
    padding: 32px 0;
    background: var(--white);
}

.footer-bottom-flex {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

@media (min-width: 768px) {
    .footer-bottom-flex {
        flex-direction: row;
    }
}

.footer-copyright {
    font-size: 13px;
    color: var(--fs-text-muted);
    font-weight: 500;
}

.footer-legal-links {
    display: flex;
    gap: 24px;
}

.footer-legal-links a {
    font-size: 13px;
    color: var(--gray);
    text-decoration: none;
    font-weight: 600;
}

.footer-legal-links a:hover {
    text-decoration: underline;
}


.footer-nib-badge {
    font-size: 10px;
    color: var(--fs-text-muted);
    font-style: italic;
}

/* ===== SOP UTILITIES & HELPERS ===== */
.toko-fs-10 {
    font-size: var(--text-xs);
}

.toko-fs-13 {
    font-size: var(--text-md);
}

.toko-badge-lite {
    background: var(--toko-surface);
    color: var(--toko-text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.toko-text-green {
    color: var(--toko-green);
}

.toko-text-secondary {
    color: var(--toko-text-secondary);
}