/* ──────────────────────────────────────────────────────────────────────────
 * Herboristerie Patho Search — Frontend
 * Variables exposées (overridables via les réglages couleurs) :
 *   --hps-primary       (turquoise principal)
 *   --hps-primary-dark
 *   --hps-accent
 * ────────────────────────────────────────────────────────────────────────── */

.hps-search-widget {
    --hps-primary:      #14B8A6;
    --hps-primary-dark: #0F766E;
    --hps-accent:       #ECFDF5;
    --hps-text:         #0F172A;
    --hps-muted:        #64748B;
    --hps-border:       #E2E8F0;
    --hps-card-bg:      #ffffff;
    --hps-bg:           #F8FAFC;

    max-width: 100%;
    margin: 1.5rem 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--hps-text);
}

.hps-hidden { display: none !important; }

/* ── Search bar ────────────────────────────────────────────────────────── */

.hps-search-bar {
    margin-bottom: 1rem;
}

.hps-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--hps-card-bg);
    border: 2px solid var(--hps-border);
    border-radius: 12px;
    padding: 0 16px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.hps-search-input-wrap:focus-within {
    border-color: var(--hps-primary);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.hps-search-icon {
    color: var(--hps-muted);
    flex-shrink: 0;
    display: flex;
}

.hps-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 14px 12px;
    font-size: 16px;
    color: var(--hps-text);
    font-family: inherit;
}

.hps-search-input::placeholder { color: #94A3B8; }

.hps-search-clear {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--hps-muted);
    border-radius: 50%;
    display: flex;
    transition: background .15s ease, color .15s ease;
}
.hps-search-clear:hover {
    background: #F1F5F9;
    color: var(--hps-text);
}

/* ── Filter groups (Système & Intention) ──────────────────────────────── */

.hps-filter-group {
    margin-bottom: 1rem;
    background: var(--hps-card-bg);
    border: 1px solid var(--hps-border);
    border-radius: 12px;
    padding: 14px 16px;
}

.hps-filter-label {
    margin: 0 0 10px;
    font-size: 11px;
    color: var(--hps-muted);
    letter-spacing: 0.06em;
    font-weight: 600;
    text-transform: uppercase;
}

.hps-pill-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--hps-muted);
    font-size: 13px;
}

.hps-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hps-pill {
    background: #F1F5F9;
    color: #334155;
    border: 1px solid transparent;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s ease;
}

.hps-pill:hover {
    background: #E2E8F0;
}

.hps-pill.active {
    background: var(--hps-primary);
    color: #ffffff;
    border-color: var(--hps-primary);
}

.hps-pill.active:hover {
    background: var(--hps-primary-dark);
}

/* Intention pills get a slightly different default look */
.hps-pills-intention .hps-pill:not(.active) {
    background: var(--hps-accent);
    color: var(--hps-primary-dark);
    border: 1px solid #A7F3D0;
}

/* ── Status bar ────────────────────────────────────────────────────────── */

.hps-status-bar {
    margin: 12px 0;
    color: var(--hps-muted);
    font-size: 14px;
}
.hps-status-bar strong { color: var(--hps-text); }

/* ── Results ───────────────────────────────────────────────────────────── */

.hps-results-wrap {
    position: relative;
    min-height: 80px;
}

.hps-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hps-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.hps-result-card {
    background: var(--hps-card-bg);
    border: 1px solid var(--hps-border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.hps-result-card:hover {
    border-color: var(--hps-primary);
    box-shadow: 0 4px 12px -4px rgba(20, 184, 166, 0.15);
}

.hps-results-grid .hps-result-card {
    flex-direction: column;
}

.hps-result-thumb,
.hps-result-thumb-placeholder {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.hps-result-thumb-placeholder {
    background: var(--hps-accent);
    color: var(--hps-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hps-results-grid .hps-result-thumb,
.hps-results-grid .hps-result-thumb-placeholder {
    width: 100%;
    height: 140px;
}

.hps-result-body {
    flex: 1;
    min-width: 0;
}

.hps-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.hps-badge {
    font-size: 10px;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.hps-badge-systeme {
    background: var(--hps-accent);
    color: var(--hps-primary-dark);
}

.hps-badge-intention {
    background: #F1F5F9;
    color: #334155;
}

.hps-result-title {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--hps-text);
}

.hps-result-title a {
    color: inherit;
    text-decoration: none;
}
.hps-result-title a:hover {
    color: var(--hps-primary-dark);
    text-decoration: underline;
}

.hps-result-excerpt {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--hps-muted);
    line-height: 1.5;
}

.hps-plantes {
    margin: 8px 0 10px;
}

.hps-plantes-label {
    font-size: 11px;
    color: var(--hps-muted);
    margin-bottom: 6px;
    letter-spacing: 0.04em;
    font-weight: 600;
    text-transform: uppercase;
}

.hps-plantes-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.hps-plante-pill {
    background: #F0FDFA;
    color: var(--hps-primary-dark);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #99F6E4;
    text-decoration: none;
    transition: all .15s ease;
}

.hps-plante-pill:hover {
    background: var(--hps-primary);
    color: #ffffff;
    border-color: var(--hps-primary);
}

.hps-plante-pill::after {
    content: ' →';
    opacity: .6;
}

.hps-result-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--hps-primary-dark);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.hps-result-link:hover { text-decoration: underline; }

/* Highlight search terms */
.hps-highlight {
    background: #FEF3C7;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* ── Empty / Error state ──────────────────────────────────────────────── */

.hps-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--hps-muted);
}

.hps-empty-state svg {
    color: var(--hps-border);
    margin-bottom: 12px;
}

.hps-empty-state p {
    margin: 0;
    font-size: 15px;
}

/* ── Loader ────────────────────────────────────────────────────────────── */

.hps-loader {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.hps-spinner,
.hps-spinner-small {
    border: 2px solid var(--hps-border);
    border-top-color: var(--hps-primary);
    border-radius: 50%;
    animation: hps-spin .8s linear infinite;
}

.hps-spinner       { width: 32px; height: 32px; }
.hps-spinner-small { width: 14px; height: 14px; border-width: 2px; }

@keyframes hps-spin { to { transform: rotate(360deg); } }

/* ── Pagination ────────────────────────────────────────────────────────── */

.hps-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-top: 1.5rem;
}

.hps-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--hps-card-bg);
    border: 1px solid var(--hps-border);
    border-radius: 8px;
    color: var(--hps-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all .15s ease;
}

.hps-page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--hps-primary);
    color: var(--hps-primary-dark);
}

.hps-page-btn.active {
    background: var(--hps-primary);
    color: #ffffff;
    border-color: var(--hps-primary);
    cursor: default;
}

.hps-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.hps-page-ellipsis {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    color: var(--hps-muted);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .hps-result-card { flex-direction: column; }
    .hps-results-grid .hps-result-thumb,
    .hps-results-grid .hps-result-thumb-placeholder,
    .hps-result-thumb,
    .hps-result-thumb-placeholder { width: 100%; height: 160px; }
}
