/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TABUTECH Header Ultimate Pro v12.0.0
   ✨ Refactored with BEM, Performance Optimizations, Better A11y
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ========== CSS VARIABLES ========== */
:root {
    /* Gray Scale */
    --tabutech-gray-50: #fafafa;
    --tabutech-gray-100: #f5f5f5;
    --tabutech-gray-200: #e5e5e5;
    --tabutech-gray-300: #d4d4d4;
    --tabutech-gray-400: #a3a3a3;
    --tabutech-gray-500: #737373;
    --tabutech-gray-600: #525252;
    --tabutech-gray-700: #404040;
    --tabutech-gray-800: #262626;
    --tabutech-gray-900: #171717;
    
    /* Typography */
    --tabutech-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    
    /* Shadows - Optimized */
    --tabutech-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --tabutech-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
    --tabutech-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    
    /* Transitions - Specific properties only */
    --tabutech-transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --tabutech-transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --tabutech-transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index scale */
    --tabutech-z-header: 1000;
    --tabutech-z-sidebar: 10002;
    --tabutech-z-overlay: 10001;
    --tabutech-z-search-palette: 10100;
    --tabutech-z-bottom-nav: 10200;  /* FIX: > search-palette so nav always on top */
    --tabutech-z-toast: 10300;
}

/* ========== RESET & BASE ========== */
.tabutech-header__topbar,
.tabutech-header__main,
.tabutech-header__search-bar,
.tabutech-header__sidebar,
.tabutech-header__overlay {
    box-sizing: border-box;
}

.tabutech-header__topbar *,
.tabutech-header__main *,
.tabutech-header__search-bar *,
.tabutech-header__sidebar *,
.tabutech-header__overlay * {
    box-sizing: border-box;
}

/* Screen reader only */
.tabutech-header__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========== CONTAINER ========== */
.tabutech-header__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 768px) {
    .tabutech-header__container {
        padding: 0 16px;
    }
}

/* ========== TOP BAR (LINE 1) ========== */
.tabutech-header__topbar {
    background: linear-gradient(135deg, var(--tabutech-gray-800) 0%, var(--tabutech-gray-900) 100%);
    color: var(--tabutech-gray-100);
    padding: 10px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-family: var(--tabutech-font-family);
}

.tabutech-header__topbar .tabutech-header__container {
    justify-content: space-between;
}

.tabutech-header__topbar-left,
.tabutech-header__topbar-right {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.tabutech-header__topbar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.85;
    transition: opacity var(--tabutech-transition-base);
}

.tabutech-header__topbar-item:hover {
    opacity: 1;
}

.tabutech-header__social {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    text-decoration: none;
    transition: background-color var(--tabutech-transition-base),
                transform var(--tabutech-transition-base);
}

.tabutech-header__social:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

/* ========== MAIN HEADER (LINE 2) ========== */
.tabutech-header__main {
    background: white;
    border-bottom: 1px solid var(--tabutech-gray-200);
    padding: 16px 0;
    /* FIX v12: position handled by .tabutech-header__sticky-wrapper */
    box-shadow: var(--tabutech-shadow-sm);
    transition: box-shadow var(--tabutech-transition-base),
                padding var(--tabutech-transition-base);
    font-family: var(--tabutech-font-family);
}

/* Logo */
.tabutech-header__logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--tabutech-gray-900);
    text-decoration: none;
    letter-spacing: -0.5px;
    transition: color var(--tabutech-transition-base),
                transform var(--tabutech-transition-base);
    font-family: var(--tabutech-font-family);
    display: flex;
    align-items: center;
}

.tabutech-header__logo:hover {
    transform: scale(1.02);
}

.tabutech-header__logo img {
    max-height: 36px;
    transition: transform var(--tabutech-transition-base);
}

.tabutech-header__logo:hover img {
    transform: scale(1.05);
}

/* Navigation */
.tabutech-header__nav {
    display: flex;
    gap: 32px;
    align-items: center;
    margin-left: auto;
}

.tabutech-header__nav-link {
    color: var(--tabutech-gray-700);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color var(--tabutech-transition-base);
    position: relative;
    padding: 8px 4px;
    font-family: var(--tabutech-font-family);
}

