/* ═══════════════════════════════════════════════════════════
   GuardianAI — Orchestrator & Context Analyzer Styles
   orchestrator.css
   ═══════════════════════════════════════════════════════════ */

/* ── Agent Pipeline Badges ───────────────────────────────── */
.agent-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 500;
}

.agent-badge {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(110, 231, 247, 0.2);
    background: rgba(110, 231, 247, 0.06);
    color: var(--cyan);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.orch-badge {
    border-color: rgba(167, 139, 250, 0.35);
    background: rgba(167, 139, 250, 0.1);
    color: var(--violet);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.15);
}

.badge-arrow {
    color: var(--dim);
    font-size: 0.8rem;
}

@media (max-width: 960px) {
    .agent-badges {
        display: none;
    }
}

/* ── Agent Section Labels ─────────────────────────────────── */
.agent-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: auto;
}

.ctx-label {
    background: rgba(251, 146, 60, 0.12);
    border: 1px solid rgba(251, 146, 60, 0.3);
    color: #fb923c;
}

.orch-label {
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: var(--violet);
}

/* ── Orchestrator Card Override ───────────────────────────── */
.orch-card>.card-header {
    border-bottom: 1px solid rgba(167, 139, 250, 0.15);
    background: rgba(167, 139, 250, 0.03);
}

.orch-json-card>.card-header {
    border-bottom: 1px solid rgba(167, 139, 250, 0.15);
    background: rgba(167, 139, 250, 0.03);
}

/* ── Risk Panel ───────────────────────────────────────────── */
.risk-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 14px;
}

/* Risk Score Box */
.risk-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 12px;
    padding: 16px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s, box-shadow 0.4s;
}

.risk-score-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(34, 197, 94, 0.08) 0%, transparent 70%);
    transition: background 0.5s;
    pointer-events: none;
}

.risk-score-box.medium::before {
    background: radial-gradient(ellipse at center, rgba(234, 179, 8, 0.1) 0%, transparent 70%);
}

.risk-score-box.high::before {
    background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.14) 0%, transparent 70%);
}

.risk-score-box.low {
    border-color: rgba(34, 197, 94, 0.3);
}

.risk-score-box.medium {
    border-color: rgba(234, 179, 8, 0.35);
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.1);
}

.risk-score-box.high {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 28px rgba(239, 68, 68, 0.15);
    animation: high-glow 1.1s ease infinite alternate;
}

@keyframes high-glow {
    from {
        box-shadow: 0 0 18px rgba(239, 68, 68, 0.12);
    }

    to {
        box-shadow: 0 0 36px rgba(239, 68, 68, 0.32);
    }
}

.risk-score-num {
    font-size: 2.8rem;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
    position: relative;
    transition: color 0.4s;
}

.risk-score-num.low {
    color: var(--green);
}

.risk-score-num.medium {
    color: var(--yellow);
}

.risk-score-num.high {
    color: var(--red);
}

.risk-level-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 20px;
    position: relative;
    transition: all 0.4s;
}

.risk-level-badge.low {
    background: rgba(34, 197, 94, 0.12);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.risk-level-badge.medium {
    background: rgba(234, 179, 8, 0.12);
    color: var(--yellow);
    border: 1px solid rgba(234, 179, 8, 0.35);
}

.risk-level-badge.high {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.risk-justification {
    font-size: 0.68rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.4;
    position: relative;
    margin-top: 2px;
    padding: 0 4px;
}

/* Action Box */
.action-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-radius: 12px;
    padding: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    transition: border-color 0.4s;
}

.action-label {
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.action-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.action-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    transition: color 0.4s;
}

.action-service {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--cyan);
    margin-top: 2px;
}

.action-service-icon {
    font-size: 0.9rem;
}

/* Escalation Steps */
.action-steps {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.action-step {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: var(--surface);
    transition: background 0.4s;
}

.action-step.done-nothing {
    background: var(--dim);
}

.action-step.done-warning {
    background: var(--yellow);
}

.action-step.done-public {
    background: #fb923c;
}

.action-step.done-contact {
    background: var(--violet);
}

.action-step.done-sos {
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
}

/* ── Context Analyzer Card ────────────────────────────────── */
.context-card>.card-header {
    border-bottom: 1px solid rgba(251, 146, 60, 0.15);
    background: rgba(251, 146, 60, 0.03);
}

.ctx-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 160px;
}

@media (max-width: 700px) {
    .ctx-grid {
        grid-template-columns: 1fr;
    }
}

.ctx-section {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ctx-section:first-child {
    border-right: 1px solid var(--border);
}

.ctx-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

/* Threat severity bar */
.threat-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.threat-bar-track {
    flex: 1;
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
}

.threat-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: var(--green);
    transition: width 0.5s ease, background 0.5s ease;
}

.threat-bar-val {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text);
    min-width: 22px;
    text-align: right;
}

.threat-bar-unit {
    font-size: 0.65rem;
    color: var(--dim);
}

/* Category tags */
.threat-cats {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.cat-tag {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.67rem;
    font-weight: 500;
    background: rgba(251, 146, 60, 0.1);
    border: 1px solid rgba(251, 146, 60, 0.28);
    color: #fb923c;
    text-transform: capitalize;
    transition: all 0.3s;
}

.none-tag {
    background: transparent;
    border-color: var(--border);
    color: var(--dim);
    font-style: italic;
}

/* Services list */
.services-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
    animation: fadeSlideIn 0.3s ease-out;
}

.service-item.nearest {
    border-color: rgba(110, 231, 247, 0.35);
    background: rgba(110, 231, 247, 0.04);
}

.service-item.service-placeholder {
    opacity: 0.5;
}

.service-icon {
    font-size: 1rem;
}

.service-name {
    font-size: 0.76rem;
    font-weight: 500;
    flex: 1;
    line-height: 1.2;
}

.service-dist {
    font-size: 0.68rem;
    color: var(--muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.service-badge {
    font-size: 0.58rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(110, 231, 247, 0.12);
    color: var(--cyan);
    border: 1px solid rgba(110, 231, 247, 0.28);
    white-space: nowrap;
    font-weight: 600;
}

/* ── SOS Overlay ──────────────────────────────────────────── */
.sos-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 12, 23, 0.94);
    backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
    padding: 24px;
}

.sos-overlay.active {
    display: flex;
    animation: sos-flash 0.85s ease-in-out infinite alternate;
}

@keyframes sos-flash {
    from {
        background: rgba(5, 12, 23, 0.94);
    }

    to {
        background: rgba(40, 5, 5, 0.97);
    }
}

.sos-icon {
    font-size: 5rem;
    animation: sos-scale 0.85s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.7));
}

@keyframes sos-scale {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.15);
    }
}

.sos-text {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--red);
    letter-spacing: 0.08em;
    text-shadow: 0 0 24px rgba(239, 68, 68, 0.6);
}

.sos-sub {
    font-size: 0.95rem;
    color: var(--muted);
    line-height: 1.6;
    max-width: 400px;
}

.sos-dismiss {
    margin-top: 10px;
    padding: 11px 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--red);
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sos-dismiss:hover {
    background: var(--red);
    color: #fff;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}