
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results-list {
    padding: 8px 0;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
    cursor: pointer;
}

.search-result-item:hover,
.search-result-item.active {
    background: #f3f4f6;
}

.result-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border-radius: 6px;
    color: #3b82f6;
    flex-shrink: 0;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-description {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-type {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-item mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 2px;
    border-radius: 2px;
}

.search-view-all {
    display: block;
    padding: 12px 16px;
    text-align: center;
    color: #3b82f6;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-top: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.search-view-all:hover {
    background: #f9fafb;
}

.search-loading,
.search-no-results,
.search-error {
    padding: 24px;
    text-align: center;
    color: #6b7280;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.search-no-results i,
.search-error i {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.search-error {
    color: #ef4444;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .search-autocomplete {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        max-height: calc(100vh - 80px);
    }
    
    .result-description {
        -webkit-line-clamp: 1;
    }
}


@media (max-width: 980px) {
  /* Mobile: logo only, hide text next to logo */
  #headerMiddlePanel .logo-wrapper {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    max-width: none !important;
  }
  #headerMiddlePanel .logo-wrapper img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  #headerMiddlePanel .logo-expanded-title,
  #headerMiddlePanel  #headerMiddlePanel #expandedBrandLockup  /* Force mobile centered site title to stay visible */
  #headerMiddlePanel .header-top-bar .top-bar-brand-mobile {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1 !important;
    pointer-events: none !important;
    max-width: 30vw !important;
    font-size: 8px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}


/* Mobile header compatibility patch: preserve desktop-like content on mobile only */
@media (max-width: 980px) {
  #headerMiddlePanel,
  .header-row1,
  .header-row2,
  .header-row3 {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  #headerMiddlePanel .header-row1,
  #headerMiddlePanel .header-row2,
  #headerMiddlePanel .header-row3 {
    gap: 4px !important;
    row-gap: 3px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
  }
  .hamburger-search-wrapper,
  .search-filter-container,
  #searchWrapper,
  #searchForm,
  .search-box {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    box-sizing: border-box !important;
  }
  .hamburger-search-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  html body #mainHeader #searchForm .search-box,
  html body #mainHeader .search-box {
    border-radius: 10px !important;
    padding: 0 2px 0 5px !important;
    overflow: hidden !important;
  }
  #oldSearchInput {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 10.5px !important;
    line-height: 18px !important;
    height: 18px !important;
    padding: 0 2px !important;
  }
  html body #mainHeader #searchCategory {
    flex: 0 0 auto !important;
    max-width: 76px !important;
    font-size: 10px !important;
    height: 18px !important;
    padding: 0 12px 0 2px !important;
    margin-right: 0 !important;
    background-color: #fff !important;
    border-top-right-radius: 9px !important;
    border-bottom-right-radius: 9px !important;
  }
  html body #mainHeader {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
  html body #mainHeader #ufoHeaderContent.header-container {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 auto !important;
  }
  html body #mainHeader #headerMiddlePanel {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 2px 4px 4px !important;
    gap: 0 !important;
    row-gap: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }
  html body #mainHeader .header-top-bar {
    order: 0 !important;
    flex: 0 0 auto !important;
    margin-bottom: 0 !important;
  }
  html body #mainHeader .header-row1,
  html body #mainHeader .mobile-header-row1 {
    order: 1 !important;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 4px !important;
    align-items: center !important;
    overflow: visible !important;
  }
  html body #mainHeader #searchWrapper,
  html body #mainHeader #searchForm {
    min-height: 0 !important;
    height: auto !important;
    max-height: 28px !important;
  }
  html body #mainHeader .hamburger-search-wrapper,
  html body #mainHeader .search-filter-container {
    min-height: 0 !important;
    height: auto !important;
    max-height: 28px !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    align-items: center !important;
  }
  html body #mainHeader .hamburger-search-wrapper {
    padding-left: 30px !important;
    padding-right: 0 !important;
    justify-content: flex-start !important;
  }
  html body #mainHeader .header-row1 .search-box,
  html body #mainHeader .mobile-header-row1 .search-box {
    margin-bottom: 0 !important;
  }
  html body #mainHeader .header-row1 .filter-btn,
  html body #mainHeader .mobile-header-row1 .filter-btn {
    width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    align-self: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html body #mainHeader #headerSecondRow > .header-center {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    align-items: center !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
  html body #mainHeader #headerMiddlePanel .logo-wrapper {
    position: absolute !important;
    left: 5px !important;
    bottom: 5px !important;
    top: auto !important;
    margin: 0 !important;
    transform: translateY(-8px) !important;
    z-index: 10002 !important;
  }
  html body #mainHeader #headerSecondRow,
  html body #mainHeader #headerSecondRow.header-second-row,
  html body #mainHeader .header-second-row {
    padding: 0 30px 0 30px !important;
    width: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    flex: 0 0 auto !important;
    flex-grow: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    align-self: stretch !important;
    flex-shrink: 0 !important;
    order: 2 !important;
    justify-content: center !important;
  }
  html body #mainHeader #headerSecondRow .header-center {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    scrollbar-width: none !important;
  }
  #headerSecondRow .header-center::-webkit-scrollbar { display: none !important; height: 0 !important; }
  html body #mainHeader #headerSecondRow #navigator-container {
    padding: 0 !important;
    margin: 0 auto !important;
    gap: 0 !important;
    transform: none !important;
    margin-left: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-content: center !important;
    align-items: center !important;
  }
  html body #mainHeader #navigator-container > .nav-item:not(:has(.nav-btn)) {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 0 !important;
  }
  html body #mainHeader #navigator-container > .nav-item:has(.nav-btn) {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    align-self: stretch !important;
    justify-content: stretch !important;
    width: auto !important;
    height: auto !important;
    min-width: 46px !important;
    max-width: none !important;
    overflow: visible !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    contain: none !important;
  }
  html body #mainHeader #navigator-container > .nav-item.at-nav-community-hub {
    margin: 0 !important;
    min-width: 50px !important;
  }
  #headerSecondRow .header-center .nav-btn {
    white-space: nowrap !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    min-width: 46px !important;
    min-height: 40px !important;
    width: auto !important;
    max-width: none !important;
    padding: 4px 5px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }
  #headerSecondRow .header-center .nav-btn i:not(.fa-caret-down) {
    display: block !important;
    margin-right: 0 !important;
    font-size: 12px !important;
  }
  html body #mainHeader #navigator-container .nav-text,
  html body #mainHeader .header-second-row .nav-text,
  #headerSecondRow .header-center .nav-text {
    display: block !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
  html body #mainHeader #navigator-container .at-nav-community-hub .nav-text,
  html body #mainHeader .header-second-row .at-nav-community-hub .nav-text,
  #headerSecondRow .header-center .at-nav-community-hub .nav-text {
    font-size: 7px !important;
    line-height: 1.1 !important;
  }
}


