/**
 * okbox-search.css
 * Styles minimaux et tokenisés. Couleurs OKBOX : brun #3D1F1A + corail #EF4A4A.
 */

.okbox-search {
    --okbox-brun:        #3D1F1A;
    --okbox-corail:      #EF4A4A;
    --okbox-bg:          #ffffff;
    --okbox-border:      #e5e5e5;
    --okbox-text:        #1a1a1a;
    --okbox-muted:       #757575;

    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 600px;
    font-family: inherit;
}

.okbox-search--overlay {
    max-width: 720px;
}

.okbox-search__field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.okbox-search__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.okbox-search__input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    line-height: 1.4;
    color: var(--okbox-text);
    background: var(--okbox-bg);
    border: 1px solid var(--okbox-border);
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.okbox-search__input:focus {
    outline: none;
    border-color: var(--okbox-corail);
    box-shadow: 0 0 0 3px rgba(239, 74, 74, 0.18);
}

.okbox-search__loader {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid var(--okbox-border);
    border-top-color: var(--okbox-corail);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.okbox-search.is-loading .okbox-search__loader {
    opacity: 1;
    animation: okbox-spin 0.7s linear infinite;
}

@keyframes okbox-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

.okbox-search__option--empty {
    color: var(--okbox-muted);
    font-style: italic;
    cursor: default;
}

.okbox-search__option--empty:hover {
    background: transparent;
}

.okbox-search__listbox {
    list-style: none;
    margin: 4px 0 0;
    padding: 4px 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--okbox-bg);
    border: 1px solid var(--okbox-border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
}

.okbox-search__option {
    padding: 10px 18px;
    cursor: pointer;
    font-size: 15px;
    color: var(--okbox-text);
}

.okbox-search__option:hover,
.okbox-search__option.is-active {
    background-color: rgba(239, 74, 74, 0.08);
}

.okbox-search__option-label {
    display: block;
}

.okbox-search__submit {
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--okbox-corail);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.okbox-search__submit:hover {
    background: #d63b3b;
}

.okbox-search__submit:focus-visible {
    outline: 3px solid var(--okbox-brun);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .okbox-search {
        flex-direction: column;
        gap: 8px;
    }
    .okbox-search__submit {
        width: 100%;
    }
}
