/* Global competitor search. Markup: CompetitorSearchPage::renderForm() + js/gb-competitor-search.js */

.gb-competitor-search {
    --gbcs-accent: #2dd4bf;
    --gbcs-accent-soft: rgba(45, 212, 191, 0.14);
    --gbcs-accent-ring: rgba(45, 212, 191, 0.3);
    --gbcs-panel-bg: #10161f;
    position: relative;
    z-index: 30;
    text-align: left;
}

.gb-cs-heading {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
}

.gb-cs-form {
    position: relative;
    margin: 0;
}

.gb-cs-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gb-cs-field:focus-within {
    border-color: var(--gbcs-accent);
    box-shadow: 0 0 0 3px var(--gbcs-accent-ring);
}

.gb-cs-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(232, 236, 241, 0.6);
    pointer-events: none;
}

.gb-cs-input.form-control {
    flex: 1 1 auto;
    min-width: 0;
    height: 2.75rem;
    padding: 0 2.25rem 0 2.25rem;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #e8ecf1;
    font-size: 1rem;
}

.gb-cs-input.form-control:focus {
    background: transparent;
    box-shadow: none;
    color: #fff;
}

.gb-cs-input::placeholder {
    color: rgba(232, 236, 241, 0.5);
}

.gb-cs-input::-webkit-search-cancel-button {
    cursor: pointer;
}

.gb-cs-spinner {
    position: absolute;
    right: 6.6rem;
    top: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    border-width: 0.15em;
    color: var(--gbcs-accent);
}

.gb-cs-spinner[hidden] {
    display: none;
}

.gb-cs-submit {
    flex: 0 0 auto;
    height: 2.75rem;
    padding: 0 1.1rem;
    border-radius: 8px;
    font-weight: 600;
}

.gb-cs-dropdown {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    z-index: 1010;
    overflow: hidden;
    background: var(--gbcs-panel-bg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.gb-cs-dropdown[hidden] {
    display: none;
}

.gb-cs-listbox {
    max-height: min(26rem, 60vh);
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.gb-cs-listbox:empty {
    display: none;
}

.gb-cs-option {
    margin: 0;
    border-radius: 8px;
}

.gb-cs-option.is-active {
    background: var(--gbcs-accent-soft);
    box-shadow: inset 3px 0 0 var(--gbcs-accent);
}

.gb-cs-option--all {
    margin-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 0 8px 8px;
}

.gb-cs-view-all {
    display: block;
    padding: 0.7rem 0.75rem;
    color: var(--gbcs-accent);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.gb-cs-view-all:hover {
    color: #5eead4;
}

/* One result row (dropdown option and results page) */
.gb-cs-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: #e8ecf1;
    text-decoration: none;
}

.gb-cs-result:hover {
    color: #fff;
}

.gb-cs-avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    overflow: hidden;
    border-radius: 50%;
    background: #1e3a5f;
    color: #e0f2fe;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.gb-cs-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gb-cs-tone-1 { background: #134e4a; color: #ccfbf1; }
.gb-cs-tone-2 { background: #3b2f63; color: #ede9fe; }
.gb-cs-tone-3 { background: #5b2a2a; color: #fee2e2; }
.gb-cs-tone-4 { background: #4a3b12; color: #fef3c7; }
.gb-cs-tone-5 { background: #233554; color: #dbeafe; }

.gb-cs-option-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.gb-cs-name,
.gb-cs-meta {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gb-cs-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.gb-cs-meta {
    font-size: 0.78rem;
    color: rgba(232, 236, 241, 0.62);
}

.gb-cs-country {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 0.4rem;
    max-width: 9rem;
    min-width: 0;
    font-size: 0.78rem;
    color: rgba(232, 236, 241, 0.75);
}

.gb-cs-country img {
    flex: 0 0 auto;
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
}

.gb-cs-country-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gb-cs-events {
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: rgba(232, 236, 241, 0.55);
}

.gb-cs-chevron {
    flex: 0 0 auto;
    font-size: 0.7rem;
    color: rgba(232, 236, 241, 0.4);
}

.gb-cs-option.is-active .gb-cs-chevron,
.gb-cs-results .gb-cs-result:hover .gb-cs-chevron {
    color: var(--gbcs-accent);
}

.gb-cs-message {
    margin: 0;
    padding: 0.8rem 0.9rem;
    font-size: 0.88rem;
    color: rgba(232, 236, 241, 0.7);
}

.gb-cs-message[hidden] {
    display: none;
}

.gb-cs-message--error {
    color: #fca5a5;
}

/* All-results page */
.gb-cs-page .gb-competitor-search {
    max-width: 40rem;
}

.gb-cs-results {
    display: grid;
    gap: 0.5rem;
    overflow: visible !important;
}

.gb-cs-results .gb-cs-result {
    background: #151c28;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
}

.gb-cs-results .gb-cs-result:hover,
.gb-cs-results .gb-cs-result:focus-visible {
    border-color: var(--gbcs-accent, #2dd4bf);
    background: #17232f;
}

.gb-cs-result:focus-visible,
.gb-cs-view-all:focus-visible {
    outline: 2px solid #2dd4bf;
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .gb-cs-input.form-control {
        font-size: 16px;
        padding-right: 2rem;
    }

    .gb-cs-submit {
        padding: 0 0.85rem;
    }

    .gb-cs-spinner {
        right: 5.6rem;
    }

    .gb-cs-country {
        max-width: 5.5rem;
    }

    .gb-cs-country-name {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .gb-cs-listbox {
        max-height: min(22rem, 55vh);
    }
}

@media (forced-colors: active) {
    .gb-cs-option.is-active {
        outline: 2px solid Highlight;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gb-cs-field {
        transition: none;
    }
}