.tabutech-header__nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    border-radius: 9999px;
    transform: scaleX(0);
    transition: transform var(--tabutech-transition-base);
}

.tabutech-header__nav-link:hover::after {
    transform: scaleX(1);
}

/* Tools (Icon Buttons) */
.tabutech-header__tools {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: auto;
}

.tabutech-header__icon {
    width: 40px;
    height: 40px;
    background: var(--tabutech-gray-100);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tabutech-gray-700);
    cursor: pointer;
    font-size: 16px;
    transition: background-color var(--tabutech-transition-slow),
                color var(--tabutech-transition-slow),
                transform var(--tabutech-transition-slow),
                box-shadow var(--tabutech-transition-slow);
    position: relative;
    border: none;
    box-shadow: var(--tabutech-shadow-sm);
}

.tabutech-header__icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1px;
    background: linear-gradient(135deg, transparent, rgba(99, 102, 241, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--tabutech-transition-base);
}

.tabutech-header__icon:hover::before {
    opacity: 1;
}

.tabutech-header__icon:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--tabutech-shadow-lg);
}

/* Cart Badge */
.tabutech-header__cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: tabutech-badge-pop 0.3s ease-out;
}

@keyframes tabutech-badge-pop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.tabutech-header__cart-count-fragment {
    position: absolute;
    top: -4px;
    right: -4px;
}

/* ========== SEARCH BAR (LINE 3) ========== */
.tabutech-header__search-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    padding: 12px 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
    font-family: var(--tabutech-font-family);
    /* FIX v12: position handled by .tabutech-header__sticky-wrapper */
}

.tabutech-header__search-bar .tabutech-header__container {
    gap: 16px;
}

/* Categories Button */
.tabutech-header__categories-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background-color var(--tabutech-transition-slow),
                transform var(--tabutech-transition-slow),
                box-shadow var(--tabutech-transition-slow);
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.15);
    font-family: var(--tabutech-font-family);
    position: relative;
    overflow: hidden;
}

.tabutech-header__categories-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.tabutech-header__categories-btn:hover::before {
    left: 100%;
}

.tabutech-header__categories-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

.tabutech-header__categories-arrow {
    font-size: 12px;
    transition: transform var(--tabutech-transition-base);
}

.tabutech-header__categories-btn:hover .tabutech-header__categories-arrow {
    transform: rotate(180deg);
}

/* Search Input */
.tabutech-header__search {
    flex: 1;
    position: relative;
}

.tabutech-header__search-wrapper {
    position: relative;
}

/* Mobile Search Button with Text */
.tabutech-header__search-btn-mobile {
    width: 100%;
    height: 44px;
    background: #f5f5f5;
    color: #525252;
    border: none;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--tabutech-transition-base),
                transform var(--tabutech-transition-base);
    font-family: var(--tabutech-font-family);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tabutech-header__search-btn-mobile:active {
    transform: scale(0.98);
    background: #e5e5e5;
}

.tabutech-header__search-btn-mobile i {
    font-size: 16px;
}

.tabutech-header__search-input {
    width: 100%;
    padding: 14px 60px 14px 24px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: var(--tabutech-gray-900);
    font-size: 15px;
    transition: background-color var(--tabutech-transition-slow),
                border-color var(--tabutech-transition-slow),
                box-shadow var(--tabutech-transition-slow),
                transform var(--tabutech-transition-slow);
    font-family: var(--tabutech-font-family);
    box-shadow: var(--tabutech-shadow-sm);
}

.tabutech-header__search-input::placeholder {
    color: var(--tabutech-gray-400);
    font-weight: 400;
}

.tabutech-header__search-input:focus {
    outline: none;
    background: white;
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08), 
                0 0 0 4px rgba(99, 102, 241, 0.04);
    transform: translateY(-1px);
}

.tabutech-header__search-icon {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tabutech-gray-400);
    font-size: 18px;
    pointer-events: none;
}

/* Search Results Dropdown */
.tabutech-header__search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    animation: tabutech-fade-in 0.2s ease-out;
}

@keyframes tabutech-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tabutech-header__search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--tabutech-gray-900);
    transition: background-color var(--tabutech-transition-base);
    border-bottom: 1px solid var(--tabutech-gray-100);
}

