/* ══════════════════════════════════════════════════════════════════════
   Jobs Detail — Pipeline Blocks + Cheerio Card + Escalation Chain +
   Extractor Split + Filter Catalog

   Extraído de jobs-ui.css (Anti-Monolith Sección XIV) — el archivo
   principal había crecido a ~1966 líneas. Esta partición concentra los
   bloques del modo "Diseño" del job: Pipeline visual + tarjeta del código
   Cheerio + selector de escalation chain + split del extractor + catálogo
   de filtros disponibles.

   jobs-ui.css queda con: thumb cards del grid + back button + config
   sections + tooltips + day picker.
   jobs-detail-extras.css queda con: tests + buttons + tables + badges +
   toasts + loaders + utilities + toggle + filter editor + logs + charts.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Job Header Right ── */
.job-header-right { display: flex; align-items: center; gap: 16px; }
.scheduler-badge {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.78rem; color: var(--text-dim);
    background: rgba(255,255,255,0.03); padding: 6px 14px;
    border-radius: 8px; border: 1px solid var(--glass-border);
}
.scheduler-badge i { width: 14px; height: 14px; }

/* ── Day Picker ── */
.day-picker {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}
.day-chip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    color: var(--text-dim);
    font-size: 0.82rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
    user-select: none;
}
.day-chip:hover { border-color: var(--accent); color: var(--text-main); }
.day-chip.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(124, 77, 255, 0.2);
}

/* ── Pipeline Blocks ── */
.pipeline-block {
    margin-top: 24px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255,255,255,0.01);
}

.pipeline-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
}
.pipeline-header i { width: 22px; height: 22px; flex-shrink: 0; }
.pipeline-header h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.pipeline-header .pipeline-desc { color: var(--text-faint); font-size: 0.78rem; margin-left: auto; }

.pipeline-header.source {
    border-top: 3px solid var(--info);
    color: var(--info);
}
.pipeline-header.source h2 { color: var(--text-main); }

.pipeline-header.content {
    border-top: 3px solid var(--accent);
    color: var(--accent);
}
.pipeline-header.content h2 { color: var(--text-main); }

.pipeline-block .config-section { padding: 20px 24px; border-top: none; }
.pipeline-block .config-section + .config-section { border-top: 1px solid var(--glass-border); }
.pipeline-block .test-section { padding: 20px 24px; border-top: 1px solid var(--glass-border); }

.textarea-tall { min-height: 120px; resize: vertical; line-height: 1.6; }

/* ── Expandable Card (Prompt) ── */
.expandable-card {
    margin-top: 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.expandable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
}
.expandable-header:hover { background: var(--glass-hover); }
.expandable-header span { display: flex; align-items: center; gap: 8px; }
.expandable-header i { width: 16px; height: 16px; }
.expand-chevron { transition: transform 0.3s ease; }

.expandable-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 18px;
}

.expandable-card.expanded .expandable-body {
    max-height: 600px;
    padding: 16px 18px;
    overflow-y: auto;
}
.expandable-card.expanded .expand-chevron {
    transform: rotate(180deg);
}

.prompt-textarea {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    line-height: 1.7;
    font-size: 0.84rem;
    white-space: pre-wrap;
}

