/*
 * Header global search (themes/re/partials/part-global-search.htm).
 * Desktop: a field in the header with a results panel under it.
 * Phone (< 768px): a full-width row under the logo; focusing it opens the
 * search full screen so results get the whole viewport and big touch rows.
 */

.ob-gs {
    --ob-gs-primary: #0079ba;
    --ob-gs-primary-dark: #00568d;
    --ob-gs-primary-soft: #dbedff;
    --ob-gs-active: #f0f7ff;
    --ob-gs-mark: #c7e2ff;
    --ob-gs-heading: #101828;
    --ob-gs-text: #475467;
    --ob-gs-muted: #667085;
    --ob-gs-label: #656e7c;
    --ob-gs-border: #d0d5dd;
    --ob-gs-divider: #eaecf0;
    --ob-gs-field: #f2f4f7;
    --ob-gs-foot: #f9fafb;
    --ob-gs-shadow: 0 4px 6px -2px rgba(16, 24, 40, .03), 0 12px 16px -4px rgba(16, 24, 40, .08);

    position: relative;
    flex: 1 1 280px;
    min-width: 180px;
    max-width: 480px;
    margin: 0 16px;
    color: var(--ob-gs-text);
    font-size: 15px;
    line-height: 1.4;
}

.ob-gs [hidden] { display: none !important; }

/* The theme (front.css) sets svg { margin-bottom: -.4375rem }, which drops every icon here by 7px. */
.ob-gs svg {
    display: block;
    margin: 0;
}

/* ---------- Field ---------- */

.ob-gs__bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ob-gs__field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 6px 0 12px;
    background: var(--ob-gs-field);
    border: 1px solid var(--ob-gs-border);
    border-radius: 8px;
    transition: background-color .15s, border-color .15s, box-shadow .15s;
    cursor: text;
}

.ob-gs.is-open .ob-gs__field,
.ob-gs__field:focus-within {
    background: #fff;
    border-color: var(--ob-gs-primary);
    box-shadow: 0 0 0 4px rgba(0, 121, 186, .25);
}

.ob-gs__icon {
    flex: none;
    color: #344054;
}

.ob-gs__input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    padding: 0;
    font: inherit;
    font-size: 16px; /* 16px keeps iOS from zooming in on focus */
    color: var(--ob-gs-heading);
    -webkit-appearance: none;
    appearance: none;
}
.ob-gs__input::placeholder { color: #798290; opacity: 1; }
.ob-gs__input::-webkit-search-cancel-button,
.ob-gs__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }

.ob-gs__scope {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: none;
    max-width: 45%;
    padding: 2px 2px 2px 8px;
    border-radius: 6px;
    background: var(--ob-gs-primary-soft);
    color: var(--ob-gs-primary-dark);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.ob-gs__scope-label { overflow: hidden; text-overflow: ellipsis; }

.ob-gs__scope-clear,
.ob-gs__clear {
    display: grid;
    place-items: center;
    flex: none;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 6px;
}
.ob-gs__scope-clear { width: 22px; height: 22px; }
.ob-gs__clear { width: 32px; height: 32px; color: #344054; }
.ob-gs__scope-clear:hover,
.ob-gs__clear:hover { background: rgba(16, 24, 40, .06); }

.ob-gs__kbd {
    flex: none;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 24px;
    padding: 0 6px;
    border: 1px solid var(--ob-gs-border);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: #fff;
    color: #61646c;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    box-shadow: none;
}
.ob-gs.is-open .ob-gs__kbd,
.ob-gs.has-query .ob-gs__kbd { display: none; }

.ob-gs__spinner {
    flex: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--ob-gs-primary-soft);
    border-top-color: var(--ob-gs-primary);
    border-radius: 50%;
    animation: ob-gs-spin .7s linear infinite;
}
@keyframes ob-gs-spin { to { transform: rotate(360deg); } }

.ob-gs__cancel {
    display: none;
    flex: none;
    min-height: 44px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--ob-gs-primary);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Panel ---------- */

.ob-gs__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1060;
    width: 640px;
    max-width: calc(100vw - 32px);
    display: flex;
    flex-direction: column;
    max-height: min(640px, calc(100vh - 120px));
    background: #fff;
    border: 1px solid var(--ob-gs-border);
    border-radius: 12px;
    box-shadow: var(--ob-gs-shadow);
    overflow: hidden;
    text-align: left;
}