.tabutech-header__search-result:last-child {
    border-bottom: none;
}

.tabutech-header__search-result:hover,
.tabutech-header__search-result:focus {
    background: var(--tabutech-gray-50);
    outline: none;
}

.tabutech-header__search-result-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.tabutech-header__search-result-info {
    flex: 1;
    min-width: 0;
}

.tabutech-header__search-result-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tabutech-header__search-result-price {
    font-size: 13px;
    color: #6366f1;
    font-weight: 600;
}

.tabutech-header__search-result--category {
    font-weight: 500;
}

.tabutech-header__search-result--category i {
    color: var(--tabutech-gray-400);
}

.tabutech-header__search-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--tabutech-gray-400);
    font-size: 14px;
}

/* ========== SIDEBARS ========== */
.tabutech-header__sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 380px;
    max-width: 90vw;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: var(--tabutech-z-sidebar);
    transition: transform var(--tabutech-transition-slow);
    display: flex;
    flex-direction: column;
    font-family: var(--tabutech-font-family);
}

.tabutech-header__sidebar--left {
    left: 0;
    transform: translateX(-100%);
}

.tabutech-header__sidebar--right {
    right: 0;
    transform: translateX(100%);
}

/* Submenu Sidebar - Desktop only, positioned next to main sidebar */
.tabutech-header__sidebar--submenu {
    left: 380px; /* Positioned right of main sidebar */
    transform: translateX(-100%); /* Hidden initially - moves to left: 0 */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex; /* Visible on desktop, hidden on mobile via media query */
    visibility: hidden; /* Extra safety - hidden until active */
    opacity: 0; /* Smooth appearance */
    transition: transform var(--tabutech-transition-slow), 
                opacity var(--tabutech-transition-slow),
                visibility 0s var(--tabutech-transition-slow); /* Delay visibility until after animation */
}

.tabutech-header__sidebar--submenu.active {
    transform: translateX(0); /* Slides in */
    visibility: visible; /* Show when active */
    opacity: 1; /* Fade in */
    transition: transform var(--tabutech-transition-slow), 
                opacity var(--tabutech-transition-slow),
                visibility 0s 0s; /* Immediate visibility when opening */
}

.tabutech-header__sidebar.active {
    transform: translateX(0);
}

/* Desktop: ensure submenu sidebar stays visible when opened */
@media (min-width: 769px) {
    .tabutech-header__sidebar--submenu {
        display: flex !important;
    }
}

/* Mobile: submenu sidebar completely hidden - content swaps instead */
@media (max-width: 768px) {
    .tabutech-header__sidebar--submenu {
        display: none !important; /* Hidden on mobile - content swaps instead */
    }
    
    .tabutech-header__sidebar--left {
        width: 100%;
        max-width: 100%;
    }
    
    /* Mobile submenu mode - prepare for content swap */
    .tabutech-header__sidebar--submenu-mode .tabutech-header__sidebar-content {
        position: relative;
        overflow-y: auto !important; /* ✅ Scroll enabled */
        -webkit-overflow-scrolling: touch; /* Smooth iOS scroll */
    }
}

.tabutech-header__sidebar-header {
    padding: 20px 24px;
    border-bottom: 2px solid var(--tabutech-gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--tabutech-gray-50);
    flex-shrink: 0;
}

/* Submenu sidebar header - show only when active on desktop or in submenu mode on mobile */
.tabutech-header__sidebar--submenu .tabutech-header__sidebar-header {
    display: none;
}

.tabutech-header__sidebar--submenu.active .tabutech-header__sidebar-header {
    display: flex; /* Show on desktop when submenu is active */
}

/* Show on mobile when main sidebar is in submenu mode */
@media (max-width: 768px) {
    .tabutech-header__sidebar--submenu-mode > .tabutech-header__sidebar-header {
        display: none; /* Hide main sidebar header in submenu mode */
    }
}

.tabutech-header__sidebar-header span {
    font-size: 18px;
    font-weight: 700;
    color: var(--tabutech-gray-900);
}

.tabutech-header__sidebar-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tabutech-gray-600);
    cursor: pointer;
    font-size: 20px;
    transition: background-color var(--tabutech-transition-base),
                color var(--tabutech-transition-base);
}

