/* Header v1.2 — top bar + search modal + mega menu */

/* Override legacy top-bar-unified padding (top-bar-footer.css) */
.top-bar-v2.top-bar-unified {
    padding: 0 !important;
    overflow: visible;
}

.top-bar-v2 .container-fluid {
    position: relative;
}

/* ===== Top bar v2 ===== */
.top-bar-v2 {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
    overflow: visible;
    position: relative;
    z-index: 1031;
}

.top-bar-inner-v2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 44px;
    padding: 8px 0;
    flex-wrap: wrap;
}

.top-bar-coupon-zone {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 560px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fffbeb, #ffecb3);
    border: 2px dashed #f9a825;
    border-radius: 999px;
    padding: 0 16px;
    overflow: hidden;
}

.top-bar-v2 .top-coupon-slide {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .4s, transform .4s;
    white-space: nowrap;
    pointer-events: none;
    padding: 0 8px;
}

.top-bar-v2 .top-coupon-slide.active {
    opacity: 1;
    transform: translateY(0);
}

.top-bar-v2 .top-coupon-slide i {
    color: #ff6f00;
    font-size: 15px;
    flex-shrink: 0;
}

.top-coupon-slide .tc-code {
    color: #ff6f00;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: .04em;
}

.top-coupon-slide .tc-save {
    background: #ff6f00;
    color: #fff;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.top-bar-contact-zone {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.top-contact-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    color: #111827;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}

.top-contact-pill:hover {
    background: #fffbeb;
    border-color: #f9a825;
    color: #111827;
}

.top-contact-pill i {
    color: #f9a825;
    font-size: 14px;
}

@media (max-width: 991.98px) {
    .top-bar-inner-v2 {
        justify-content: center;
        min-height: 38px;
        padding: 6px 0;
    }

    .top-bar-contact-zone {
        display: none;
    }

    .top-bar-coupon-zone {
        max-width: 100%;
        width: 100%;
        height: 32px;
        padding: 0 10px;
    }

    .top-coupon-slide {
        font-size: 11px;
        gap: 5px;
    }

    .top-coupon-slide .tc-use {
        display: none;
    }

    .top-coupon-slide .tc-code {
        font-size: 12px;
    }

    .top-coupon-slide .tc-save {
        font-size: 9px;
        padding: 2px 7px;
    }
}

/* Desktop: marquee | coupon | contact */
@media (min-width: 992px) {
    .top-bar-inner-v2 {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        align-items: center;
        gap: 12px 20px;
        flex-wrap: nowrap;
        padding: 8px 0;
        min-height: 44px;
    }

    .top-bar-marquee-zone {
        min-width: 0;
        justify-self: start;
        max-width: 100%;
    }

    .top-bar-coupon-zone {
        justify-self: center;
        flex: none;
        width: auto;
        min-width: 260px;
        max-width: 400px;
        margin: 0;
    }

    .top-bar-contact-zone {
        justify-self: end;
        position: static;
        transform: none;
    }
}

/* Marquee — desktop only */
.top-bar-marquee-mask {
    overflow: hidden;
    max-width: 100%;
    height: 36px;
    display: flex;
    align-items: center;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.top-bar-marquee-track {
    display: flex;
    align-items: center;
    gap: 28px;
    width: max-content;
    animation: topBarMarquee 32s linear infinite;
    will-change: transform;
}

.top-bar-marquee-track:hover {
    animation-play-state: paused;
}

@keyframes topBarMarquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.top-marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    flex-shrink: 0;
}

.top-marquee-item i {
    color: #f9a825;
    font-size: 14px;
    flex-shrink: 0;
}

@media (min-width: 1200px) {
    .top-bar-inner-v2 {
        padding: 10px 0;
        min-height: 48px;
        gap: 16px 28px;
    }

    .top-bar-coupon-zone {
        min-width: 300px;
        height: 38px;
    }

    .top-marquee-item {
        font-size: 13px;
    }

    .top-bar-marquee-mask {
        height: 38px;
    }
}

@media (min-width: 1400px) {
    .top-bar-marquee-mask {
        max-width: 420px;
    }
}

/* ===== Mobile search modal ===== */
.search-modal-content {
    border: none;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    min-height: 280px;
}

@media (min-width: 576px) {
    .search-modal-content {
        border-radius: 20px;
    }
}

.search-modal-header {
    background: linear-gradient(135deg, #1f2937, #374151);
    color: #fff;
    border: none;
    padding: 16px 20px;
}

.search-modal-header .modal-title {
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-modal-header .btn-close {
    filter: invert(1);
    opacity: .85;
}

.search-modal-body {
    padding: 16px 16px 24px;
    background: #f9fafb;
}

.search-modal-form .header-search-box {
    min-height: 52px;
    border-radius: 14px;
    border: 2px solid #f9a825;
    background: #fff;
    box-shadow: 0 4px 16px rgba(249, 168, 37, .15);
}

.search-modal-form .header-search-box input {
    font-size: 16px;
}

.search-modal-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.search-hint-chip {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
}

.search-hint-chip:hover {
    border-color: #f9a825;
    background: #fffbeb;
}

#searchResultsModal {
    margin-top: 12px;
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
}

#searchResultsModal.active {
    display: block;
}

#searchResultsModal:not(.active) {
    display: none;
}

#searchResultsModal .search-result-item {
    padding: 12px 14px;
}

.mobile-search-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #fffbeb, #fff);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2937;
    font-size: 18px;
    flex-shrink: 0;
    margin-left: auto;
    cursor: pointer;
    z-index: 2;
}

.mobile-search-toggle:active {
    transform: scale(.96);
    background: #f9a825;
    border-color: #f9a825;
}

.header-mobile-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-search-wrap-mobile {
    display: none !important;
}

/* Category mega dropdown */
.dropdown-menu-mega {
    border-radius: 16px;
    padding: 16px;
    min-width: min(720px, 92vw);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
    margin-top: 0 !important;
    border: 1px solid #e5e7eb;
}

.dropdown-mega-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 768px) {
    .dropdown-mega-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dropdown-mega-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    transition: background .15s;
}

.dropdown-mega-item:hover {
    background: #fffbeb;
    color: #111827;
}

.dropdown-mega-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #f9a825, #ff6f00);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e293b;
    font-size: 18px;
}

.dropdown-mega-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    background: #1f2937;
    color: #fff !important;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
}

.dropdown-mega-offers {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px dashed #f9a825;
}

.dropdown-mega-offers .dropdown-mega-icon {
    background: #1f2937;
    color: #f9a825;
}

.header-cat-dropdown .dropdown-menu {
    z-index: 1060;
}