/* ── Cheerio Code Card ── */
.expandable-card--code {
    border-color: rgba(34, 211, 238, 0.12);
    border-left: 3px solid rgba(34, 211, 238, 0.35);
    border-radius: 10px;
}
.expandable-card--code .expandable-header {
    background: rgba(34, 211, 238, 0.04);
    color: #67e8f9;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    padding: 11px 16px;
}
.expandable-card--code .expandable-header span { color: #67e8f9; }
.expandable-card--code .expandable-header i { color: #22d3ee; opacity: 0.9; }
.expandable-card--code .expandable-header:hover {
    background: rgba(34, 211, 238, 0.08);
}
.expandable-card--code.expanded {
    border-color: rgba(34, 211, 238, 0.28);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.08), 0 4px 24px rgba(0, 0, 0, 0.4);
}
.expandable-card--code .expandable-body {
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(34, 211, 238, 0.08);
}
.expandable-card--code.expanded .expandable-body {
    padding: 0;
    max-height: 750px;
}
.expandable-card--code .prompt-textarea {
    background: transparent;
    border: none !important;
    box-shadow: none !important;
    color: #cdd9e5;
    font-family: var(--font-mono) !important;
    font-size: 0.79rem !important;
    line-height: 1.7;
    padding: 18px 20px;
    min-height: 300px;
    resize: vertical;
    outline: none;
    white-space: pre;
    overflow-x: auto;
}
.expandable-card--code .prompt-textarea.editing {
    color: #e2edf7;
    background: rgba(34, 211, 238, 0.025) !important;
    box-shadow: none !important;
    border: none !important;
}

/* ── Escalation Chain Selector ── */
.escalation-chain {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 12px 16px;
}
.escalation-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.18s ease;
    min-width: 110px;
    position: relative;
}
.escalation-node svg { width: 16px; height: 16px; margin-bottom: 2px; opacity: 0.4; }
.escalation-node .esc-label { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; }
.escalation-node .esc-desc { font-size: 0.66rem; opacity: 0.5; white-space: nowrap; }
.escalation-node.in-chain {
    color: rgba(255, 255, 255, 0.5);
    border-color: rgba(139, 92, 246, 0.25);
    background: rgba(139, 92, 246, 0.05);
}
.escalation-node.in-chain svg { opacity: 0.6; }
.escalation-node.is-start {
    color: #fff;
    border-color: rgba(139, 92, 246, 0.7);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3), 0 2px 12px rgba(139, 92, 246, 0.2);
}
.escalation-node.is-start svg { opacity: 1; color: #a78bfa; }
.escalation-node.is-start .esc-label { color: #c4b5fd; }
.escalation-node.is-start::before {
    /* [v5.7.27.288] Texto i18n vía attr(data-start-label) — el template
       inyecta data-start-label="${t('jobs.escalation_start_badge')}" en
       cada nodo. Fallback en español si falta el atributo. */
    content: attr(data-start-label);
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 4px;
    padding: 1px 5px;
}
.escalation-node:hover:not(.is-start) {
    border-color: rgba(139, 92, 246, 0.4);
    color: rgba(255, 255, 255, 0.75);
}
.escalation-arrow {
    display: flex;
    align-items: center;
    padding: 0 6px;
    color: rgba(255, 255, 255, 0.1);
    transition: color 0.18s;
}
.escalation-arrow svg { width: 14px; height: 14px; }
.escalation-arrow.in-chain { color: rgba(139, 92, 246, 0.45); }

/* ── Extractor Split Layout ── */
.extractor-split-body {
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    padding: 0 !important;
}
.extractor-split-body .prompt-textarea {
    flex: 0 0 58%;
    min-width: 0;
    border-right: 1px solid rgba(34, 211, 238, 0.08) !important;
    border-radius: 0 !important;
    resize: none;
}
.extractor-result-panel {
    flex: 0 0 42%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
.extractor-result-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 0.69rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    background: rgba(34, 211, 238, 0.02);
}
.extractor-result-label svg { width: 11px; height: 11px; opacity: 0.7; }
.extractor-result-label .extractor-result-count {
    margin-left: auto;
    font-size: 0.65rem;
    color: rgba(34, 211, 238, 0.5);
    font-weight: 700;
    letter-spacing: 0;
}
.extractor-result-pre {
    flex: 1;
    margin: 0;
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.38);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    max-height: 420px;
    background: transparent;
}
.extractor-result-pre.has-result { color: rgba(255, 255, 255, 0.6); }
.extractor-result-pre .res-item { margin-bottom: 6px; }
.extractor-result-pre .res-item-num { color: rgba(34, 211, 238, 0.5); margin-right: 4px; }
.extractor-result-pre .res-item-title { color: rgba(255, 255, 255, 0.75); }
.extractor-result-pre .res-item-url { color: rgba(255, 255, 255, 0.28); font-size: 0.65rem; display: block; }

/* ── Filter Catalog ── */
.filter-catalog-wrap {
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.filter-table td { font-size: 0.84rem; }

.filter-logic-badge {
    font-size: 0.7rem;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 6px;
    margin-left: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.field-badge {
    font-size: 0.82rem;
    font-weight: 500;
}

.type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.type-badge.text { background: rgba(64, 196, 255, 0.12); color: var(--info); }
.type-badge.numeric { background: rgba(255, 215, 64, 0.12); color: var(--warning); }
.type-badge.datetime { background: rgba(124, 77, 255, 0.12); color: var(--accent); }
.type-badge.boolean { background: rgba(0, 230, 118, 0.12); color: var(--success); }

.filter-value {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-main);
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