.tabutech-header__sidebar-close:hover {
    background: var(--tabutech-gray-200);
    color: var(--tabutech-gray-900);
}

.tabutech-header__sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

/* Sidebar scrollbar */
.tabutech-header__sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.tabutech-header__sidebar-content::-webkit-scrollbar-track {
    background: var(--tabutech-gray-100);
}

.tabutech-header__sidebar-content::-webkit-scrollbar-thumb {
    background: var(--tabutech-gray-300);
    border-radius: 3px;
}

.tabutech-header__sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--tabutech-gray-400);
}

/* ========== CATEGORIES SIDEBAR ========== */
.tabutech-header__category {
    position: relative;
    margin-bottom: 8px;
}

.tabutech-header__category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    color: var(--tabutech-gray-900);
    text-decoration: none;
    background: var(--tabutech-gray-50);
    border-radius: 10px;
    font-weight: 500;
    font-size: 15px;
    transition: background-color var(--tabutech-transition-base),
                color var(--tabutech-transition-base),
                transform var(--tabutech-transition-fast);
    border: none; /* For button variant */
    width: 100%; /* For button variant */
    text-align: left; /* For button variant */
    cursor: pointer; /* For button variant */
    font-family: var(--tabutech-font-family); /* For button variant */
}

.tabutech-header__category-link:hover {
    background: var(--tabutech-gray-100);
    transform: translateX(4px);
}

.tabutech-header__category-link:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.tabutech-header__category-arrow {
    font-size: 14px;
    color: var(--tabutech-gray-400);
    transition: transform var(--tabutech-transition-base),
                color var(--tabutech-transition-base);
}

.tabutech-header__category-link:hover .tabutech-header__category-arrow {
    color: #6366f1;
    transform: translateX(4px);
}

/* Submenu Groups (content in submenu sidebar) */
.tabutech-header__submenu-group {
    display: none; /* Hidden by default, shown by JS */
}

.tabutech-header__submenu-group.active,
.tabutech-header__submenu-group[style*="display: block"],
.tabutech-header__submenu-group[style*="display: flex"] {
    display: block;
}

.tabutech-header__submenu-back {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--tabutech-gray-900);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: color var(--tabutech-transition-base);
    font-family: var(--tabutech-font-family);
}

.tabutech-header__submenu-back:hover {
    color: #6366f1;
}

.tabutech-header__submenu-back i {
    font-size: 18px;
}

.tabutech-header__submenu-item {
    display: block;
    padding: 14px 16px;
    color: var(--tabutech-gray-900);
    text-decoration: none;
    background: var(--tabutech-gray-50);
    border-radius: 10px;
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 8px;
    transition: background-color var(--tabutech-transition-base),
                color var(--tabutech-transition-base),
                transform var(--tabutech-transition-fast);
}

.tabutech-header__submenu-item:hover {
    background: var(--tabutech-gray-100);
    color: #6366f1;
    transform: translateX(4px);
}

/* ========== SIDEBAR SEARCH (MOBILE) ========== */
.tabutech-header__sidebar-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tabutech-header__sidebar-search input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--tabutech-gray-200);
    border-radius: 10px;
    background: var(--tabutech-gray-50);
    color: var(--tabutech-gray-900);
    font-size: 15px;
    transition: border-color var(--tabutech-transition-base),
                background-color var(--tabutech-transition-base),
                box-shadow var(--tabutech-transition-base);
    font-family: var(--tabutech-font-family);
}

.tabutech-header__sidebar-search input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tabutech-header__sidebar-search button {
    background: #6366f1;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color var(--tabutech-transition-base);
}

.tabutech-header__sidebar-search button:hover {
    background: #4f46e5;
}

/* ========== SIDEBAR LINKS ========== */
.tabutech-header__sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--tabutech-gray-900);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: background-color var(--tabutech-transition-base);
    margin-bottom: 4px;
}

.tabutech-header__sidebar-link:hover {
    background: var(--tabutech-gray-50);
}

.tabutech-header__sidebar-link i {
    font-size: 16px;
    color: var(--tabutech-gray-500);
}

.tabutech-header__divider {
    height: 1px;
    background: var(--tabutech-gray-200);
    margin: 16px 0;
}

