/* ===========================================
   Component: Search Bar — Soelya
   =========================================== */

.search {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* ---- Wrapper (input + boutons) ---- */
.search__wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-3) var(--space-4);
    transition: 
        border-color var(--transition-base),
        box-shadow var(--transition-base),
        background var(--transition-base);
}

.search__wrapper:focus-within {
    border-color: rgba(124, 92, 252, 0.4);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.08), 0 0 24px rgba(124, 92, 252, 0.12);
    background: var(--color-bg-secondary);
}

/* Chat mode : style premium pour l'input */
body.chat-active .search__wrapper {
    background: rgba(22, 22, 31, 0.6);
    border-color: rgba(124, 92, 252, 0.12);
}

body.chat-active .search__wrapper:focus-within {
    background: rgba(22, 22, 31, 0.8);
    border-color: rgba(124, 92, 252, 0.3);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.06), 0 0 32px rgba(124, 92, 252, 0.1);
}

/* ---- Icône de recherche ---- */
.search__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    margin-right: var(--space-3);
    transition: color var(--transition-fast);
}

.search__wrapper:focus-within .search__icon {
    color: var(--color-accent);
}

/* ---- Input ---- */
.search__input {
    flex: 1;
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    background: transparent;
    min-width: 0;
}

.search__input::placeholder {
    color: var(--color-text-tertiary);
}

/* ---- Bouton submit ---- */
.search__submit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--color-text-tertiary);
    transition: 
        background var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

/* ---- Bouton micro (voice) ---- */
.search__voice {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    color: var(--color-text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search__voice:hover {
    color: var(--color-accent);
    background: var(--color-accent-subtle);
}

.search__voice--recording {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    animation: voicePulse 1.2s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); }
}

.search__submit:hover {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}

.search__submit:active {
    transform: scale(0.92);
}

.search__submit--active {
    background: linear-gradient(135deg, var(--color-accent), #5a3fd4);
    color: var(--color-text-inverse);
    box-shadow: 0 2px 12px rgba(124, 92, 252, 0.35);
}

.search__submit--active:hover {
    background: linear-gradient(135deg, var(--color-accent-hover), #6b4fe0);
    color: var(--color-text-inverse);
    box-shadow: 0 4px 16px rgba(124, 92, 252, 0.4);
}

/* ---- Suggestions rapides ---- */
.search__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
}

.search__suggestion {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    white-space: nowrap;
    transition: 
        border-color var(--transition-fast),
        background var(--transition-fast),
        color var(--transition-fast);
    cursor: pointer;
}

.search__suggestion:hover {
    border-color: var(--color-border-hover);
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.search__suggestion-icon {
    font-size: var(--font-size-sm);
    line-height: 1;
}

/* ---- Loading indicator ---- */
.search__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
}

.search__loading-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.search__loading-dot:nth-child(2) { animation-delay: 0.2s; }
.search__loading-dot:nth-child(3) { animation-delay: 0.4s; }
