/**
 * APB AI Search — Styles
 * Chargé uniquement quand l'élément est utilisé via enqueue_scripts()
 */

.apb-search { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; width: 100%; }
.apb-search * { box-sizing: border-box; margin: 0; padding: 0; }
.apb-search__form { width: 100%; }

/* Barre */
.apb-search__bar {
    display: flex;
    align-items: stretch;
    background: var(--apb-s-fond, #fff);
    border: 2px solid var(--apb-s-bord, #E2E6EA);
    border-radius: var(--apb-s-radius, 12px);
    padding: var(--apb-s-pad, 6px);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    transition: border-color .25s, box-shadow .25s;
}
.apb-search__bar:focus-within {
    border-color: var(--apb-s-focus, #185FA5);
    box-shadow: 0 4px 16px rgba(24,95,165,.12), 0 0 0 4px rgba(24,95,165,.08);
}

/* Icône */
.apb-search__ico { display: flex; align-items: center; padding: 0 4px 0 14px; color: #9CA3AF; flex-shrink: 0; }
.apb-search__ico svg { width: 20px; height: 20px; }

/* Input */
.apb-search__input {
    flex: 1;
    border: none;
    outline: 3px solid transparent;
    font-size: var(--apb-s-input-size, 16px);
    padding: 14px 12px;
    color: #1A1A2E;
    background: transparent;
    font-family: inherit;
    min-width: 0;
}
.apb-search__input::placeholder { color: #9CA3AF; }

/* Séparateur */
.apb-search__sep { width: 1px; background: var(--apb-s-bord, #E2E6EA); margin: 8px 0; flex-shrink: 0; }

/* Selects */
.apb-search__select {
    border: none;
    outline: 3px solid transparent;
    font-size: 14px;
    padding: 12px 32px 12px 14px;
    color: #1A1A2E;
    background-color: var(--apb-s-sel, #EBF3FB);
    border-radius: 8px;
    font-family: inherit;
    cursor: pointer;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%236B7280' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    margin-right: 6px;
    white-space: nowrap;
    max-width: 170px;
}
.apb-search__select:focus { box-shadow: 0 0 0 2px var(--apb-s-focus, #185FA5); }

/* Bouton géolocalisation intégré dans la barre */
.apb-search__geo {
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
    justify-content: center !important;
    width: 52px !important;
    height: 52px !important;
    min-width: 52px;
    min-height: 52px;
    border: none !important;
    background: none !important;
    cursor: pointer;
    color: #185FA5;
    border-radius: 50%;
    flex-shrink: 0;
    transition: color .2s, transform .2s;
    margin: 0 12px;
    padding: 0 !important;
}
.apb-search__geo:hover { color: #0C447C; transform: scale(1.15); }
.apb-search__geo svg { width: 36px !important; height: 36px !important; min-width: 36px; min-height: 36px; display: block !important; flex-shrink: 0; }
.apb-search__geo--loading { animation: apb-geo-spin 1s infinite; }
.apb-search__geo--ok { color: #639922 !important; transform: scale(1.15); }
@keyframes apb-geo-spin {
    0%,100% { opacity:.3; transform: scale(1); }
    50% { opacity:1; transform: scale(1.1); }
}

/* Bouton */
.apb-search__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--apb-s-btn, #185FA5);
    color: #fff;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, transform .1s;
    white-space: nowrap;
    min-height: 48px;
}
.apb-search__btn:hover { background: var(--apb-s-btn-h, #0C447C); transform: translateY(-1px); }
.apb-search__btn:active { transform: translateY(0); }
.apb-search__btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.5; flex-shrink: 0; }

/* Badge IA */
.apb-search__badge-wrap { display: block; margin-top: 12px; }
.apb-search__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #185FA5;
    background: rgba(24, 95, 165, 0.08);
    border: 1px solid rgba(24, 95, 165, 0.15);
    padding: 5px 12px;
    border-radius: 14px;
    letter-spacing: .2px;
}
.apb-search__badge svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.apb-search__dot {
    width: 7px; height: 7px;
    background: #059669;
    border-radius: 50%;
    animation: apbDot 2s infinite;
}
@keyframes apbDot { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.85)} }

/* Titre */
.apb-search__titre { font-weight: 800; margin-bottom: 6px; }
.apb-search__sous { font-size: 16px; opacity: .65; margin-bottom: 20px; }

/* Suggestions */
.apb-search__suggs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.apb-search__chip {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, .35);
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
    font-weight: 500;
}
.apb-search__chip:hover {
    background: rgba(255, 255, 255, .22);
    border-color: rgba(255, 255, 255, .55);
}

/* Icône info (tooltip) — intégrée dans le badge IA */
.apb-search__tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #185FA5;
    border: 2px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    width: 22px;
    height: 22px;
    color: #fff;
    flex-shrink: 0;
    transition: background .2s, transform .2s;
    animation: apbTipPulse 2.5s ease-in-out infinite;
    vertical-align: middle;
}
.apb-search__tip:hover,
.apb-search__tip:focus-visible {
    background: #0C447C;
    border-color: #fff;
    transform: scale(1.15);
    animation: none;
}
.apb-search__tip svg {
    width: 12px;
    height: 12px;
}
.apb-search__tip span {
    pointer-events: none;
}

/* Animation pulse pour attirer l'attention */
@keyframes apbTipPulse {
    0%, 100% { opacity: .7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

/* Tooltip bulle — positionné via JS sur le body */
.apb-search__tooltip {
    position: absolute;
    background: #1A1A2E;
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.7;
    width: 300px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .2s, transform .2s;
}
.apb-search__tooltip--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .apb-search__bar { flex-wrap: wrap; gap: 6px; }
    .apb-search__bar > .apb-search__ico,
    .apb-search__bar > .apb-search__input { flex: 0 1 auto; }
    /* Loupe + input restent en ligne */
    .apb-search__ico { padding: 0 0 0 8px; }
    .apb-search__input { flex: 1 1 0% !important; min-width: 0; }
    /* Selects et bouton passent en full-width */
    .apb-search__sep { width: 100%; height: 1px; margin: 0; }
    .apb-search__select { margin-right: 0; max-width: 100%; width: 100%; }
    .apb-search__btn { width: 100%; }
    /* Badge IA : wrap si trop large */
    .apb-search__badge {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }
    /* Icône info plus visible sur mobile */
    .apb-search__tip {
        width: 28px;
        height: 28px;
        min-width: 28px;
        border-width: 2px;
    }
    .apb-search__tip span {
        font-size: 15px !important;
    }
}

/* ── Thème dark (glassmorphism) ── */
.apb-search--dark { color: var(--color-hero-text, #fff); }

.apb-search--dark .apb-search__bar {
    background: rgba(255, 255, 255, 0.10) !important;
    border-color: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.apb-search--dark .apb-search__bar:focus-within {
    border-color: rgba(255, 255, 255, 0.50);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.apb-search--dark .apb-search__input {
    background: transparent;
    color: #fff;
}
.apb-search--dark .apb-search__input::placeholder { color: rgba(255,255,255,.50); }
.apb-search--dark .apb-search__input:focus { outline: none; }

.apb-search--dark .apb-search__ico { color: rgba(255,255,255,.60); }

.apb-search--dark .apb-search__geo {
    color: rgba(255,255,255,.70);
}
.apb-search--dark .apb-search__geo:hover { color: #fff; }

.apb-search--dark .apb-search__select {
    background: rgba(255,255,255,.08) !important;
    color: rgba(255,255,255,.85);
    border-color: rgba(255,255,255,.15);
}

.apb-search--dark .apb-search__btn {
    background: var(--color-hero-accent, #E6892A) !important;
}
.apb-search--dark .apb-search__btn:hover { background: #C96F15; }

.apb-search--dark .apb-search__badge {
    background: rgba(255,255,255,.10);
    color: rgba(255,255,255,.75);
    border-color: rgba(255,255,255,.15);
}

.apb-search--dark .apb-search__chip {
    background: var(--color-hero-chip-bg, rgba(255,255,255,.10));
    border-color: var(--color-hero-chip-border, rgba(255,255,255,.18));
    color: rgba(255,255,255,.85);
}
.apb-search--dark .apb-search__chip:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
}

/* ── Thème dark — shortcode .apb-recherche-ia ── */
.apb-recherche-ia.apb-search--dark {
    color: var(--color-hero-text, #fff);
}

.apb-recherche-ia.apb-search--dark .apb-recherche-ia__form {
    background: rgba(255, 255, 255, 0.10);
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px;
}

.apb-recherche-ia.apb-search--dark .apb-recherche-ia__form:focus-within {
    border-color: rgba(255, 255, 255, 0.50);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.apb-recherche-ia.apb-search--dark .apb-recherche-ia__input {
    background: transparent;
    color: #fff;
    border-color: transparent;
}
.apb-recherche-ia.apb-search--dark .apb-recherche-ia__input::placeholder {
    color: rgba(255, 255, 255, .50);
}
.apb-recherche-ia.apb-search--dark .apb-recherche-ia__input:focus {
    outline: none;
    border-color: transparent;
}

.apb-recherche-ia.apb-search--dark .apb-recherche-ia__btn {
    background: var(--color-hero-accent, #E6892A) !important;
    color: #fff;
}
.apb-recherche-ia.apb-search--dark .apb-recherche-ia__btn:hover {
    background: #C96F15 !important;
}

.apb-recherche-ia.apb-search--dark .apb-recherche-ia__status {
    color: rgba(255, 255, 255, .70);
}

.apb-recherche-ia.apb-search--dark .apb-recherche-ia__interpretation {
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .85);
}
