/* PulseCheck Range - Main Stylesheet */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
}

/* Header */
.main-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
    height: 60px;
    display: flex;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo img {
    height: 40px;
}

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.nav-item.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
}

.status-badge {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--success-color);
    color: var(--success-color);
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 60px);
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Buttons */
.btn {
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 0.5rem;
}

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

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

.btn-success { background-color: var(--success-color); color: white; }
.btn-warning { background-color: var(--warning-color); color: white; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-secondary { background-color: var(--secondary-color); color: white; }

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--bg-tertiary);
}

/* Agent Status */
.agent-status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.agent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--danger-color);
}

.agent-item.online {
    border-left-color: var(--success-color);
}

.agent-name {
    font-size: 0.875rem;
}

.agent-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Content Area */
.content-area {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Narrative Spine */
.narrative-spine {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.spine-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spine-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.375rem 0.75rem;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
}

.tab-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.narrative-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.narrative-item {
    padding: 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary-color);
}

.narrative-item.fact { border-left-color: var(--success-color); }
.narrative-item.decision { border-left-color: var(--warning-color); }
.narrative-item.unknown { border-left-color: var(--danger-color); }

.narrative-input {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.narrative-input .form-control {
    margin-bottom: 0;
}

.narrative-input select {
    width: 120px;
    flex-shrink: 0;
}

.narrative-input input {
    flex: 1;
}

.narrative-input .btn {
    width: auto;
    margin-bottom: 0;
}

/* Info Panel */
.info-panel {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
}

.timeline-event {
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Debug Overlay */
.debug-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 500px;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.debug-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.debug-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.debug-section {
    margin-bottom: 1rem;
}

.debug-section h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.debug-section pre {
    background-color: var(--bg-color);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    overflow-x: auto;
}

/* MITRE Mini Matrix */
.mitre-mini {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mitre-cell {
    background-color: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: 2px;
    font-size: 0.625rem;
    text-align: center;
}

.mitre-cell.active {
    background-color: var(--danger-color);
}

/* Responsive */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 240px 1fr 280px;
    }
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar, .info-panel {
        display: none;
    }
}
