/* ============================================================================
   PPL ZeroOps Operations Center — Stylesheet
   Brand: PPL Corporation (Electric Utility)
   Primary: #00529B (PPL Blue), Secondary: #2E8B57 (Operational Green)
   ============================================================================ */

:root {
    /* PPL Brand Colors */
    --ppl-blue: #00529B;
    --ppl-blue-dark: #003B6F;
    --ppl-blue-light: #E8F0FE;
    --ppl-green: #2E8B57;
    --ppl-green-light: #E8F5E9;

    /* Status Colors */
    --status-healthy: #2E8B57;
    --status-detecting: #F9A825;
    --status-diagnosing: #FF8F00;
    --status-approval: #7B1FA2;
    --status-remediating: #1565C0;
    --status-validating: #00838F;
    --status-resolved: #2E7D32;
    --status-critical: #C62828;
    --status-failed: #B71C1C;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;

    /* Surfaces */
    --bg-primary: #0A1628;
    --bg-secondary: #111D33;
    --bg-card: #162032;
    --bg-card-hover: #1C2A42;
    --border-color: #253552;
    --text-primary: #E8EAED;
    --text-secondary: #9AA0A6;
    --text-muted: #5F6368;

    /* Typography */
    --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* ============================================================================
   RESET & BASE
   ============================================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--ppl-blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 8px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 82, 155, 0.15);
    color: var(--ppl-blue);
    border-right: 3px solid var(--ppl-blue);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.system-status.operational {
    background: rgba(46, 139, 87, 0.15);
    color: var(--status-healthy);
    border: 1px solid rgba(46, 139, 87, 0.3);
}

.system-status.degraded {
    background: rgba(198, 40, 40, 0.15);
    color: var(--status-critical);
    border: 1px solid rgba(198, 40, 40, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-time {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* Content area */
.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ============================================================================
   METRICS GRID
   ============================================================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.metric-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--ppl-blue);
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.metric-value.good { color: var(--status-healthy); }
.metric-value.warn { color: var(--status-detecting); }
.metric-value.bad { color: var(--status-critical); }

.metric-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================================
   SCENARIO CARDS
   ============================================================================ */

.scenarios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.scenarios-title {
    font-size: 16px;
    font-weight: 600;
}

.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.scenario-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.scenario-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.scenario-card.active {
    border-color: var(--ppl-blue);
    box-shadow: 0 0 20px rgba(0, 82, 155, 0.15);
}

.scenario-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.scenario-card.healthy::before { background: var(--status-healthy); }
.scenario-card.detecting::before { background: var(--status-detecting); }
.scenario-card.diagnosing::before { background: var(--status-diagnosing); }
.scenario-card.awaiting_approval::before { background: var(--status-approval); }
.scenario-card.remediating::before { background: var(--status-remediating); }
.scenario-card.validating::before { background: var(--status-validating); }
.scenario-card.resolved::before { background: var(--status-resolved); }

.scenario-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.scenario-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.scenario-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.scenario-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.scenario-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.scenario-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-status {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.badge-status.healthy { background: rgba(46, 139, 87, 0.15); color: var(--status-healthy); }
.badge-status.detecting { background: rgba(249, 168, 37, 0.15); color: var(--status-detecting); }
.badge-status.diagnosing { background: rgba(255, 143, 0, 0.15); color: var(--status-diagnosing); }
.badge-status.awaiting_approval { background: rgba(123, 31, 162, 0.15); color: var(--status-approval); }
.badge-status.remediating { background: rgba(21, 101, 192, 0.15); color: var(--status-remediating); }
.badge-status.validating { background: rgba(0, 131, 143, 0.15); color: var(--status-validating); }
.badge-status.resolved { background: rgba(46, 125, 50, 0.15); color: var(--status-resolved); }

.badge-severity {
    background: rgba(198, 40, 40, 0.15);
    color: var(--status-critical);
}

.badge-severity.high { background: rgba(255, 143, 0, 0.15); color: var(--status-diagnosing); }
.badge-severity.medium { background: rgba(249, 168, 37, 0.15); color: var(--status-detecting); }
.badge-severity.low { background: rgba(46, 139, 87, 0.15); color: var(--status-healthy); }

.scenario-confidence {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Scenario actions */
.scenario-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-family);
}

.btn-primary {
    background: var(--ppl-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--ppl-blue-dark);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-success {
    background: var(--status-healthy);
    color: white;
}

.btn-danger {
    background: var(--status-critical);
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
}

/* ============================================================================
   TIMELINE
   ============================================================================ */

.timeline-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.timeline-title {
    font-size: 15px;
    font-weight: 600;
}

.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-event {
    position: relative;
    padding: 12px 0;
    padding-left: 16px;
}

.timeline-event::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-card);
}

.timeline-event.detect::before { background: var(--status-detecting); }
.timeline-event.diagnose::before { background: var(--status-diagnosing); }
.timeline-event.plan::before { background: var(--status-diagnosing); }
.timeline-event.approve::before { background: var(--status-approval); }
.timeline-event.remediate::before { background: var(--status-remediating); }
.timeline-event.validate::before { background: var(--status-validating); }
.timeline-event.learn::before { background: var(--status-resolved); }

.timeline-event-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.timeline-event-action {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-event-agent {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.timeline-event-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.timeline-event-confidence {
    font-size: 11px;
    color: var(--ppl-blue);
    font-family: var(--font-mono);
    margin-top: 4px;
}

/* ============================================================================
   LIVE FEED
   ============================================================================ */

.feed-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.feed-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 12px;
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-time {
    font-family: var(--font-mono);
    color: var(--text-muted);
    white-space: nowrap;
    font-size: 11px;
    min-width: 70px;
}

.feed-source {
    font-weight: 600;
    color: var(--ppl-blue);
    min-width: 100px;
}

.feed-message {
    color: var(--text-secondary);
    flex: 1;
}

/* ============================================================================
   DEMO CONTROLS
   ============================================================================ */

.demo-controls {
    background: var(--bg-card);
    border: 1px solid rgba(249, 168, 37, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.demo-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--status-detecting);
    font-weight: 700;
}

.demo-buttons {
    display: flex;
    gap: 8px;
}

/* ============================================================================
   MODE TOGGLE (DEMO / LIVE)
   ============================================================================ */

.mode-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.mode-toggle input {
    display: none;
}

.mode-slider {
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
}

.mode-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.mode-toggle input:checked + .mode-slider {
    background: #C62828;
}

.mode-toggle input:checked + .mode-slider::after {
    transform: translateX(20px);
}

.mode-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.mode-toggle input:checked ~ .mode-text {
    color: #C62828;
}

/* ============================================================================
   CHAOS CONTROLS
   ============================================================================ */

.chaos-controls {
    background: var(--bg-card);
    border: 1px solid rgba(198, 40, 40, 0.4);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    animation: slideIn 0.3s ease;
}

.chaos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chaos-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #C62828;
    font-weight: 700;
}

.chaos-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.chaos-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.chaos-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chaos-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.chaos-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1200px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .scenarios-grid { grid-template-columns: 1fr; }
    .chaos-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .metrics-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   DATA TABLES (for tab views)
   ============================================================================ */

.data-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-secondary);
    line-height: 1.5;
}

