/* ─────────────────────────────────────────────────────────────────────────────
 * Scout — Page Expérience (refonte v0.2.0)
 * - Toolbar (filtres + bouton de création)
 * - Cards d'expérience enrichies (badges, priorité, KPI compact)
 * - Modal 2 étapes (choix template puis formulaire)
 * ───────────────────────────────────────────────────────────────────────────── */

/* ───── Toolbar ───── */
.experience-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    margin: var(--space-4) 0 var(--space-5);
}
.experience-toolbar__filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
}
.experience-toolbar__filter {
    flex: 0 0 auto;
    width: auto;
    min-width: 180px;
}
.experience-toolbar__cta {
    margin-left: auto;
}

/* ───── Cards d'expérience ───── */
.experience-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-4);
}
.experience-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-4);
    gap: var(--space-3);
}
.experience-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-2);
}
.experience-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.experience-card__badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.experience-card__domain {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: var(--font-mono, monospace);
}
.experience-card__hyp {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.experience-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    margin-top: auto;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    font-size: 11px;
    color: var(--text-tertiary);
}

.experience-card__priority {
    display: inline-flex;
    gap: 2px;
}
.experience-card__priority span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-subtle, rgba(255,255,255,0.15));
}
.experience-card__priority span.on {
    background: var(--color-warning, #f59e0b);
}

.experience-card__kpi {
    display: flex;
    gap: var(--space-3);
    font-size: 11px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}
.experience-card__kpi b {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ───── Tableau des tests ───── */
.experience-table {
    padding: 0;
    overflow: hidden;
}
.experience-table__head,
.experience-row {
    display: grid;
    grid-template-columns: 40px 2.4fr 1.4fr 1.3fr 1fr 0.8fr 1fr;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
}
/* Leading selection column */
.experience-table__check {
    display: flex;
    align-items: center;
    justify-content: center;
}
.experience-table__check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-brand-primary);
}
.experience-row.is-selected {
    background: var(--color-brand-soft);
}

/* Bulk actions bar (visible when ≥1 row selected) */
.experience-bulk {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    background: var(--surface-secondary);
}
.experience-bulk__count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.experience-bulk__delete {
    color: var(--color-danger);
    background: rgba(244, 63, 94, 0.10);
    border: 1px solid rgba(244, 63, 94, 0.25);
}
.experience-bulk__delete:hover { background: rgba(244, 63, 94, 0.18); }
.experience-bulk__delete:disabled { opacity: 0.6; cursor: default; }
.experience-table__head {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    border-bottom: 1px solid var(--border-secondary);
    background: var(--surface-secondary);
}
.experience-row {
    border-bottom: 1px solid var(--border-secondary);
    transition: background var(--transition-base);
}
.experience-row:hover { background: var(--surface-secondary); }
.experience-row:last-child { border-bottom: 0; }
/* Protocol-run rows are clickable links to /pipeline/run — strip the anchor look. */
a.experience-row--run { color: inherit; text-decoration: none; cursor: pointer; }
.experience-row__title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.experience-row__name {
    font-weight: 600;
    color: var(--text-primary);
}
.experience-row__hyp {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.experience-row__domain {
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.experience-row__priority {
    display: inline-flex;
    gap: 2px;
}
.experience-row__priority span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-subtle, rgba(255,255,255,0.15));
}
.experience-row__priority span.on { background: var(--color-warning, #f59e0b); }
.experience-row__date { font-size: 12px; }

@media (max-width: 1080px) {
    .experience-table__head,
    .experience-row {
        grid-template-columns: 40px 2fr 1.2fr 1fr 1fr;
    }
    /* Hide Priorité (6th) + Lancé le (7th) once the leading checkbox column shifts indexes */
    .experience-table__head > *:nth-child(6),
    .experience-table__head > *:nth-child(7),
    .experience-row__priority,
    .experience-row__date {
        display: none;
    }
}

/* ───── Empty state ───── */
.experience-empty {
    padding: var(--space-6);
    text-align: center;
}

/* ───── Badges filter_type ───── */
.badge--ft-helpful_content   { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge--ft-spam_update       { background: rgba(244, 63,  94,  0.15); color: #f43f5e; }
.badge--ft-core_update       { background: rgba(6,   182, 212, 0.15); color: #06b6d4; }
.badge--ft-manual_action     { background: rgba(239, 68,  68,  0.15); color: #ef4444; }
.badge--ft-deindexation      { background: rgba(245, 158, 11,  0.15); color: #f59e0b; }
.badge--ft-partial_filtering { background: rgba(99,  102, 241, 0.15); color: #6366f1; }
.badge--ft-trust_sandbox     { background: rgba(20,  184, 166, 0.15); color: #14b8a6; }
.badge--ft-unknown           { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* ───── Modal "Nouvelle expérience" ───── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.modal-panel {
    max-width: 960px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    gap: var(--space-4);
    overflow: hidden;
}
.modal-panel--narrow { max-width: 520px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
}
.modal-header h2 {
    margin: 0;
    font-size: 18px;
}
.modal-body {
    overflow-y: auto;
    padding-right: var(--space-2);
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

.template-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.template-filter-pill {
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    background: var(--surface-2, rgba(255,255,255,0.06));
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
}
.template-filter-pill--active {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-3);
}
.template-card {
    padding: var(--space-3);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    transition: border-color 120ms ease, transform 120ms ease;
    background: var(--surface-2, rgba(255,255,255,0.04));
}
.template-card:hover {
    border-color: var(--color-brand-primary);
    transform: translateY(-1px);
}
.template-card__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.template-card__desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.template-card__meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* ───── Formulaire étape 2 ───── */
.experience-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.experience-form__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.experience-form__field--full {
    grid-column: 1 / -1;
}
.experience-form__field label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}
.experience-form__field input,
.experience-form__field select,
.experience-form__field textarea {
    width: 100%;
}
.experience-form__field textarea {
    min-height: 80px;
    resize: vertical;
}
