/* ============================================================================
 * Lote F — Refactor del modo avanzado de /ensayos-clinicos
 *
 * Estilos para los 4 bloques numerados, los chips de quick-filter y el panel
 * colapsable de filtros adicionales. Se carga DESPUÉS del CSS principal.
 *
 * Lote G (Visual refinement) — May 2026:
 * - Tipografía y jerarquía mejorada en los bloques numerados (1-4)
 * - Iconos temáticos por sección
 * - Subtítulos descriptivos
 * ============================================================================ */

/* ---------- Search header ---------- */

.ct-search-header h3 {
    font-weight: 500;
    color: var(--color-heading, #002855);
}

.ct-search-bar {
    display: flex;
    gap: 8px;
}

.ct-search-bar #searchBox {
    flex: 1;
}

@media (max-width: 600px) {
    .ct-search-bar {
        flex-direction: column;
    }
}

/* ---------- Quick filters (deprecated, removidos en Lote G) ---------- */
/* Mantenidos por compatibilidad con cualquier módulo que aún los referencie */

.ct-quick-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ct-quick-label {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    margin-right: 4px;
}

.ct-quick-filters .filter-badge {
    padding: 4px 12px;
    font-size: 0.85rem;
    border-radius: 999px;
}

/* ---------- Bloques numerados (1-4) — Lote G ---------- */

