/* =============================================================
   ACE Instruments – Search + Two-Row Header Styles
   Link from <head>: <link rel="stylesheet" href="ace-search.css">
   ============================================================= */

/* ── FIXED STICKY HEADER (rows 1 + 2) ── */
/*
   position:fixed is used because position:sticky breaks when any
   ancestor has overflow:hidden (common in .page-wrapper themes).
   JS measures the header height and adds matching padding-top to
   body so content never hides underneath the fixed bar.
*/
.ace-sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    transition: box-shadow 0.25s ease;
}

.ace-sticky-header.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* Body offset so content doesn't hide under fixed header.
   The actual value is set dynamically by JS (see script block). */
body.ace-header-fixed {
    /* fallback – JS overwrites this */
    padding-top: 90px;
}

/* ── ROW 2: logo | search | phone ── */
.ace-row2 {
    background: #fff;
    border-bottom: 3px solid #ED2024;
    padding: 14px 0;
}

.ace-row2-inner {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Logo */
.ace-logo { flex-shrink: 0; }
.ace-logo a { display: inline-block; line-height: 0; }
.ace-logo img { height: 58px; width: auto; }

/* Search */
.ace-search-wrap {
    position: relative;
    flex: 1;
    max-width: 540px;
}

.ace-search-box {
    display: flex;
    align-items: stretch;
    border: 2px solid #e0e0e0;
    background: #f8f8f8;
    height: 48px;
    transition: border-color 0.2s, background 0.2s;
}

.ace-search-box:focus-within {
    border-color: #ED2024;
    background: #fff;
}

.ace-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    padding: 0 14px;
    font-size: 14px;
    font-family: var(--thm-font, 'Roboto', sans-serif);
    color: #171717;
    min-width: 0;
}

.ace-search-input::placeholder { color: #aaa; }

.ace-search-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: none;
    background: #ED2024;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    margin: 0;
}

.ace-search-btn:hover { background: #171717; }

/* Phone */
.ace-phone {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

.ace-phone-icon {
    width: 48px;
    height: 48px;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #ED2024;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.ace-phone:hover .ace-phone-icon {
    background: #171717;
    color: #fff;
}

.ace-phone-num a {
    font-size: 17px;
    font-weight: 600;
    color: #171717;
    font-family: var(--thm-font, 'Roboto', sans-serif);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.ace-phone-num a:hover { color: #ED2024; }

/* Mobile hamburger (hidden on desktop) */
.ace-hamburger {
    display: none;
    font-size: 22px;
    color: #ED2024;
    margin-left: auto;
}

/* ── ROW 3: nav bar ── */
.ace-nav-row {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: relative;
    z-index: 100;
}

/* Remove the logo/right block spacing from original .main-menu — we don't need it */
.ace-nav-row .main-menu-wrapper__logo { display: none; }
.ace-nav-row .main-menu-wrapper__right { display: none; }
.ace-nav-row .main-menu-wrapper__left { float: none; }
.ace-nav-row .main-menu-wrapper__main-menu { float: none; }

/* Nav list: horizontal, tighter padding than original */
.ace-nav-row .main-menu__list {
    display: flex !important;
    align-items: center;
    padding: 0;
    margin: 0;
}

.ace-nav-row .main-menu__list > li {
    padding-top: 18px;
    padding-bottom: 18px;
}

.ace-nav-row .main-menu__list > li + li {
    margin-left: 45px;
}

/* Keep mega menu z-index above everything */
.ace-nav-row .dropdown-menu.megamenu {
    z-index: 9999;
}

/* ── Search dropdown ── */
.ace-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.13);
    z-index: 99999;
    max-height: 440px;
    overflow-y: auto;
}

.ace-search-dropdown.open { display: block; }

.ace-sd-head {
    padding: 7px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    font-family: var(--thm-font, 'Roboto', sans-serif);
}

.ace-sd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none !important;
    transition: background 0.12s;
    cursor: pointer;
}

.ace-sd-item:last-of-type { border-bottom: none; }

.ace-sd-item:hover,
.ace-sd-item.ace-active { background: #fff5f5; }

.ace-sd-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: rgba(237,32,36,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #ED2024;
}

.ace-sd-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ace-sd-name {
    font-size: 13.5px;
    font-weight: 500;
    color: #171717;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    font-family: var(--thm-font, 'Roboto', sans-serif);
}

.ace-sd-cat {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    font-family: var(--thm-font, 'Roboto', sans-serif);
}

.ace-sd-arr { font-size: 11px; color: #ccc; flex-shrink: 0; }
.ace-sd-item:hover .ace-sd-arr,
.ace-sd-item.ace-active .ace-sd-arr { color: #ED2024; }

mark.ace-hl {
    background: #fff3cd;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.ace-sd-empty {
    padding: 18px 14px;
    text-align: center;
    font-size: 13.5px;
    color: #888;
    font-family: var(--thm-font, 'Roboto', sans-serif);
}

.ace-sd-more {
    display: block;
    text-align: center;
    padding: 10px 14px;
    background: #fafafa;
    border-top: 1px solid #eee;
    font-size: 13px;
    font-weight: 600;
    color: #ED2024 !important;
    text-decoration: none !important;
    transition: background 0.15s;
    font-family: var(--thm-font, 'Roboto', sans-serif);
}

.ace-sd-more:hover { background: #fff5f5; }

/* ── Responsive ── */
@media (max-width: 1199px) {
    .ace-search-input { font-size: 13px; }
    .ace-phone-num a { font-size: 15px; }
}

@media (max-width: 991px) {
    .ace-row2-inner { gap: 14px; }
    .ace-phone-num a { font-size: 14px; }
    .ace-logo img { height: 46px; }
}

@media (max-width: 767px) {
    /* Hide top address bar (already done by your ace-responsive.css) */
    .main-header__top-inner { display: none; }

    /* Row 2: logo left, hamburger right, search full width below */
    .ace-row2-inner { flex-wrap: wrap; gap: 10px; }
    .ace-phone { display: none; }           /* hide phone on mobile */
    .ace-hamburger { display: flex; }       /* show hamburger */
    .ace-search-wrap { order: 3; flex: 0 0 100%; max-width: 100%; }

    /* Hide the nav row on mobile — your existing mobile-nav JS handles it */
    .ace-nav-row { display: none; }
}