.ob-gs__chips {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ob-gs-divider);
    overflow-x: auto;
    scrollbar-width: none;
}
.ob-gs__chips::-webkit-scrollbar { display: none; }

.ob-gs__chips-label {
    flex: none;
    margin-right: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ob-gs-label);
}

.ob-gs__chip {
    flex: none;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--ob-gs-border);
    border-radius: 6px;
    background: #fff;
    color: #344054;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.ob-gs__chip:hover { border-color: #8c94a1; }
.ob-gs__chip[aria-pressed="true"] {
    background: var(--ob-gs-primary-soft);
    border-color: #a9d3ff;
    color: var(--ob-gs-primary-dark);
}

.ob-gs__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 0 8px;
}

.ob-gs__detected {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 16px 2px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #eff4ff;
    color: var(--ob-gs-primary-dark);
    font-size: 13px;
    font-weight: 600;
}
.ob-gs__detected svg { flex: none; }

.ob-gs__group { padding-top: 8px; }

.ob-gs__group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 16px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ob-gs-label);
}
.ob-gs__group-more { font-weight: 500; color: var(--ob-gs-muted); }

.ob-gs__row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 16px;
    color: inherit;
    text-decoration: none;
    box-shadow: inset 3px 0 0 transparent;
    cursor: pointer;
}
.ob-gs__row:hover,
.ob-gs__row:focus { color: inherit; text-decoration: none; outline: none; }
.ob-gs__row.is-active {
    background: var(--ob-gs-active);
    box-shadow: inset 3px 0 0 var(--ob-gs-primary);
}

.ob-gs__row-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--ob-gs-primary-soft);
    color: #00629f;
}
.ob-gs__row-icon--recent {
    background: transparent;
    color: var(--ob-gs-muted);
    width: 24px;
}

.ob-gs__row-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.ob-gs__row-title,
.ob-gs__row-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ob-gs__row-title {
    font-weight: 600;
    color: var(--ob-gs-heading);
    font-variant-numeric: tabular-nums;
}
.ob-gs__row-title mark {
    padding: 0 1px;
    border-radius: 3px;
    background: var(--ob-gs-mark);
    color: var(--ob-gs-heading);
    font-weight: 700;
}
.ob-gs__row-meta {
    font-size: 13px;
    color: var(--ob-gs-muted);
}

