﻿/* Unified search styling for Index + Compare (Bootstrap 5.3 theme-aware) */

.searchbox {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    border-radius: 45px;
    transition: box-shadow .2s, border-color .2s;
}

    /* Glow the whole box when input is focused */
    .searchbox:focus-within {
        box-shadow: 0 0 0 1px rgba(var(--bs-primary-rgb), 0.7), 0 0 14px rgba(var(--bs-primary-rgb), 0.28), 0 0 28px rgba(var(--bs-primary-rgb), 0.15);
    }

    .searchbox .search-icon {
        position: absolute;
        top: 50%;
        right: 1rem;
        transform: translateY(-50%);
        pointer-events: none;
        opacity: .6;
    }

.search-ui {
    position: relative;
    z-index: 101;
}

/* Centered search input, full-width */
.searchbox .form-control.query {
    text-align: center;
    width: 100%;

    /* Let padding control height (avoid hard height/line-height fights) */
    height: auto;
    line-height: 1.2;

    /* Only set left padding here; keep right padding controlled by pe-5 */
    padding-left: 2.5rem;

    font-weight: 400;
    background-color: var(--app-input-bg);
    border: 2px solid var(--app-input-border, var(--bs-border-color));
    color: var(--app-input-text, var(--bs-body-color));
    border-radius: 45px;
    transition: background-color .2s, color .2s, border-color .2s;
}

/* Mobile */
.searchbox .form-control.query {
    font-size: 1.2rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

/* md and up */
@media (min-width: 768px) {
    .searchbox .form-control.query {
        font-size: 1.8rem;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

    .searchbox .form-control::placeholder {
        position: relative;
        top: -3px;
        color: var(--app-input-placeholder);
        opacity: 1; /* Firefox */
    }

    /* Prevent inner glow / underline */
    .searchbox .form-control:focus {
        outline: none;
        box-shadow: none;
        border-color: transparent;
    }

/* Results container */
.search-results {
    position: relative;
    z-index: 100;
    display: none;
    max-width: 700px;
    margin: .25rem auto 0;
}

    .search-results.show {
        display: block;
    }

/* Floating panel */
.search-results-panel {
    position: absolute;
    inset-inline: 0;
    top: 0;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .625rem;
    overflow: hidden;
    /* subtle elevation that works in both themes */
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

/* Result item */
.search-item {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: .5rem;
    padding: .65rem .9rem;
    text-decoration: none;
    color: var(--bs-dropdown-link-color);
    border-bottom: 1px solid var(--bs-border-color);
    background-color: var(--app-surface-bg);
}

    .search-item:last-child {
        border-bottom: none;
    }

    /* Active/hover state: clear contrast on any theme */
    .search-item:hover,
    .search-item.is-active {       
        color:var(--bs-emphasis-color);
        background-color: var(--app-surface-hover);
    }

/* Secondary text bits */
.job-description-search {
    font-size: .95rem;
    display: inline-flex;
    align-items: center;
}

.soc-code-search {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: .80rem;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: left;
}

/* Loader */
.search-loader {
    width: 90px;
    height: 32px;
    margin: 8px auto 0;
    color: var(--bs-secondary-color);
}

    .search-loader p {
        margin: 0;
        text-align: center;
    }

    .search-loader span {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        /* use currentColor so it adapts to theme */
        background: color-mix(in oklab, currentColor 40%, transparent);
        margin: 10px 4px;
        animation: bounce 1s ease-in-out infinite;
    }

        .search-loader span:nth-child(2) {
            animation-delay: .2s;
        }

        .search-loader span:nth-child(3) {
            animation-delay: .4s;
        }

@keyframes bounce {
    0%, 75%, 100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-12px);
    }
}

/* Empty/error states */
.search-empty,
.search-error {
    padding: .9rem;
    font-size: .95rem;
    color: var(--bs-body-color);
}

/* Full-page overlay for focus */
.search-overlay {
    position: fixed;
    inset: 0;
    background: var(--bs-backdrop-bg, rgba(0,0,0,.5));
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease-out;
    z-index: 90;
}

    .search-overlay.show {
        opacity: var(--bs-backdrop-opacity, .5);
        pointer-events: auto;
    }

/* Prevent body scroll when overlay visible (shared pattern) */
.modal-open {
    overflow: hidden;
}

/* Mobile tweaks */
@media (max-width: 600px) {
    .search-item {
        grid-template-columns: 1fr;
    }

    .soc-code-search {
        justify-content: start;
    }
}