/**
 * BTFC Stats Independent Menu — Global Search
 */

.btfc-global-search {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.btfc-global-search-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    color: #ffffff;
    background: transparent;
    border: none;
    border-radius: var(--btfc-menu-radius-base, 6px);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.btfc-global-search-toggle:hover,
.btfc-global-search.is-open .btfc-global-search-toggle {
    color: var(--btfc-menu-accent, #F5B800);
    background: rgba(255, 255, 255, 0.08);
}

.btfc-global-search-toggle:focus {
    outline: var(--btfc-menu-focus-outline, 2px solid #F5B800);
    outline-offset: 2px;
}

.btfc-global-search-icon {
    display: flex;
    line-height: 0;
}

.btfc-bottom-menu .btfc-global-search {
    margin-left: auto;
    padding-right: 8px;
}

.btfc-global-search-panel {
    display: none;
}

.btfc-global-search.is-open .btfc-global-search-panel,
.btfc-independent-menu .btfc-global-search.is-open .btfc-global-search-panel {
    display: block !important;
}

.btfc-independent-menu .btfc-global-search-toggle[aria-expanded="true"] {
    display: flex !important;
}

.btfc-global-search[data-search-context="desktop"] .btfc-global-search-panel {
    position: absolute;
    top: 50%;
    right: 44px;
    transform: translateY(-50%);
    width: 280px;
    z-index: 1002;
}

.btfc-global-search[data-search-context="desktop"].is-open .btfc-global-search-panel {
    width: min(340px, calc(100vw - 80px));
}

.btfc-global-search-field {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--btfc-menu-border-secondary, rgba(255, 255, 255, 0.2));
    border-radius: var(--btfc-menu-radius-base, 6px);
    padding: 0 6px 0 10px;
}

.btfc-global-search-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 36px;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-family: var(--btfc-menu-font-family, 'Montserrat', sans-serif);
    font-size: 13px;
    outline: none;
}

.btfc-global-search-input::placeholder {
    color: var(--btfc-menu-text-muted, rgba(255, 255, 255, 0.7));
}

.btfc-global-search-input::-webkit-search-decoration,
.btfc-global-search-input::-webkit-search-cancel-button,
.btfc-global-search-input::-webkit-search-results-button,
.btfc-global-search-input::-webkit-search-results-decoration {
    display: none;
}

.btfc-global-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.btfc-global-search-clear:hover {
    color: var(--btfc-menu-accent, #F5B800);
    background: rgba(255, 255, 255, 0.1);
}

.btfc-global-search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    background: #071B36;
    border: 1px solid rgba(245, 184, 0, 0.28);
    border-radius: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    z-index: 1003;
}

.btfc-global-search[data-search-context="desktop"] .btfc-global-search-results {
    min-width: 280px;
}

.btfc-global-search-status {
    padding: 12px 16px;
    color: var(--btfc-menu-text-secondary, rgba(255, 255, 255, 0.9));
    font-size: 13px;
}

.btfc-global-search-group + .btfc-global-search-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btfc-global-search-group-label {
    padding: 8px 16px 4px;
    color: var(--btfc-menu-accent, #F5B800);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.btfc-global-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.btfc-global-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
}

.btfc-global-search-item:hover,
.btfc-global-search-item:focus {
    background: rgba(255, 255, 255, 0.08);
    color: var(--btfc-menu-accent, #F5B800) !important;
}

.btfc-global-search-item-icon {
    flex-shrink: 0;
    width: 1.25em;
    text-align: center;
}

.btfc-global-search-item-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btfc-header-tools {
    display: none;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btfc-header-tools .btfc-mobile-menu-toggle {
    display: block;
    grid-column: auto;
    grid-row: auto;
    justify-self: auto;
}

@media (max-width: 768px) {
    .btfc-header-tools {
        display: flex;
        grid-row: 1;
        grid-column: 2;
        justify-self: end;
        align-self: center;
        max-width: 100%;
    }

    .btfc-global-search[data-search-context="desktop"] {
        display: none;
    }

    .btfc-global-search[data-search-context="mobile"] .btfc-global-search-toggle {
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 8px;
    }

    .btfc-global-search[data-search-context="mobile"].is-open .btfc-global-search-panel {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
        transform: none;
        width: auto;
        z-index: 10050;
        background: rgba(7, 27, 54, 0.97);
        padding: 16px 16px 24px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .btfc-global-search[data-search-context="mobile"] .btfc-global-search-field {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(245, 184, 0, 0.35);
    }

    .btfc-global-search[data-search-context="mobile"] .btfc-global-search-input {
        height: 48px;
        font-size: 16px;
    }

    .btfc-global-search[data-search-context="mobile"] .btfc-global-search-results {
        position: relative;
        top: 12px;
        max-height: none;
        left: 0;
        right: 0;
    }

    body.btfc-search-open {
        overflow: hidden;
    }
}

@media (min-width: 769px) {
    .btfc-header-tools {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btfc-global-search-toggle,
    .btfc-global-search-item {
        transition: none;
    }
}