/* Desktop: restore horizontal nav row inside header panel */
@media (min-width: 981px) {
  html body #mainHeader #searchForm .search-box,
  html body #mainHeader .search-box {
    overflow: hidden !important;
    padding-right: 2px !important;
    box-sizing: border-box !important;
  }
  html body #mainHeader #searchCategory {
    margin-right: 0 !important;
    padding-right: 14px !important;
    background-color: #fff !important;
    border-top-right-radius: 14px !important;
    border-bottom-right-radius: 14px !important;
  }
  html body #mainHeader {
    height: 76px !important;
    min-height: 76px !important;
    max-height: 76px !important;
    box-sizing: border-box !important;
  }
  html.ufo-autohide-enabled:not(.ufo-autohide-open) body #mainHeader {
    height: 86px !important;
    min-height: 86px !important;
    max-height: 86px !important;
  }
  html body #mainHeader #headerMiddlePanel {
    height: 76px !important;
    min-height: 76px !important;
    max-height: 76px !important;
    padding-bottom: 4px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
  }
  html body #mainHeader #headerMiddlePanel .header-top-bar {
    order: 0 !important;
  }
  html body #mainHeader #headerMiddlePanel .header-row1,
  html body #mainHeader #headerMiddlePanel .mobile-header-row1 {
    order: 1 !important;
    margin-top: 0 !important;
  }
  html body #mainHeader #headerMiddlePanel .header-second-row,
  html body #mainHeader #headerSecondRow {
    order: 2 !important;
  }
  html.ufo-autohide-enabled:not(.ufo-autohide-open) body #mainHeader #headerMiddlePanel {
    height: 86px !important;
    min-height: 86px !important;
    max-height: 86px !important;
  }
  html body #mainHeader #headerMiddlePanel .logo-wrapper {
    bottom: 4px !important;
  }
  html body #mainHeader #headerMiddlePanel .header-second-row,
  html body #mainHeader #headerSecondRow,
  html body #mainHeader #headerSecondRow.header-second-row {
    align-self: stretch !important;
    min-height: 20px !important;
    max-height: 24px !important;
    height: 20px !important;
    transform: translateY(-3px) !important;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    left: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 220px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }
  html body #mainHeader #headerSecondRow > .header-center,
  html body #mainHeader #headerSecondRow .header-center {
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
  }
  html body #mainHeader #headerSecondRow #navigator-container,
  html body #mainHeader #navigator-container {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 0 !important;
    justify-content: space-evenly !important;
    align-items: center !important;
    gap: 0 !important;
  }
  html body #mainHeader #navigator-container > .nav-item:not(:has(.nav-btn)) {
    display: none !important;
  }
  html body #mainHeader #navigator-container > .nav-item:has(.nav-btn) {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    flex: 1 1 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  html body #mainHeader #headerSecondRow .nav-btn,
  html body #mainHeader #navigator-container .nav-btn {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: auto !important;
    min-height: auto !important;
    height: auto !important;
    padding: 0 4px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    color: #1e293b !important;
    line-height: 1 !important;
    gap: 6px !important;
    border-radius: 0 !important;
    background: transparent !important;
    transition: color 0.2s ease !important;
  }
  html body #mainHeader #headerSecondRow .nav-btn > i:not(.fa-caret-down),
  html body #mainHeader #navigator-container .nav-btn > i:not(.fa-caret-down) {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    font-size: 13px !important;
    flex-shrink: 0 !important;
  }
  html body #mainHeader #headerSecondRow .nav-btn > i.fa-caret-down,
  html body #mainHeader #navigator-container .nav-btn > i.fa-caret-down {
    display: inline-flex !important;
    font-size: 9px !important;
    margin-left: 2px !important;
    opacity: 0.7 !important;
  }
  html body #mainHeader #headerSecondRow .nav-text,
  html body #mainHeader #navigator-container .nav-text {
    display: inline !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    line-height: 1 !important;
    text-align: left !important;
  }
  html body #mainHeader #headerSecondRow .at-nav-community-hub .nav-text {
    font-size: 12px !important;
  }
  html body #mainHeader #headerSecondRow .nav-btn:hover,
  html body #mainHeader #navigator-container .nav-btn:hover {
    color: #2563eb !important;
  }
}

