/* ==============================================================================
   KEYWALA - MODERN UPGRADED HEADER STYLES
   ============================================================================== */

/* --- 1. Top Announcement & Support Bar --- */
.kw-topbar {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12.5px;
    color: #475569;
    padding: 7px 0;
    position: relative;
    z-index: 1002;
}

.kw-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.kw-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kw-topbar-link {
    color: #475569 !important;
    text-decoration: none !important;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}

.kw-topbar-link:hover {
    color: #008746 !important;
}

.kw-topbar-sep {
    color: #cbd5e1;
    font-size: 11px;
}

/* Center Delivery Pill */
.kw-topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.kw-delivery-pill {
    display: inline-flex;
    align-items: center;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 20px;
    padding: 3px 14px;
    font-size: 12px;
    color: #065f46;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.kw-pulse-dot {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: kwPulse 2s infinite;
}

@keyframes kwPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.kw-delivery-text {
    font-weight: 600;
    margin-right: 4px;
}

.kw-delivery-highlight {
    color: #dc2626;
    font-weight: 700;
}

/* Right User Account & Auth */
.kw-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kw-auth-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kw-auth-link {
    color: #334155 !important;
    font-weight: 600;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
    cursor: pointer !important;
    position: relative;
    z-index: 1003;
    pointer-events: auto !important;
}

.kw-auth-link:hover {
    color: #008746 !important;
    background: #e2e8f0;
}

.kw-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kw-user-chip-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 3px 10px 3px 4px;
    border-radius: 20px;
    color: #0f172a !important;
    font-weight: 600;
    text-decoration: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
}

.kw-user-chip-link:hover {
    border-color: #a7f3d0;
    background: #f0fdf4;
    color: #008746 !important;
}

.kw-avatar-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #008746, #059669);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.kw-logout-link {
    color: #64748b !important;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none !important;
    transition: color 0.15s ease;
}

.kw-logout-link:hover {
    color: #ef4444 !important;
}


/* --- 2. Main Branding & Search Header --- */
.kw-main-header {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.kw-brand-logo img {
    max-height: 46px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.kw-brand-logo:hover img {
    transform: scale(1.02);
}

/* Smart Search Capsule */
.kw-search-form {
    margin: 0;
    width: 100%;
}

.kw-search-capsule {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 50px;
    padding: 3px 4px 3px 16px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    width: 100%;
}

.kw-search-capsule:focus-within {
    border-color: #008746;
    box-shadow: 0 0 0 3px rgba(0, 135, 70, 0.12), 0 3px 8px rgba(0, 0, 0, 0.06);
}

.kw-search-prefix-icon {
    color: #94a3b8;
    font-size: 14px;
    margin-right: 10px;
    flex-shrink: 0;
}

.kw-search-input {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 6px 8px !important;
    height: 38px !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    flex-grow: 1;
}

.kw-search-input::placeholder {
    color: #94a3b8 !important;
    font-size: 13.5px;
}

.kw-search-category-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border-left: 1px solid #e2e8f0;
    padding-left: 12px;
    padding-right: 8px;
    margin-right: 4px;
    flex-shrink: 0;
}

.kw-search-category-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    padding-right: 20px;
    max-width: 150px;
}

.kw-select-chevron {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #94a3b8;
    pointer-events: none;
}

.kw-search-submit-btn {
    background: #008746 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 40px !important;
    height: 38px !important;
    padding: 0 20px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 135, 70, 0.25);
}

.kw-search-submit-btn:hover {
    background: #007038 !important;
    box-shadow: 0 4px 10px rgba(0, 135, 70, 0.35);
    transform: translateY(-1px);
}

/* Modern Cart Capsule Button */
.kw-cart-capsule {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 50px;
    padding: 6px 16px 6px 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.kw-cart-capsule:hover {
    background: #dcfce7;
    border-color: #86efac;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 135, 70, 0.15);
}

.kw-cart-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #008746;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    position: relative;
    flex-shrink: 0;
}