/* ========== AUTH FORMS ========== */
.tabutech-header__auth-wrapper {
    padding: 24px;
}

.tabutech-header__auth-form input[type="text"],
.tabutech-header__auth-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tabutech-gray-200);
    border-radius: 10px;
    background: var(--tabutech-gray-50);
    color: var(--tabutech-gray-900);
    font-size: 15px;
    transition: border-color var(--tabutech-transition-base),
                background-color var(--tabutech-transition-base),
                box-shadow var(--tabutech-transition-base);
    margin-bottom: 16px;
    font-family: var(--tabutech-font-family);
}

.tabutech-header__auth-form input:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tabutech-header__auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    cursor: pointer;
}

.tabutech-header__auth-btn {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background-color var(--tabutech-transition-base),
                color var(--tabutech-transition-base),
                transform var(--tabutech-transition-base),
                box-shadow var(--tabutech-transition-base);
    border: 2px solid transparent;
    font-family: var(--tabutech-font-family);
    margin-top: 12px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.tabutech-header__auth-btn--primary {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    margin-top: 0; /* First button - no margin */
}

.tabutech-header__auth-btn--primary:hover:not(:disabled) {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: var(--tabutech-shadow-md);
}

.tabutech-header__auth-btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tabutech-header__auth-btn--outline {
    background: transparent;
    color: #6366f1;
    border-color: #6366f1;
}

.tabutech-header__auth-btn--outline:hover {
    background: #6366f1;
    color: white;
}

/* Secondary button - lighter style */
.tabutech-header__auth-btn--secondary {
    background: var(--tabutech-gray-100);
    color: var(--tabutech-gray-700);
    border-color: var(--tabutech-gray-200);
}

.tabutech-header__auth-btn--secondary:hover {
    background: var(--tabutech-gray-200);
    color: var(--tabutech-gray-900);
}

/* Auth divider */
.tabutech-header__auth-divider {
    height: 1px;
    background: var(--tabutech-gray-200);
    margin: 20px 0;
}

.tabutech-header__auth-link {
    display: block;
    text-align: center;
    color: #6366f1;
    text-decoration: none;
    font-size: 14px;
    margin-top: 16px;
    transition: text-decoration var(--tabutech-transition-base);
    font-weight: 500;
}

.tabutech-header__auth-link:hover {
    text-decoration: underline;
}

/* Auth footer - removed, using divider instead */

.tabutech-header__auth-alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 10px;
}

.tabutech-header__auth-alert--success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #6ee7b7;
}

.tabutech-header__auth-alert--error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fca5a5;
}

/* ========== CART ITEMS ========== */
.tabutech-header__cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--tabutech-gray-50);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: background-color var(--tabutech-transition-base),
                opacity var(--tabutech-transition-base);
}

.tabutech-header__cart-item:hover {
    background: var(--tabutech-gray-100);
}

.tabutech-header__cart-item[aria-busy="true"] {
    opacity: 0.5;
    pointer-events: none;
}

.tabutech-header__cart-item-image {
    flex-shrink: 0;
}

.tabutech-header__cart-item-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.tabutech-header__cart-item-info {
    flex: 1;
    min-width: 0;
}

.tabutech-header__cart-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tabutech-header__cart-item-qty {
    color: var(--tabutech-gray-600);
    font-size: 13px;
}

.tabutech-header__cart-item-remove {
    color: var(--tabutech-gray-400);
    cursor: pointer;
    transition: color var(--tabutech-transition-base),
                background-color var(--tabutech-transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    text-decoration: none;
}

.tabutech-header__cart-item-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.tabutech-header__cart-total {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: var(--tabutech-gray-50);
    border-radius: 10px;
    margin: 16px 0;
    font-weight: 600;
    border: 2px solid var(--tabutech-gray-200);
}

.tabutech-header__cart-actions {
    display: flex;
    gap: 10px;
}

.tabutech-header__cart-btn {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    text-decoration: none;
    transition: background-color var(--tabutech-transition-base),
                color var(--tabutech-transition-base),
                transform var(--tabutech-transition-base),
                box-shadow var(--tabutech-transition-base);
    font-size: 15px;
    display: inline-block;
}

.tabutech-header__cart-btn--outline {
    background: transparent;
    border: 2px solid #6366f1;
    color: #6366f1;
}

.tabutech-header__cart-btn--outline:hover {
    background: #6366f1;
    color: white;
}

.tabutech-header__cart-btn--primary {
    background: #6366f1;
    color: white;
    border: 2px solid #6366f1;
}

.tabutech-header__cart-btn--primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: var(--tabutech-shadow-md);
}