.data-table tr:hover td {
    background: var(--bg-card-hover);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.table-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-badge.healthy, .table-badge.completed, .table-badge.enabled, .table-badge.approved, .table-badge.auto-approved {
    background: rgba(46,139,87,0.15);
    color: var(--status-healthy);
}

.table-badge.warning, .table-badge.standby {
    background: rgba(249,168,37,0.15);
    color: var(--status-detecting);
}

.table-badge.critical, .table-badge.failed {
    background: rgba(198,40,40,0.15);
    color: var(--status-critical);
}

.table-badge.medium {
    background: rgba(255,143,0,0.15);
    color: var(--status-diagnosing);
}

.table-badge.low {
    background: rgba(46,139,87,0.15);
    color: var(--status-healthy);
}

.table-badge.detection { background: rgba(249,168,37,0.12); color: var(--status-detecting); }
.table-badge.diagnosis { background: rgba(255,143,0,0.12); color: var(--status-diagnosing); }
.table-badge.remediation { background: rgba(21,101,192,0.12); color: var(--status-remediating); }
.table-badge.approval { background: rgba(123,31,162,0.12); color: var(--status-approval); }
.table-badge.planning { background: rgba(0,131,143,0.12); color: var(--status-validating); }
.table-badge.learning { background: rgba(46,125,50,0.12); color: var(--status-resolved); }

/* ============================================================================
   LEARNING ENGINE CARDS
   ============================================================================ */

.learning-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.learning-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--ppl-blue);
}

.learning-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.learning-card-id {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.learning-card-pattern {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.learning-card-detail {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.learning-card-meta {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.learning-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================================
   PROGRESS BAR (for systems CPU/Memory)
   ============================================================================ */

.progress-bar {
    width: 60px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-bar-fill.good { background: var(--status-healthy); }
.progress-bar-fill.warn { background: var(--status-detecting); }
.progress-bar-fill.bad { background: var(--status-critical); }

/* ============================================================================
   VIEW PANELS
   ============================================================================ */

.view-panel {
    animation: slideIn 0.2s ease forwards;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes slideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.timeline-event {
    animation: slideIn 0.3s ease forwards;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 82, 155, 0.2); }
    50% { box-shadow: 0 0 20px rgba(0, 82, 155, 0.4); }
}

.scenario-card.active {
    animation: glow 2s infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
