/* ============================================================================
   SEARCH BAR COMPONENT
   ============================================================================
   
   Search input form with options for semantic search and root expansion.
   Includes loading states, input validation, and search weights display.
   
   ============================================================================ */

/* ============================================================================
   MATCH-STRICTNESS SLIDER
   ============================================================================ */

.strictness-slider-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.4rem 0 0.2rem;
    padding: 0 0.25rem;
}

.strictness-slider {
    flex: 1;
    max-width: 320px;
    accent-color: var(--color-primary, #8B7355);
}

.strictness-edge-label {
    font-family: var(--font-primary, 'Amiri', serif);
    font-size: 0.8rem;
    color: var(--color-text-secondary, #666);
    white-space: nowrap;
}

.strictness-value {
    font-family: var(--font-primary, 'Amiri', serif);
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--color-primary, #8B7355);
    min-width: 80px;
    white-space: nowrap;
}

/* ============================================================================
   CONTAINER & FORM
   ============================================================================ */

.search-bar-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.search-form {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 24px;
}


/* ============================================================================
   SEARCH MODE SELECTOR
   ============================================================================ */

.search-mode-selector {
    display: flex;
    background: var(--color-gray-background, #f3f4f6);
    border-radius: var(--radius-lg);
    padding: 4px;
    gap: 4px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius-lg) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    font-family: var(--font-primary);
    white-space: nowrap;
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

.mode-btn:hover:not(:disabled):not(.active) {
    background: rgba(255, 255, 255, 0.5);
    color: #374151;
}

.mode-btn.active {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(139, 69, 19, 0.3);
    font-weight: 600;
}

.mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================================
   SEARCH INPUT GROUP
   ============================================================================ */

.search-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
}

/* Reset (↺): a quiet outlined companion to the filled search button. */
.search-reset-button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: transparent;
    color: var(--color-text-secondary, #666);
    border: 2px solid var(--color-gray-border, #D4C4A8);
    border-radius: var(--radius-lg);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-all);
}
.search-reset-button:hover:not(:disabled) {
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.search-reset-button:disabled { opacity: 0.5; cursor: not-allowed; }

.search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 1.125rem;
    border: 2px solid var(--color-gray-border);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s;
    font-family: var(--font-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.search-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}


/* ============================================================================
   SEARCH BUTTON
   ============================================================================ */

.search-button {
    padding: 12px 32px;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-all);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-button:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.search-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-button.loading {
    background: #6b7280;  /* TODO: Add --color-search-loading to variables */
}


/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner {
    animation: spin 1s linear infinite;
    display: inline-block;
}


/* ============================================================================
   SEARCH OPTIONS (Semantic & Root Expansion Toggles)
   ============================================================================ */

.search-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--color-gray-border);
}

.option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
}

.option-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-text {
    font-family: var(--font-primary);
    color: #4b5563;  /* TODO: Add --color-option-text to variables */
}


/* ============================================================================
   WEIGHTS DISPLAY
   ============================================================================ */

.weights-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    color: #6b7280;  /* TODO: Add --color-weights-text to variables */
}

.weight-label {
    font-weight: 600;
    margin-inline-start: 8px;
}

.weight-value {
    color: var(--color-primary);
}

.weight-separator {
    color: #d1d5db;  /* TODO: Add --color-separator to variables */
}


/* ============================================================================
   MODE INFO TEXT (shown in semantic mode)
   ============================================================================ */

.mode-info {
    font-size: 0.8125rem;
    color: #6b7280;
    font-style: italic;
    font-family: var(--font-primary);
}


/* ============================================================================
   ADVANCED SEARCH BUTTON
   ============================================================================ */

.advanced-search-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-top: 16px;
    background: var(--color-white, #ffffff);
    border: 1px solid var(--color-gray-border, #e5e7eb);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #4b5563;
    font-family: var(--font-primary);
}

.advanced-search-button:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
}

.advanced-search-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--color-primary);
    color: white;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}