/* ============================================================================
 * search-trials-wizard.css — Lote K (rediseño visual del wizard)
 *
 * Aplica al wizard guiado los mismos principios visuales que el Lote J:
 * cards con peso visual sólido, gradients sutiles, sombras prominentes,
 * paleta canónica all-blue del proyecto.
 *
 * Se carga DESPUÉS de search-trials.css. Reutiliza tokens del proyecto.
 * Selectores .stw-* siguen siendo los que el JS necesita — no cambian.
 * ============================================================================ */


/* ───────────────────────────────────────────────────────────────────────
 * Container general
 * ─────────────────────────────────────────────────────────────────────── */
.stw-main {
    background: linear-gradient(180deg, var(--color-blue-50, #eff6ff) 0%, var(--bg-body, #f8fafc) 220px);
    min-height: calc(100vh - 80px);
    padding: 32px 24px 64px;
}

.stw-main .st-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0;
}


/* ───────────────────────────────────────────────────────────────────────
 * Back link — flecha animada al volver
 * ─────────────────────────────────────────────────────────────────────── */
.stw-back,
.st-breadcrumb a {                /* compat por si el HTML aún usa .st-breadcrumb */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-blue-700, #0056a3);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    padding: 8px 12px 8px 0;
    transition: color 200ms ease;
}
.stw-back:hover,
.st-breadcrumb a:hover {
    color: var(--color-navy, #002855);
}
.stw-back svg {
    width: 16px;
    height: 16px;
    transition: transform 200ms ease;
}
.stw-back:hover svg {
    transform: translateX(-3px);
}

/* Compatibilidad con el .st-breadcrumb del Lote A/B */
.st-breadcrumb {
    margin-bottom: 0;
    padding: 0;
}


/* ───────────────────────────────────────────────────────────────────────
 * Progress block — barra prominente con shimmer
 * ─────────────────────────────────────────────────────────────────────── */
.stw-progress-block {
    background: white;
    border-radius: 16px;
    padding: 24px 28px;
    box-shadow: 0 4px 20px rgba(0, 40, 85, 0.06);
    border: 1px solid var(--slate-200, #e2e8f0);
    margin-bottom: 24px;
}

.stw-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 14px;
}

.stw-step-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted, #334155);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
}
.stw-step-label strong {
    color: var(--color-blue-700, #0056a3);
    font-weight: 700;
}

.stw-step-percent {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-blue-500, #2563eb);
}

.stw-progress {
    height: 8px;
    background: var(--slate-100, #f1f5f9);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.stw-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-blue-500, #2563eb) 0%, var(--color-blue-700, #0056a3) 100%);
    border-radius: 999px;
    transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.3);
}
.stw-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 16px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5));
    animation: stwShimmer 2s ease-in-out infinite;
}
@keyframes stwShimmer {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}


/* ───────────────────────────────────────────────────────────────────────
 * Step card — contenedor del form
 * ─────────────────────────────────────────────────────────────────────── */
.stw-step-card {
    background: white;
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: 0 8px 30px rgba(0, 40, 85, 0.08);
    border: 1px solid var(--slate-200, #e2e8f0);
}

.stw-form {
    max-width: none;
    margin: 0;
}

.stw-step {
    padding: 0;
}
.stw-step[hidden] {
    display: none;
}

.stw-step-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--color-navy, #002855);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
}
.stw-step-lead {
    font-size: 16px;
    color: var(--text-muted, #334155);
    line-height: 1.55;
    margin: 0 0 28px;
}

.stw-substep-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-navy, #002855);
    margin: 0 0 12px;
    letter-spacing: -0.01em;
}
.stw-substep-title--mt {
    margin-top: 32px;
}
.stw-substep-lead {
    font-size: 14px;
    color: var(--text-muted, #334155);
    line-height: 1.5;
    margin: 0 0 12px;
}


/* ───────────────────────────────────────────────────────────────────────
 * Options — radio cards con peso visual
 * ─────────────────────────────────────────────────────────────────────── */
.stw-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
}