.ct-block {
    border: 1px solid var(--color-slate-200, #e2e8f0);
    border-radius: 12px;
    padding: 20px 24px 22px;
    margin-bottom: 1.5rem;
    background: var(--color-white, #ffffff);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ct-block:hover {
    border-color: var(--color-slate-300, #cbd5e1);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.ct-block-legend {
    width: 100%;
    padding: 0;
    margin-bottom: 1.25rem;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--color-heading, #002855);
    display: flex;
    align-items: center;
    gap: 14px;
    background: transparent;
    line-height: 1.3;
    float: none;
}

.ct-block-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary, #0056a3);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(0, 86, 163, 0.08);
}

.ct-block-title-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ct-block-title {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--color-heading, #002855);
    line-height: 1.3;
}

.ct-block-sub {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-muted, #64748b);
    line-height: 1.4;
    letter-spacing: normal;
}

.ct-block-icon {
    font-size: 1.4rem;
    color: var(--color-primary, #0056a3);
    opacity: 0.55;
    flex-shrink: 0;
}

/* Acentos de color por bloque (variados, no todo azul) */
.ct-block-1 .ct-block-num { background: #dc2626; box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.10); }
.ct-block-2 .ct-block-num { background: #7c3aed; box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.10); }
.ct-block-3 .ct-block-num { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.10); }
.ct-block-4 .ct-block-num { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.10); }

.ct-block-1 .ct-block-icon { color: #dc2626; }
.ct-block-2 .ct-block-icon { color: #7c3aed; }
.ct-block-3 .ct-block-icon { color: #10b981; }
.ct-block-4 .ct-block-icon { color: #f59e0b; }

/* ---------- Action bar (botones inferiores + banner CTA) — Lote G ---------- */

.ct-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-slate-200, #e2e8f0);
}

.ct-action-context {
    flex: 1 1 auto;
    min-width: 280px;
}

.ct-action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Banner CTA compacto (sustituye los botones enormes "Inicia sesión" / "Coincidir con mi perfil") */
.ct-cta-banner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 10px 14px;
    background: #e6f1fb;
    border: 1px solid #b5d4f4;
    border-left: 3px solid #185fa5;
    border-radius: 10px;
    color: #0c447c;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    text-align: left;
    max-width: 100%;
}

.ct-cta-banner:hover {
    background: #d5e7f8;
    border-color: #85b7eb;
    border-left-color: #0c447c;
    color: #042c53;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(12, 68, 124, 0.08);
    text-decoration: none;
}

.ct-cta-icon {
    font-size: 1.5rem;
    color: #185fa5;
    flex-shrink: 0;
}

.ct-cta-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
    min-width: 0;
}

.ct-cta-text strong {
    font-size: 0.95rem;
    font-weight: 500;
    color: #0c447c;
}

.ct-cta-text small {
    font-size: 0.78rem;
    color: #185fa5;
    line-height: 1.3;
}

.ct-cta-arrow {
    font-size: 0.95rem;
    color: #185fa5;
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.ct-cta-banner:hover .ct-cta-arrow {
    transform: translateX(3px);
}

/* Variantes por contexto */
.ct-cta-match {
    background: #eaf3de;
    border-color: #c0dd97;
    border-left-color: #3b6d11;
    color: #173404;
}
.ct-cta-match .ct-cta-icon,
.ct-cta-match .ct-cta-arrow,
.ct-cta-match .ct-cta-text small { color: #3b6d11; }
.ct-cta-match .ct-cta-text strong { color: #173404; }
.ct-cta-match:hover {
    background: #dcecc8;
    border-color: #97c459;
    border-left-color: #173404;
    color: #173404;
}

.ct-cta-setup {
    background: #faeeda;
    border-color: #fac775;
    border-left-color: #854f0b;
    color: #412402;
}
.ct-cta-setup .ct-cta-icon,
.ct-cta-setup .ct-cta-arrow,
.ct-cta-setup .ct-cta-text small { color: #854f0b; }
.ct-cta-setup .ct-cta-text strong { color: #412402; }
.ct-cta-setup:hover {
    background: #f5dfba;
    border-color: #ef9f27;
    border-left-color: #412402;
    color: #412402;
}

/* Botones Limpiar / Buscar — más limpios, no "pill" estilizadas */
.ct-btn-clear {
    background: var(--color-white, #ffffff);
    border: 1px solid var(--color-slate-300, #cbd5e1);
    color: var(--text-secondary, #475569);
    font-weight: 500;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 0.92rem;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ct-btn-clear:hover {
    background: var(--color-slate-50, #f8fafc);
    border-color: var(--color-slate-400, #94a3b8);
    color: var(--text-primary, #1e293b);
}

.ct-btn-search {
    background: var(--color-primary, #0056a3);
    border: 1px solid var(--color-primary, #0056a3);
    color: #ffffff;
    font-weight: 500;
    border-radius: 8px;
    padding: 9px 22px;
    font-size: 0.92rem;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0, 86, 163, 0.15);
}

.ct-btn-search:hover {
    background: #03447d;
    border-color: #03447d;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 86, 163, 0.25);
    transform: translateY(-1px);
}

.ct-btn-search:active {
    transform: translateY(0);
}

.ct-btn-sync {
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 0.9rem;
}

/* ---------- Panel "Filtros adicionales" colapsable ---------- */

.ct-extra-filters {
    border: 1px dashed var(--color-slate-300, #cbd5e1);
    border-radius: 10px;
    padding: 0;
    margin-bottom: 1rem;
    background: var(--color-slate-50, #f8fafc);
}

.ct-extra-summary {
    cursor: pointer;
    padding: 12px 18px;
    font-size: 0.9rem;
    color: var(--text-primary, #1e293b);
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ct-extra-summary::-webkit-details-marker {
    display: none;
}

.ct-extra-summary i {
    transition: transform 0.18s ease;
    font-size: 0.8rem;
}

.ct-extra-filters[open] .ct-extra-summary i {
    transform: rotate(180deg);
}

.ct-extra-summary small {
    color: var(--text-muted, #64748b);
    font-size: 0.78rem;
}

.ct-extra-body {
    padding: 0 18px 16px;
    border-top: 1px dashed var(--color-slate-300, #cbd5e1);
    padding-top: 14px;
}

/* ---------- Compatibilidad: oculta los inputs hidden completamente ---------- */

.ct-hidden-compat {
    display: none !important;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .ct-block {
        padding: 16px 16px 18px;
    }

    .ct-block-legend {
        font-size: 1rem;
        gap: 10px;
    }

    .ct-block-num {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .ct-block-title {
        font-size: 1rem;
    }

    .ct-block-sub {
        font-size: 0.75rem;
    }

    .ct-block-icon {
        font-size: 1.15rem;
    }

    .ct-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .ct-action-buttons {
        justify-content: flex-end;
    }

    .ct-cta-banner {
        width: 100%;
    }
}

/* ============================================================
 * Lote G+ — Indicador de cambios pendientes en filtros genéticos
 * ============================================================ */

.ct-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    color: #92400e;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: help;
    animation: ct-pending-fade-in 0.2s ease-out;
}

.ct-pending-badge.d-none {
    display: none !important;
}

.ct-pending-icon {
    font-size: 1rem;
    color: #d97706;
    animation: ct-pending-pulse 1.6s ease-in-out infinite;
}

@keyframes ct-pending-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ct-pending-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* Botón Buscar resaltado cuando hay cambios pendientes */
.ct-btn-search.has-pending {
    background: #d97706;
    border-color: #b45309;
    color: #ffffff;
    animation: ct-search-pulse 1.6s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

.ct-btn-search.has-pending:hover {
    background: #b45309;
    border-color: #92400e;
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.28);
}

@keyframes ct-search-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18); }
    50%      { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.32); }
}

/* Responsive */
@media (max-width: 768px) {
    .ct-pending-badge {
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }
}

/* ============================================================
 * Lote G+ — Segmented control (toggle Buscador / Mis Ensayos)
 * Sobrescribe el aspecto del nav-pills de Bootstrap cuando lleva
 * la clase .ct-segmented. La lógica de Bootstrap (data-bs-toggle)
 * sigue funcionando intacta.
 * ============================================================ */

.ct-segmented {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: auto;
    flex-wrap: nowrap;
}

.ct-segmented .nav-item {
    margin: 0;
    list-style: none;
}

/* Sobrescribir Bootstrap .nav-pills .nav-link */
.ct-segmented .nav-link {
    padding: 7px 14px;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    font-size: 0.92rem;
    font-weight: 400;
    border: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.ct-segmented .nav-link i {
    font-size: 0.95rem;
    margin: 0;
    line-height: 1;
}

.ct-segmented .nav-link:hover {
    color: #1e293b;
    background: rgba(255, 255, 255, 0.5);
}

/* Sobrescribir el .active de nav-pills (que pone fondo azul) */
.ct-segmented .nav-link.active,
.ct-segmented .nav-pills .nav-link.active,
.ct-segmented .show > .nav-link {
    background: #ffffff !important;
    color: #185fa5 !important;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ct-segmented .nav-link.active:hover {
    background: #ffffff !important;
    color: #185fa5 !important;
}

/* Badge contador de Mis Ensayos dentro del segmented */
.ct-segmented .nav-link .badge {
    background: #185fa5 !important;
    color: #ffffff !important;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    margin-left: 6px;
}

/* Cuando NO está activo, el badge se ve más sutil */
.ct-segmented .nav-link:not(.active) .badge {
    background: #cbd5e1 !important;
    color: #334155 !important;
}

/* Responsive */
@media (max-width: 480px) {
    .ct-segmented {
        width: 100%;
    }
    .ct-segmented .nav-item {
        flex: 1;
    }
    .ct-segmented .nav-link {
        width: 100%;
        justify-content: center;
        font-size: 0.88rem;
        padding: 8px 10px;
    }
}
