/*
 * v2-panels.css — Tokens extendidos para paneles de observabilidad
 * Inspiración: eadmin2/jarvis_ai, builderz-labs/mission-control, CYBER v3
 * Lección crítica: todo debe ser datos reales, no decoración
 */

/* ============================================
   1. ESTADOS DE AGENTES (panel "agentes vivos")
   ============================================ */
.agent-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
}
.agent-status .pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}
.agent-status .pulse::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
}
.agent-status.online .pulse { background: var(--green); }
.agent-status.online .pulse::before { background: var(--green); }
.agent-status.idle .pulse { background: var(--amber); }
.agent-status.idle .pulse::before { background: var(--amber); }
.agent-status.error .pulse { background: var(--red); }
.agent-status.error .pulse::before { background: var(--red); }

@keyframes pulse-ring {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(2); }
}

/* ============================================
   2. BADGES DE ACTIVIDAD (paneles observabilidad)
   ============================================ */
.badge-activity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-activity.active {
    background: rgba(63, 182, 139, 0.15);
    color: var(--green);
    border: 1px solid var(--green);
}
.badge-activity.pending {
    background: rgba(229, 168, 75, 0.15);
    color: var(--amber);
    border: 1px solid var(--amber);
}
.badge-activity.critical {
    background: rgba(224, 82, 82, 0.15);
    color: var(--red);
    border: 1px solid var(--red);
}

/* ============================================
   3. APPROVAL CARDS (panel "quick actions")
   ============================================ */
.approval-card {
    background: var(--surface);
    border: 2px solid var(--amber);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
}
.approval-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.approval-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--amber);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.approval-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.btn-allow {
    background: var(--green);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-allow:hover { background: #2d9a70; }
.btn-deny {
    background: transparent;
    color: var(--red);
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--red);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-deny:hover { background: rgba(224, 82, 82, 0.1); }

/* ============================================
   4. BOTÓN STOP (global + quick actions)
   ============================================ */
.btn-stop {
    background: var(--red);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-stop:hover { background: #c73e3e; }
.btn-stop::before {
    content: '■';
    font-size: 14px;
}

/* Botón STOP global en header */
.header-stop {
    background: var(--red);
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--radius);
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.2s;
}
.header-stop:hover { background: #c73e3e; }

/* ============================================
   5. TIMELINE DE ACTIVIDAD (panel "activity feed en vivo")
   ============================================ */
.timeline {
    position: relative;
    padding-left: 24px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item {
    position: relative;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
    position: absolute;
    left: -20px;
    top: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
}
.timeline-dot.success { background: var(--green); }
.timeline-dot.warning { background: var(--amber); }
.timeline-dot.error { background: var(--red); }
.timeline-time {
    font-size: 11px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.timeline-content {
    font-size: 13px;
    color: var(--text);
    margin-top: 4px;
}
.timeline-agent {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 2px;
}

/* ============================================
   6. TRACKING DE USO (panel "tracking de uso")
   ============================================ */
.usage-meter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.usage-meter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.usage-meter-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.usage-meter-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    overflow: hidden;
}
.usage-meter-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.usage-meter-fill.low { background: var(--green); }
.usage-meter-fill.medium { background: var(--amber); }
.usage-meter-fill.high { background: var(--red); }

/* ============================================
   7. LIVE AGENT ACTIVITY (panel "live agent activity")
   ============================================ */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}
.activity-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 12.5px;
}
.activity-item:hover { border-color: var(--accent); }
.activity-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.activity-item-agent {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.activity-item-time {
    font-size: 10.5px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.activity-item-content {
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    word-break: break-word;
}

/* ============================================
   8. GRID LAYOUTS PARA NUEVOS PANELES
   ============================================ */
.panel-grid-v2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
}
@media (min-width: 1024px) {
    .panel-grid-v2 {
        grid-template-columns: repeat(3, 1fr);
    }
}
.panel-grid-v2 .span-2 { grid-column: span 2; }
.panel-grid-v2 .span-3 { grid-column: span 3; }

/* ============================================
   9. MOBILE-FIRST RESPONSIVE
   ============================================ */
@media (max-width: 1023px) {
    .panel-grid-v2 {
        grid-template-columns: 1fr;
    }
    .panel-grid-v2 .span-2,
    .panel-grid-v2 .span-3 {
        grid-column: span 1;
    }
    .approval-card-actions {
        flex-direction: column;
    }
    .btn-allow, .btn-deny {
        width: 100%;
    }
}

/* ============================================
   10. UTILIDADES ADICIONALES
   ============================================ */
.mono {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fade-in {
    animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