.tabutech-header__cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--tabutech-gray-400);
}

.tabutech-header__cart-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
    display: block;
}

.tabutech-header__cart-sidebar-count {
    color: #6366f1;
}

/* ========== OVERLAY ========== */
.tabutech-header__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: var(--tabutech-z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--tabutech-transition-base),
                visibility var(--tabutech-transition-base);
    cursor: pointer;
}

.tabutech-header__overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========== TOAST NOTIFICATIONS ========== */
.tabutech-header__toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 10003;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    max-width: 400px;
    animation: tabutech-slide-in 0.3s ease-out;
}

@keyframes tabutech-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.tabutech-header__toast--error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.tabutech-header__toast--success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #6ee7b7;
}

/* ========== RESPONSIVE ========== */
.tabutech-header__desktop-only {
    display: flex;
}

.tabutech-header__mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .tabutech-header__desktop-only {
        display: none !important;
    }
    
    .tabutech-header__mobile-only {
        display: flex !important;
    }
    
    /* Hide Top Bar on Mobile */
    .tabutech-header__topbar {
        display: none;
    }

    /* Hide Search Bar row (Line 3) on Mobile — bottom nav handles search */
    .tabutech-header__search-bar {
        display: none !important;
    }
    
    /* Main Header adjustments */
    .tabutech-header__main {
        padding: 12px 0;
    }
    
    .tabutech-header__main .tabutech-header__container {
        justify-content: space-between;
    }
    
    .tabutech-header__logo {
        font-size: 20px;
    }
    
    .tabutech-header__tools {
        margin-left: 0;
    }
    
    /* Categories button - icon only */
    .tabutech-header__categories-btn {
        width: auto;
        min-width: 150px;
        height: 44px;
        padding: 10px 20px;
        justify-content: center;
        gap: 8px;
        font-size: 14px;
    }
    
    .tabutech-header__categories-btn i {
        font-size: 16px;
    }
    
    .tabutech-header__categories-btn span {
        display: inline !important; /* Show text on mobile */
    }
    
    /* Full screen sidebars */
    .tabutech-header__sidebar {
        width: 100vw !important;
        max-width: 100vw !important;
    }
    
    /* Submenu sidebar hidden on mobile - content swaps in main sidebar instead */
    .tabutech-header__sidebar--submenu {
        display: none !important;
    }
    
    /* Mobile content swap animation container */
    .tabutech-header__sidebar--submenu-mode .tabutech-header__sidebar-content {
        position: relative;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    .tabutech-header__logo {
        font-size: 18px;
    }
    
    .tabutech-header__icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* ========== ACCESSIBILITY ========== */
/* Focus visible styles */
*:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tabutech-header__icon,
    .tabutech-header__categories-btn,
    .tabutech-header__auth-btn {
        border: 2px solid currentColor;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v12.0.0 — BUG FIX & CLEANUP (see tabutech-ultimate.php changelog) + BOTTOM NAV + GLASSMORPHISM + CART UPSELL
   ═══════════════════════════════════════════════════════════════════════════ */

/* ========== SMART STICKY WRAPPER (Desktop) ========== */

.tabutech-header__sticky-wrapper {
    position: sticky;
    top: 0;
    z-index: var(--tabutech-z-header);
    transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.tabutech-header__sticky-wrapper--hidden {
    transform: translateY(-100%);
}

.tabutech-header__sticky-wrapper--glass .tabutech-header__main,
.tabutech-header__sticky-wrapper--glass .tabutech-header__search-bar {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    border-bottom-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255,255,255,0.6) inset !important;
}

/* ========== MAIN HEADER — remove old sticky, wrapper handles it ========== */

.tabutech-header__main {
    position: relative !important;
    top: auto !important;
    z-index: auto !important;
    transition: background 300ms ease,
                box-shadow 300ms ease,
                padding 300ms ease !important;
}

.tabutech-header__search-bar {
    position: relative !important;
    top: auto !important;
    z-index: auto !important;
}

/* Scrolled state — compact padding */
.tabutech-header__sticky-wrapper--scrolled .tabutech-header__main {
    padding: 10px 0 !important;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07) !important;
}

.tabutech-header__sticky-wrapper--scrolled .tabutech-header__logo {
    font-size: 20px !important;
}

.tabutech-header__sticky-wrapper--scrolled .tabutech-header__logo img {
    max-height: 30px !important;
}

/* ========== PRODUCT CONTEXT BAR — disabled ========== */
.tabutech-header__context-bar { display: none !important; }

/* ========== CART UPSELL PROGRESS BAR ========== */

.tabutech-header__cart-upsell {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
}

.tabutech-header__cart-upsell-text {
    color: var(--tabutech-gray-700);
    margin-bottom: 8px;
    line-height: 1.4;
}

.tabutech-header__cart-upsell-text strong {
    color: #0369a1;
}

.tabutech-header__cart-upsell-bar {
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
}

.tabutech-header__cart-upsell-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #38bdf8, #0284c7);
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px;
}