.kw-cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 800;
    min-width: 19px;
    height: 19px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    padding: 0 4px;
}

.kw-cart-label {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.kw-cart-sub {
    font-size: 11px;
    font-weight: 600;
    color: #059669;
}


/* --- 3. Primary Navigation Bar (Emerald Bar) --- */
.kw-primary-navbar {
    background: linear-gradient(135deg, #008746 0%, #007038 100%);
    box-shadow: 0 4px 12px rgba(0, 135, 70, 0.15);
    position: relative;
    z-index: 99;
}

.kw-navbar-inner {
    position: relative;
}

.kw-main-nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* "All Categories" Master Button */
.kw-all-cat-item {
    position: static !important;
    padding: 5px 10px 5px 0;
}

.kw-all-cat-btn {
    background: #ffffff !important;
    color: #008746 !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    padding: 8px 18px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
    transition: all 0.2s ease !important;
    letter-spacing: 0.1px;
}

.kw-all-cat-btn:hover,
.kw-all-cat-item.hs-mega-menu-opened .kw-all-cat-btn {
    background: #f0fdf4 !important;
    color: #007038 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18) !important;
    transform: translateY(-1px);
}

/* Regular Category Links */
.kw-nav-item {
    padding: 4px 1px;
}

.kw-nav-link {
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 7px 11px !important;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    text-decoration: none !important;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.kw-nav-link:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.kw-nav-icon {
    font-size: 11px;
    opacity: 0.85;
}

/* Others Dropdown */
.kw-nav-others {
    position: relative;
}

.kw-others-dropdown {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.2) !important;
    padding: 8px 0 !important;
    min-width: 210px !important;
    list-style: none !important;
    margin-top: 6px !important;
}

.kw-others-dropdown li {
    list-style: none !important;
}

.kw-others-link {
    display: flex !important;
    align-items: center !important;
    padding: 8px 16px !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.kw-others-link:hover {
    background: #f0fdf4 !important;
    color: #008746 !important;
}

/* Flash Deal Pill on Right */
.kw-nav-flash-deal {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    letter-spacing: 0.2px;
}

.kw-nav-flash-deal:hover {
    background: #ffffff;
    color: #008746 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.kw-nav-flash-deal:hover .text-warning {
    color: #f59e0b !important;
}

/* Mobile Search Icon Button */
.kw-mobile-search-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}


/* ==============================================================================
   CUSTOM SEARCH CATEGORY DROPDOWN STYLES
   ============================================================================== */

.kw-search-category-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border-left: 1px solid #e2e8f0;
    padding-left: 10px;
    padding-right: 6px;
    margin-right: 4px;
    flex-shrink: 0;
}

.kw-search-category-btn {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 6px 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    cursor: pointer !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    max-width: 150px;
    transition: color 0.15s ease;
}

/* Hide duplicate Bootstrap caret ::after */
.kw-search-category-btn::after,
.kw-search-category-btn.dropdown-toggle::after {
    display: none !important;
    content: none !important;
    border: none !important;
    margin: 0 !important;
}

.kw-search-category-btn:hover {
    color: #008746 !important;
}

.kw-category-selected-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 115px;
    display: inline-block;
}

.kw-search-category-wrap .kw-select-chevron {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.kw-search-category-wrap.show .kw-select-chevron {
    transform: rotate(180deg);
    color: #008746;
}

/* Dropdown Menu Container */
.kw-category-menu {
    position: absolute !important;
    top: calc(100% + 12px) !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    width: 320px !important;
    max-width: 90vw !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 45px -8px rgba(0, 0, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.06) !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 999999 !important;
    overflow: visible !important;
    animation: kwDropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Upward pointer arrow positioned right beneath the All Categories button */
.kw-category-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 30px;
    width: 12px;
    height: 12px;
    background: #f8fafc;
    border-top: 1px solid #cbd5e1;
    border-left: 1px solid #cbd5e1;
    transform: rotate(45deg);
    z-index: 10;
}

@keyframes kwDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header with Title and Filter Input */
.kw-cat-menu-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 14px 10px;
    border-radius: 13px 13px 0 0;
}

