/* ============================================================
   FXDC Troubleshoot Agent — Dashboard Stylesheet
   Modern dark theme met accent kleuren
   ============================================================ */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --border: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --critical-bg: rgba(220, 38, 38, 0.1);
    --high-bg: rgba(234, 88, 12, 0.1);
    --medium-bg: rgba(202, 138, 4, 0.1);
    --low-bg: rgba(37, 99, 235, 0.1);
    --sidebar-width: 240px;
    --radius: 10px;
    --radius-sm: 6px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui,
                 'Inter', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

code, pre {
    font-family: 'SF Mono', 'JetBrains Mono', Monaco, Consolas, monospace;
    font-size: 12px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: white;
}

.logo-title {
    font-weight: 700;
    font-size: 15px;
}

.logo-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.nav-links {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.nav-link i {
    width: 18px;
    height: 18px;
}

.badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 13px;
}

.user-info i {
    width: 16px;
    height: 16px;
}

.nav-link.logout {
    color: var(--text-muted);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
main {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

main.with-sidebar {
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.breadcrumbs {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.breadcrumbs a {
    color: var(--text-secondary);
}

.incident-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    width: 24px;
    height: 24px;
}

.stat-icon.critical {
    background: var(--critical-bg);
    color: var(--danger);
}

.stat-icon.warning {
    background: var(--medium-bg);
    color: var(--warning);
}

.stat-icon.success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.stat-icon.info {
    background: var(--low-bg);
    color: var(--accent);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 i {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.card-body {
    padding: 20px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.table.table-compact th,
.table.table-compact td {
    padding: 6px 10px;
    font-size: 12px;
}

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

tr.clickable {
    cursor: pointer;
}

tr.clickable:hover {
    background: rgba(255, 255, 255, 0.03);
}

.nowrap {
    white-space: nowrap;
}

/* ============================================================
   BADGES
   ============================================================ */
.priority-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.priority-kritiek { background: var(--critical-bg); color: #f87171; }
.priority-hoog    { background: var(--high-bg);     color: #fb923c; }
.priority-middel  { background: var(--medium-bg);   color: #fbbf24; }
.priority-laag    { background: var(--low-bg);       color: #60a5fa; }

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-secondary);
}

.status-badge.large {
    padding: 4px 14px;
    font-size: 13px;
}

.status-awaiting_staging_approval,
.status-awaiting_production_approval {
    background: rgba(217, 119, 6, 0.15);
    color: #fbbf24;
}

.status-resolved {
    background: rgba(5, 150, 105, 0.15);
    color: #34d399;
}

.status-rejected,
.status-failed,
.status-rolled_back {
    background: var(--critical-bg);
    color: #f87171;
}

.status-staging_deploying,
.status-production_deploying {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* ============================================================
   METRICS
   ============================================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
}

.metric-value.ok { color: var(--success); }
.metric-value.warning { color: var(--warning); }
.metric-value.danger { color: var(--danger); }

/* ============================================================
   META GRID
   ============================================================ */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.meta-value {
    font-size: 14px;
}

/* ============================================================
   ACTION BAR
   ============================================================ */
.action-bar {
    background: var(--bg-card);
    border: 2px solid var(--warning);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.action-bar h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #fbbf24;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

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

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

.btn-success:hover {
    background: #047857;
}

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

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ============================================================
   FILTERS
   ============================================================ */
.filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-btn {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-decoration: none;
}

.filter-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.filter-separator {
    color: var(--border);
    font-size: 12px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   CHANGES / DIFF
   ============================================================ */
.change-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    overflow: hidden;
}

.change-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
}

.change-action {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.action-replace { background: var(--medium-bg); color: #fbbf24; }
.action-create  { background: rgba(5,150,105,0.15); color: #34d399; }
.action-delete  { background: var(--critical-bg); color: #f87171; }

.change-desc {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.diff-block {
    padding: 12px 14px;
}

.diff-label {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.diff-old .diff-label { color: #f87171; }
.diff-new .diff-label { color: #34d399; }

.diff-block pre {
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 12px;
    line-height: 1.5;
}

.diff-old pre { border-left: 3px solid #f87171; }
.diff-new pre { border-left: 3px solid #34d399; }

/* ============================================================
   HIGHLIGHT BOX
   ============================================================ */
.highlight-box {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    background: rgba(59, 130, 246, 0.08);
    border-left: 4px solid var(--accent);
}

.highlight-box.warning {
    background: rgba(217, 119, 6, 0.08);
    border-left-color: var(--warning);
}

.highlight-box strong {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.highlight-box p {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================================
   RAW REPORT
   ============================================================ */
.raw-report pre {
    background: var(--bg-input);
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
}

/* ============================================================
   AUDIT TIMELINE
   ============================================================ */
.audit-timeline {
    position: relative;
    padding-left: 24px;
}

.audit-entry {
    position: relative;
    padding-bottom: 16px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

.audit-entry:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.audit-dot {
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: 50%;
}

.audit-actor {
    font-weight: 600;
    font-size: 13px;
}

.audit-action {
    color: var(--text-secondary);
    font-size: 13px;
    margin-left: 6px;
}

.audit-details {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.audit-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================================
   DOCKER STATUS
   ============================================================ */
.docker-status {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    font-size: 12px;
    line-height: 1.5;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    min-width: 400px;
    max-width: 500px;
}

.modal-content h3 {
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    color: white;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 13px;
}

.login-form {
    margin-top: 24px;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--critical-bg);
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-top: 12px;
    font-size: 14px;
}

/* ============================================================
   STATUS DOT
   ============================================================ */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.green { background: var(--success); }
.status-dot.red   { background: var(--danger); }

/* ============================================================
   EVENT TYPE
   ============================================================ */
.event-type {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* ============================================================
   MISC
   ============================================================ */
.muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    main.with-sidebar {
        margin-left: 0;
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .incident-header {
        flex-direction: column;
    }
}