.tabutech-header__cart-upsell--complete {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.tabutech-header__cart-upsell--complete .tabutech-header__cart-upsell-fill {
    background: linear-gradient(90deg, #4ade80, #16a34a);
}

.tabutech-header__cart-upsell--complete .tabutech-header__cart-upsell-text strong {
    color: #15803d;
}

/* ========== CART BADGE — bounce animation ========== */

@keyframes tb-badge-bounce {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.5); }
    60%  { transform: scale(0.85); }
    80%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.tabutech-header__cart-badge--animate {
    animation: tb-badge-bounce 500ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* ========== CART ITEM — remove animation ========== */

@keyframes tb-item-remove {
    0%   { opacity: 1; transform: translateX(0) scaleY(1); max-height: 100px; }
    40%  { opacity: 0.3; transform: translateX(20px) scaleY(0.8); }
    100% { opacity: 0; transform: translateX(40px) scaleY(0); max-height: 0; padding: 0; margin: 0; }
}

.tabutech-header__cart-item--removing {
    animation: tb-item-remove 350ms ease forwards;
    overflow: hidden;
    pointer-events: none;
}

/* ========== SEARCH — Command Palette overlay ========== */

.tabutech-header__search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--tabutech-z-search-palette);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: clamp(60px, 10vh, 120px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease;
}

.tabutech-header__search-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.tabutech-header__search-palette {
    background: white;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.06);
    width: min(680px, calc(100vw - 40px));
    overflow: hidden;
    transform: translateY(-16px) scale(0.97);
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 250ms ease;
    opacity: 0;
}

.tabutech-header__search-overlay.active .tabutech-header__search-palette {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.tabutech-header__search-palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--tabutech-gray-200);
}

.tabutech-header__search-palette-input-wrap i {
    color: var(--tabutech-gray-400);
    font-size: 18px;
    flex-shrink: 0;
}

.tabutech-header__search-palette-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 17px;
    color: var(--tabutech-gray-900);
    background: transparent;
    font-family: var(--tabutech-font-family);
}

.tabutech-header__search-palette-input::placeholder {
    color: var(--tabutech-gray-400);
}

.tabutech-header__search-palette-kbd {
    font-size: 11px;
    color: var(--tabutech-gray-400);
    background: var(--tabutech-gray-100);
    border: 1px solid var(--tabutech-gray-300);
    border-radius: 5px;
    padding: 2px 6px;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}

.tabutech-header__search-palette-body {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.tabutech-header__search-palette-section {
    padding: 6px 20px 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tabutech-gray-400);
}

.tabutech-header__search-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--tabutech-gray-800);
    transition: background 150ms ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--tabutech-font-family);
    font-size: 14px;
}

.tabutech-header__search-palette-item:hover,
.tabutech-header__search-palette-item.focused {
    background: var(--tabutech-gray-50);
}

.tabutech-header__search-palette-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--tabutech-gray-100);
}