.stw-option {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    background: white;
    border: 2px solid var(--slate-200, #e2e8f0);
    border-radius: 12px;
    cursor: pointer;
    transition: all 200ms ease;
    position: relative;
}
.stw-option:hover {
    border-color: var(--color-blue-300, #60a5fa);
    background: var(--color-blue-50, #eff6ff);
    transform: translateX(2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

/* Hide default radio */
.stw-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Radio visual custom */
.stw-radio {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--slate-300, #cbd5e1);
    flex-shrink: 0;
    position: relative;
    background: white;
    transition: all 200ms ease;
}
.stw-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-blue-500, #2563eb);
    transition: transform 200ms ease;
}
.stw-option:hover .stw-radio {
    border-color: var(--color-blue-400, #3b82f6);
}
.stw-option input[type="radio"]:checked ~ .stw-radio,
.stw-option input[type="radio"]:checked + .stw-radio {
    border-color: var(--color-blue-500, #2563eb);
    background: var(--color-blue-50, #eff6ff);
}
.stw-option input[type="radio"]:checked ~ .stw-radio::after,
.stw-option input[type="radio"]:checked + .stw-radio::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Selected state — todo el card */
.stw-option:has(input[type="radio"]:checked) {
    border-color: var(--color-blue-500, #2563eb);
    background: var(--color-blue-50, #eff6ff);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.15);
}

/* Body de la opción */
.stw-option-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.stw-option-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-navy, #002855);
    line-height: 1.3;
}
.stw-option-sub {
    font-size: 14px;
    color: var(--text-muted, #334155);
    line-height: 1.45;
}

/* Compact options (pasos 4 ECOG y línea de tratamiento) */
.stw-option--compact {
    padding: 14px 18px;
}
.stw-option--compact .stw-option-body {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-navy, #002855);
}

/* Meta del paso 1: número grande + label "ensayos" */
.stw-option-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    text-align: right;
}
.stw-option-count {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-blue-700, #0056a3);
    line-height: 1;
    letter-spacing: -0.02em;
    transition: color 200ms ease;
}
.stw-option-count-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--slate-500, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stw-option:has(input[type="radio"]:checked) .stw-option-count {
    color: var(--color-blue-500, #2563eb);
}


/* ───────────────────────────────────────────────────────────────────────
 * Bio card (paso 3) — selects de biomarcadores
 * ─────────────────────────────────────────────────────────────────────── */
.stw-bio-card {
    background: var(--color-blue-50, #eff6ff);
    border: 1px solid var(--color-blue-100, #dbeafe);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 8px;
}

.stw-bio-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 14px;
}
.stw-bio-row:last-child {
    margin-bottom: 0;
}

.stw-bio-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-navy, #002855);
    letter-spacing: 0.02em;
}

.stw-bio-select {
    width: 100%;
    padding: 10px 14px;
    background: white;
    border: 1.5px solid var(--slate-200, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.stw-bio-select:hover {
    border-color: var(--color-blue-300, #60a5fa);
}
.stw-bio-select:focus {
    outline: none;
    border-color: var(--color-blue-500, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}


/* ───────────────────────────────────────────────────────────────────────
 * Summary card (paso 5) — resumen final antes de buscar
 * ─────────────────────────────────────────────────────────────────────── */
.stw-summary-card {
    background: var(--color-blue-50, #eff6ff);
    border: 1px solid var(--color-blue-100, #dbeafe);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 18px;
}
.stw-summary-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    padding: 10px 0;
    margin: 0;
    border-bottom: 1px solid rgba(0, 86, 163, 0.08);
}
.stw-summary-row:last-child {
    border-bottom: none;
}
.stw-summary-row dt {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-navy, #002855);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0;
}
.stw-summary-row dd {
    font-size: 15px;
    color: var(--text-primary, #1e293b);
    margin: 0;
    line-height: 1.45;
}

.stw-fineprint {
    font-size: 13px;
    color: var(--slate-500, #64748b);
    line-height: 1.5;
    margin: 0;
    text-align: center;
    font-style: italic;
}


/* ───────────────────────────────────────────────────────────────────────
 * Validation message
 * ─────────────────────────────────────────────────────────────────────── */
.stw-validation-msg {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--color-warning-soft, #fef3c7);
    border-left: 3px solid var(--color-warning, #d97706);
    color: var(--color-warning-dark, #92400e);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
}


/* ───────────────────────────────────────────────────────────────────────
 * Botonera — Atrás / Continuar / Buscar
 * ─────────────────────────────────────────────────────────────────────── */
.stw-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--slate-100, #f1f5f9);
}
.stw-actions-spacer {
    flex: 1;
}

.st-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: all 200ms ease;
    font-family: inherit;
    text-decoration: none;
}
.st-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 200ms ease;
}

.st-btn--ghost {
    background: transparent;
    color: var(--text-muted, #334155);
    padding: 14px 20px;
}
.st-btn--ghost:hover {
    background: var(--slate-100, #f1f5f9);
    color: var(--color-navy, #002855);
}
.st-btn--ghost:hover svg {
    transform: translateX(-3px);
}

.st-btn--primary {
    background: linear-gradient(135deg, var(--color-blue-500, #2563eb), var(--color-blue-700, #0056a3));
    color: white;
    box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.4);
}
.st-btn--primary:hover {
    background: linear-gradient(135deg, var(--color-blue-700, #0056a3), var(--color-navy, #002855));
    box-shadow: 0 10px 24px -4px rgba(37, 99, 235, 0.55);
    transform: translateY(-2px);
}
.st-btn--primary:hover svg {
    transform: translateX(4px);
}
.st-btn--primary:disabled {
    background: var(--slate-300, #cbd5e1);
    color: white;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.st-btn--lg {
    padding: 16px 32px;
    font-size: 16px;
}


/* ───────────────────────────────────────────────────────────────────────
 * Responsive
 * ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .stw-main {
        padding: 24px 16px 48px;
    }
    .stw-step-title {
        font-size: 24px;
    }
    .stw-step-card {
        padding: 24px 20px;
    }
    .stw-progress-block {
        padding: 20px;
    }
    .stw-option {
        padding: 16px;
        gap: 14px;
    }
    .stw-option-title {
        font-size: 15px;
    }
    .stw-option-sub {
        font-size: 13px;
    }
    .stw-option-count {
        font-size: 18px;
    }
    .stw-bio-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .stw-summary-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .stw-actions {
        flex-direction: column-reverse;
    }
    .stw-actions .st-btn {
        width: 100%;
    }
    .stw-actions-spacer {
        display: none;
    }
}

/* =====================================================================
   LOTE S — paso 3 biomarcadores rediseñado (3 grupos jerárquicos)
   ===================================================================== */

.stws-group {
    margin-bottom: 22px;
}

/* Header del grupo */
.stws-group-h {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px;
    background: var(--color-blue-50);
    border: 1px solid var(--color-blue-100);
    border-radius: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.stws-group--critical .stws-group-h {
    background: linear-gradient(135deg, #fff5f5, #fff8e6);
    border-color: rgba(217,119,6,0.25);
}
.stws-group-h-title {
    font-size: 14px; font-weight: 700;
    color: var(--color-navy);
}
.stws-group--critical .stws-group-h-title { color: #92400e; }
.stws-group-badge {
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.stws-group-badge--critical {
    background: var(--color-warning, #d97706); color: white;
}
.stws-group-h-help {
    font-size: 12px; color: var(--text-muted, #334155); font-style: italic;
}

/* Card que contiene las filas */
.stws-card {
    background: white;
    border: 1px solid var(--slate-200, #e2e8f0);
    border-radius: 12px;
    padding: 4px 16px;
}

/* Fila individual: gen, select, help */
.stws-row {
    display: grid;
    grid-template-columns: 90px 1fr 22px;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--slate-100, #f1f5f9);
}
.stws-row:last-child { border-bottom: none; }
.stws-label {
    font-size: 14px; font-weight: 700;
    color: var(--color-navy);
    letter-spacing: 0.02em;
}

/* Select estilizado */
.stws-select {
    width: 100%;
    padding: 9px 12px;
    background: white;
    border: 1.5px solid var(--slate-200, #e2e8f0);
    border-radius: 8px;
    font-size: 14px; font-family: inherit;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms;
}
.stws-select:hover { border-color: var(--color-blue-300, #60a5fa); }
.stws-select:focus {
    outline: none; border-color: var(--color-blue-500, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.stws-select.has-value {
    border-color: var(--color-blue-400, #3b82f6);
    background: var(--color-blue-50, #eff6ff);
    font-weight: 500;
}

/* Tooltip de ayuda "?" */
.stws-help {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--slate-100, #f1f5f9);
    color: var(--slate-500, #64748b);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: help;
    font-size: 12px; font-weight: 700;
    border: 1px solid var(--slate-200, #e2e8f0);
    transition: all 150ms;
    position: relative;
    user-select: none;
}
.stws-help:hover, .stws-help:focus {
    background: var(--color-blue-100, #dbeafe);
    color: var(--color-blue-700, #0056a3);
    border-color: var(--color-blue-300, #60a5fa);
    outline: none;
}
.stws-help-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 280px;
    padding: 12px 14px;
    background: var(--color-navy, #002855);
    color: white;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 400;
    text-align: left;
    box-shadow: 0 8px 24px rgba(0,40,85,0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 150ms, transform 150ms;
    z-index: 100;
}
.stws-help:hover .stws-help-bubble,
.stws-help:focus .stws-help-bubble {
    opacity: 1; pointer-events: auto; transform: translateY(0);
}
.stws-help-bubble::after {
    content: '';
    position: absolute;
    top: 100%; right: 8px;
    border: 6px solid transparent;
    border-top-color: var(--color-navy, #002855);
}
.stws-help-bubble strong {
    color: white;
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 700;
}

/* Input de texto libre cuando "Otra variante" */
.stws-other-input {
    grid-column: 1 / -1;
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--color-blue-50, #eff6ff);
    border: 1.5px dashed var(--color-blue-300, #60a5fa);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    width: 100%;
}
.stws-other-input:focus {
    outline: none;
    border-style: solid;
    border-color: var(--color-blue-500, #2563eb);
    background: white;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Filas numéricas (TMB, PD-L1) */
.stws-num-group {
    display: flex; align-items: center; gap: 10px;
}
.stws-num-select {
    flex-shrink: 0; width: 130px;
}
.stws-num-value {
    flex: 1;
    padding: 9px 12px;
    background: white;
    border: 1.5px solid var(--slate-200, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary, #1e293b);
    transition: border-color 150ms;
}
.stws-num-value:not(:disabled):focus {
    outline: none;
    border-color: var(--color-blue-500, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.stws-num-value:disabled {
    background: var(--slate-50, #f8fafc);
    color: var(--slate-400, #94a3b8);
    cursor: not-allowed;
}

/* Toggle "Mostrar biomarcadores raros" */
.stws-toggle-rare {
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 16px;
    background: white;
    border: 1.5px dashed var(--color-blue-300, #60a5fa);
    border-radius: 12px;
    color: var(--color-blue-700, #0056a3);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 200ms;
}
.stws-toggle-rare:hover {
    background: var(--color-blue-50, #eff6ff);
    border-style: solid;
}
.stws-toggle-rare svg {
    transition: transform 200ms;
}
.stws-toggle-rare[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Banner de validación cruzada */
.stws-warning {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--color-warning-soft, #fef3c7);
    border-left: 3px solid var(--color-warning, #d97706);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #92400e;
    display: flex; align-items: flex-start; gap: 10px;
}
.stws-warning-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1;
    margin-top: 1px;
}
.stws-warning-text strong {
    color: #92400e;
    display: inline-block;
    margin-right: 4px;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .stws-row {
        grid-template-columns: 70px 1fr 22px;
        gap: 8px;
    }
    .stws-help-bubble {
        width: 240px;
    }
    .stws-num-group {
        flex-direction: column;
        align-items: stretch;
    }
    .stws-num-select {
        width: 100%;
    }
}