.kw-cat-menu-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.kw-cat-menu-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
}

.kw-cat-menu-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

.kw-cat-menu-search {
    position: relative;
    display: flex;
    align-items: center;
}

.kw-cat-search-icon {
    position: absolute;
    left: 10px;
    color: #94a3b8;
    font-size: 11px;
    pointer-events: none;
}

.kw-cat-search-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 5px 10px 5px 28px;
    font-size: 12px;
    font-weight: 500;
    color: #1e293b;
    outline: none;
    transition: all 0.15s ease;
}

.kw-cat-search-input:focus {
    border-color: #008746;
    box-shadow: 0 0 0 2px rgba(0, 135, 70, 0.15);
}

.kw-cat-search-input::placeholder {
    color: #94a3b8;
    font-size: 11.5px;
}

/* Scrollable Options List */
.kw-cat-menu-body {
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 8px;
}

.kw-cat-menu-body::-webkit-scrollbar {
    width: 5px;
}

.kw-cat-menu-body::-webkit-scrollbar-track {
    background: #f8fafc;
}

.kw-cat-menu-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.kw-cat-menu-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Section Header */
.kw-cat-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.kw-cat-section-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: 9.5px;
    padding: 1px 5px;
    border-radius: 6px;
    font-weight: 700;
}

/* Option Items */
.kw-cat-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    color: #334155;
    text-decoration: none !important;
}

.kw-cat-option-item:hover {
    background: #f0fdf4;
    color: #008746;
    transform: translateX(2px);
}

.kw-cat-option-item.active {
    background: #ecfdf5;
    color: #008746;
    font-weight: 700;
}

.kw-cat-option-all {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 9px;
    margin-bottom: 6px;
}

.kw-cat-opt-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    min-width: 0;
}

.kw-cat-opt-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #008746;
    flex-shrink: 0;
    overflow: hidden;
}

.kw-cat-opt-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}

.kw-icon-all {
    background: #e0f2fe;
    color: #0284c7;
}

.kw-cat-opt-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kw-cat-opt-name {
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.kw-cat-opt-desc {
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.2;
}

.kw-cat-opt-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.kw-cat-check-icon {
    font-size: 11px;
    color: #008746;
    display: none;
}

.kw-cat-option-item.active .kw-cat-check-icon {
    display: inline-block;
}

.kw-cat-jump-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    transition: all 0.15s ease;
    text-decoration: none !important;
    opacity: 0;
}

.kw-cat-option-item:hover .kw-cat-jump-btn {
    opacity: 1;
    background: #dcfce7;
    color: #008746;
}

.kw-cat-jump-btn:hover {
    background: #008746 !important;
    color: #ffffff !important;
    transform: scale(1.1);
}

/* Footer Link */
.kw-cat-menu-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 8px 12px;
    text-align: center;
    border-radius: 0 0 13px 13px;
}

.kw-cat-viewall-link {
    font-size: 11.5px;
    font-weight: 700;
    color: #008746 !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s ease;
}

.kw-cat-viewall-link:hover {
    color: #007038 !important;
    transform: translateX(2px);
}

/* --- Account Sidebar Drawer Guard Rules --- */
/* Prevent hidden or closed sidebar drawer from ever overlaying topbar or blocking clicks */
.u-sidebar.u-unfold--hidden,
.u-sidebar:not(.u-sidebar--opened):not(.active)[aria-labelledby] {
    pointer-events: none !important;
}
.u-sidebar.u-unfold--hidden {
    display: none !important;
    visibility: hidden !important;
}
.u-sidebar.u-sidebar--opened,
.u-sidebar.active,
.u-sidebar.u-unfold--css-animation:not(.u-unfold--hidden) {
    pointer-events: auto !important;
}

.kw-topbar {
    position: relative;
    z-index: 1005 !important;
}
.kw-topbar-right,
.kw-auth-links,
.kw-auth-link {
    position: relative;
    z-index: 1006 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}