.tabutech-header__search-palette-item-icon {
    width: 40px;
    height: 40px;
    background: var(--tabutech-gray-100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tabutech-gray-500);
    flex-shrink: 0;
    font-size: 16px;
}

.tabutech-header__search-palette-item-info {
    flex: 1;
    min-width: 0;
}

.tabutech-header__search-palette-item-title {
    font-weight: 500;
    color: var(--tabutech-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabutech-header__search-palette-item-sub {
    font-size: 12px;
    color: var(--tabutech-gray-400);
    margin-top: 2px;
}

.tabutech-header__search-palette-item-price {
    font-weight: 700;
    color: #6366f1;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Recent search tag */
.tabutech-header__search-recent-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 20px 12px;
}

.tabutech-header__search-recent-tag {
    background: var(--tabutech-gray-100);
    color: var(--tabutech-gray-700);
    border: none;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
    font-family: var(--tabutech-font-family);
}

.tabutech-header__search-recent-tag:hover {
    background: #6366f1;
    color: white;
}

/* ========== MOBILE BOTTOM NAV BAR ========== */

.tabutech-header__bottom-nav {
    display: none; /* desktop-ზე hidden */
}

@media (max-width: 768px) {

    /* body padding for bottom nav */
    body {
        padding-bottom: 70px;
    }

    .tabutech-header__bottom-nav {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: var(--tabutech-z-bottom-nav) !important;
        background: var(--tb-nav-bg, #6366f1) !important;
        border-top: none !important;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18) !important;
        padding: 0 0 max(0px, env(safe-area-inset-bottom)) 0 !important;
        height: calc(58px + max(0px, env(safe-area-inset-bottom))) !important;
        transform: none !important;
        overflow: hidden !important;
    }

    .tabutech-header__bottom-nav-item {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        background: none !important;
        border: none;
        padding: 8px 2px 6px;
        cursor: pointer;
        color: rgba(255, 255, 255, 0.65) !important;
        text-decoration: none;
        font-family: var(--tabutech-font-family);
        transition: color 200ms ease, transform 150ms ease;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        height: 58px;
        box-sizing: border-box;
    }

    .tabutech-header__bottom-nav-item:active {
        transform: scale(0.88);
    }

    .tabutech-header__bottom-nav-item.active,
    .tabutech-header__bottom-nav-item:hover {
        color: #ffffff !important;
    }

    .tabutech-header__bottom-nav-icon {
        width: 22px;
        height: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        position: relative;
        flex-shrink: 0;
    }

    .tabutech-header__bottom-nav-label {
        font-size: 9px;
        font-weight: 500;
        letter-spacing: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        text-align: center;
        line-height: 1.2;
    }

    .tabutech-header__bottom-nav-badge {
        position: absolute;
        top: -4px;
        right: -6px;
        background: #ef4444;
        color: white;
        font-size: 9px;
        font-weight: 700;
        min-width: 16px;
        height: 16px;
        border-radius: 99px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 3px;
        line-height: 1;
    }

    /* Active indicator dot */
    .tabutech-header__bottom-nav-item.active::after {
        content: '';
        position: absolute;
        bottom: -6px;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
    }

    /* Mobile — header not sticky, bottom nav handles it */
    .tabutech-header__sticky-wrapper {
        position: relative !important;
        transform: none !important;
    }

    /* Context bar — hidden on mobile */
    .tabutech-header__context-bar {
        display: none !important;
    }

    /* Search overlay — full screen on mobile */
    .tabutech-header__search-overlay {
        align-items: flex-end;
        padding-top: 0;
    }

    .tabutech-header__search-palette {
        width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }

    .tabutech-header__search-overlay.active .tabutech-header__search-palette {
        transform: translateY(0);
    }

    .tabutech-header__search-palette-body {
        flex: 1;
        max-height: none;
    }
}

/* iOS safe area support */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .tabutech-header__bottom-nav {
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
}

/* ========== TOAST NOTIFICATION ========== */

.tabutech-header__toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--tabutech-gray-900);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: var(--tabutech-z-toast);
    white-space: nowrap;
    pointer-events: none;
    font-family: var(--tabutech-font-family);
}

.tabutech-header__toast--error {
    background: #ef4444;
}

.tabutech-header__toast--success {
    background: #22c55e;
}

