/**
 * Smart Trade Search Component Styles
 * Reusable typeahead/autocomplete for trade role selection
 */

/* Container */
.smart-trade-search {
    position: relative;
    width: 100%;
}

/* Search Input */
.smart-trade-search__input-wrapper {
    position: relative;
}

.smart-trade-search__input {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    border: 2px solid var(--border, #e0e0e0);
    border-radius: 8px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.smart-trade-search__input:focus {
    outline: none;
    border-color: var(--primary, #3F5F2A);
    box-shadow: 0 0 0 3px rgba(63, 95, 42, 0.1);
}

.smart-trade-search__input::placeholder {
    color: #6B7280;
}

/* Search Icon - hidden for cleaner UI */
.smart-trade-search__icon {
    display: none;
}

/* Clear Button */
.smart-trade-search__clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6B7280;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.1rem;
    line-height: 1;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    display: none;
}

.smart-trade-search__clear:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.smart-trade-search--has-value .smart-trade-search__clear {
    display: block;
}

/* Results Dropdown */
.smart-trade-search__results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
}

.smart-trade-search--open .smart-trade-search__results {
    display: block;
}

/* Result Item */
.smart-trade-search__result {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f3f4f6;
}

.smart-trade-search__result:last-child {
    border-bottom: none;
}

.smart-trade-search__result:hover,
.smart-trade-search__result--focused {
    background: #f0f7f0;
}

.smart-trade-search__result--selected {
    background: #e6f2e6;
}

/* Result Content */
.smart-trade-search__result-role {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.smart-trade-search__result-family {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

/* Highlight matching text */
.smart-trade-search__highlight {
    background: #fef08a;
    padding: 0 1px;
    border-radius: 2px;
}

/* No Results */
.smart-trade-search__no-results {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

.smart-trade-search__no-results-hint {
    font-size: 0.8rem;
    color: #6B7280;
    margin-top: 0.5rem;
}

/* Loading State */
.smart-trade-search__loading {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
}

/* Selected State (when a role is selected) */
.smart-trade-search--selected .smart-trade-search__input {
    border-color: var(--gwk-green-200, #C5E3B8);
    background: var(--gwk-green-50, #F3F7F0);
}

/* Divider between search and dropdowns */
.smart-trade-search__divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.25rem 0;
    color: #6B7280;
    font-size: 0.85rem;
}

.smart-trade-search__divider::before,
.smart-trade-search__divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e7eb;
}

.smart-trade-search__divider::before {
    margin-right: 0.75rem;
}

.smart-trade-search__divider::after {
    margin-left: 0.75rem;
}

/* Keyboard Navigation Hint */
.smart-trade-search__hint {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: #6B7280;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 1rem;
}

.smart-trade-search__hint kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.7rem;
    font-family: inherit;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    box-shadow: 0 1px 0 #e5e7eb;
}

/* "Other / Not Listed" option */
.smart-trade-search__result--other {
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.smart-trade-search__result--other:hover {
    background: #f0f7f0;
}

.smart-trade-search__result--other .smart-trade-search__result-role {
    color: var(--primary, #3F5F2A);
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .smart-trade-search__input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .smart-trade-search__results {
        max-height: 50vh;
    }

    .smart-trade-search__hint {
        display: none;
    }
}