.ob-gs__badge {
    flex: none;
    display: inline-flex;
    align-items: center;
    max-width: 40%;
    padding: 2px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 64px;
    background: #f2f4f7;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ob-gs__badge--primary { background: #eff4ff; color: #00568d; border-color: #a9d3ff; }
.ob-gs__badge--info    { background: #eef4ff; color: #3538cd; border-color: #c7d7fe; }
.ob-gs__badge--success { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.ob-gs__badge--warning { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.ob-gs__badge--danger  { background: #fff; color: #d92d20; border-color: #f04438; }

.ob-gs__enter {
    flex: none;
    display: none;
    place-items: center;
    height: 24px;
    padding: 0 6px;
    border: 1px solid var(--ob-gs-border);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: #fff;
    color: #61646c;
    font-size: 13px;
    font-weight: 600;
}
.ob-gs__row.is-active .ob-gs__enter { display: grid; }

.ob-gs__empty {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    padding: 12px 16px 16px;
}
.ob-gs__empty-col { min-width: 0; }
.ob-gs__empty-title {
    padding: 4px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ob-gs-label);
}
.ob-gs__empty .ob-gs__row {
    min-height: 44px;
    margin: 0 -8px;
    padding: 6px 8px;
    border-radius: 8px;
    box-shadow: none;
}
.ob-gs__empty .ob-gs__row.is-active { box-shadow: none; }
.ob-gs__empty-note { padding: 8px 0; font-size: 13px; color: var(--ob-gs-muted); }

.ob-gs__help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: calc(100% + 16px);
    min-height: 44px;
    margin: 0 -8px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.ob-gs__help:hover { background: #f2f4f7; }
.ob-gs__help-label { font-weight: 600; color: #1c2430; }
.ob-gs__help-example { font-size: 13px; color: #61646c; white-space: nowrap; }

.ob-gs__none { padding: 24px 16px 20px; }
.ob-gs__none-title {
    margin-bottom: 6px;
    font-size: 18px;
    font-weight: 650;
    color: var(--ob-gs-heading);
    word-break: break-word;
}
.ob-gs__none-hint { margin-bottom: 12px; }
.ob-gs__link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ob-gs-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.ob-gs__link:hover { color: var(--ob-gs-primary-dark); text-decoration: underline; }

.ob-gs__status { padding: 16px; color: var(--ob-gs-muted); }

.ob-gs__foot {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding: 10px 16px;
    border-top: 1px solid var(--ob-gs-divider);
    background: var(--ob-gs-foot);
    font-size: 13px;
    color: #61646c;
}
.ob-gs__foot span { display: inline-flex; align-items: center; gap: 4px; }
.ob-gs__foot kbd {
    padding: 0 6px;
    border: 1px solid var(--ob-gs-border);
    border-radius: 4px;
    background: #fff;
    color: inherit;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
}

/* ---------- Header layout ---------- */

/* Nav labels never break ("Parcels ▾" on two lines) when the search takes room. */
@media (min-width: 768px) {
    #header .u-header__nav-link { white-space: nowrap; }
}

/* Wide screens: one row, header as wide as the design (the lists below are full width too). */
@media (min-width: 1200px) {
    #header #logoAndNav.container { max-width: 1600px; }
}

/* Tablets and small laptops: logo + menu on the first row, the search on its own row. */
@media (min-width: 768px) and (max-width: 1199.98px) {
    #header .u-header__navbar { flex-wrap: wrap; }
    .ob-gs {
        order: 3;
        flex: 0 0 100%;
        max-width: none;
        margin: 8px 0 0;
    }
}

/* ---------- Phone ---------- */

@media (max-width: 767.98px) {
    /* Logo and hamburger stay on the first row, the search takes the second. */
    #header .u-header__navbar { flex-wrap: wrap; }
    #header .u-header__navbar > .navbar-collapse { order: 4; }

    .ob-gs {
        order: 3;
        flex: 0 0 100%;
        max-width: none;
        margin: 10px 0 0;
    }

    .ob-gs__kbd,
    .ob-gs__foot,
    .ob-gs__enter,
    .ob-gs__row.is-active .ob-gs__enter { display: none !important; }

    .ob-gs.is-open {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1100;
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 12px 12px 0;
        padding-top: max(12px, env(safe-area-inset-top));
        background: #fff;
    }
    .ob-gs.is-open .ob-gs__cancel { display: block; }
    .ob-gs.is-open .ob-gs__field { box-shadow: none; }

    .ob-gs.is-open .ob-gs__panel {
        position: static;
        flex: 1 1 auto;
        min-height: 0;
        width: auto;
        max-width: none;
        max-height: none;
        margin: 8px -12px 0;
        border: 0;
        border-top: 1px solid var(--ob-gs-divider);
        border-radius: 0;
        box-shadow: none;
    }
    .ob-gs__body { padding-bottom: max(16px, env(safe-area-inset-bottom)); }

    .ob-gs__chips { padding: 10px 12px; }
    .ob-gs__chips-label { display: none; }
    .ob-gs__chip { height: 36px; }

    .ob-gs__detected { margin: 10px 12px 2px; }
    .ob-gs__group-head { padding: 6px 12px 4px; }
    .ob-gs__row { min-height: 64px; padding: 10px 12px; }
    .ob-gs__badge { max-width: 34%; }
    /* Narrow rows: let the tracking / PID / place line wrap instead of cutting it. */
    .ob-gs__row-meta {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .ob-gs__empty { grid-template-columns: 1fr; gap: 12px; padding: 8px 12px 16px; }
    .ob-gs__none { padding: 20px 12px; }
}

body.ob-gs-lock { overflow: hidden; }
