/* Componentes compartidos — búsqueda, inputs globales */

.debounced-search-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.debounced-search-with-icon {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 40px;
    border: 1px solid color-mix(in srgb, var(--primary-color) 22%, var(--border-light));
    border-radius: 12px;
    background: var(--bg-card-light);
    color: var(--text-light);
    font-family: 'Exo2', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(31, 44, 134, 0.05);
}

.dark-theme .debounced-search-with-icon {
    background: var(--bg-card-dark);
    border-color: color-mix(in srgb, var(--primary-color) 28%, var(--border-dark));
    color: var(--text-dark);
    box-shadow: none;
}

.debounced-search-with-icon:hover {
    border-color: color-mix(in srgb, var(--primary-color) 40%, var(--border-light));
}

.debounced-search-with-icon:focus,
.debounced-search-with-icon.focused {
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

.debounced-search-with-icon::placeholder {
    color: var(--text-muted-light);
    opacity: 1;
}

.dark-theme .debounced-search-with-icon::placeholder {
    color: var(--text-muted-dark);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted-light);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.dark-theme .search-icon {
    color: var(--text-muted-dark);
}

.clear-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-muted-light);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: background 0.12s ease, color 0.12s ease;
}

.clear-button:hover {
    background: color-mix(in srgb, var(--primary-color) 10%, transparent);
    color: var(--primary-color);
}

.dark-theme .clear-button:hover {
    background: color-mix(in srgb, var(--primary-color) 18%, transparent);
    color: #9db0f8;
}

.clear-button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.loading-indicator {
    position: absolute;
    right: 36px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin 1s linear infinite;
}

.debounced-search-with-icon:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
