/* Agonist Web UI — FortiGate-style admin panel */

:root {
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #0ea5e9;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 240px;

    --content-bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;

    --accent: #0ea5e9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--content-bg);
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.version {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.campaign-badge {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-size: 12px;
}

.campaign-name {
    display: block;
    margin-top: 4px;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links {
    list-style: none;
    padding: 8px 0;
    flex: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    transition: background .15s, color .15s;
}

.nav-links li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-links li a.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 500;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: 6px 0;
}

/* ── Nav icons ─────────────────────────────────────────────── */
.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: -2px;
    margin-right: 8px;
}

/* ── Nav groups (always open) ──────────────────────────────── */
.nav-group { position: relative; }

.nav-group-label {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    user-select: none;
    opacity: 0.6;
}

.nav-group-items {
    list-style: none;
    padding: 0;
    display: block;
}
.nav-group-items li a {
    padding-left: 28px;
    font-size: 12.5px;
}

.nav-bottom {
    padding-top: 0;
    border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.lang-btn {
    background: var(--sidebar-hover);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.lang-btn:hover { background: var(--sidebar-active); }

/* Content */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px 32px;
    min-width: 0;
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}

/* Card */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

/* Widget grid */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.widget-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.widget-phase .widget-value {
    font-size: 18px;
    text-transform: uppercase;
}

.widget-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Auto-layout tablolar icin (kolon genisligi iceriye gore) */
.data-table.table-auto {
    table-layout: auto;
}

/* Truncation utility — tek satir, tasarsa ... */
.cell-truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Wrap utility — icerik sarilar ama max-width ile sinirli */
.cell-wrap {
    max-width: 250px;
    word-break: break-word;
}

/* Port tag container — tasmayi onle */
.cell-ports {
    max-width: 200px;
    overflow: hidden;
    line-height: 1.6;
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8fafc;
    cursor: default;
}

.data-table th[data-sort] { cursor: pointer; }
.data-table th[data-sort]:hover { color: var(--accent); }

.data-table tbody tr:hover {
    background: #f1f5f9;
}

.data-table a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.data-table a:hover { text-decoration: underline; }

/* Column width hints — campaign table */
.col-id { width: 5%; }
.col-name { width: 23%; }
.col-subnet { width: 15%; }
.col-phase { width: 13%; }
.col-status { width: 10%; }
.col-actions { width: 34%; }
.col-ip { width: 130px; }
.col-vendor { width: 15%; }
.col-model { width: 15%; }
.col-ports-col { width: 18%; }
.col-risk { width: 10%; }
.col-cpu { width: 8%; }
.col-vulns { width: 8%; }
.col-desc { width: 30%; }

/* Badge — text-transform yok (Türkçe İ sorunu) */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-running { background: #dcfce7; color: #166534; }
.badge-completed { background: #dbeafe; color: #1e40af; }
.badge-aborted { background: #fee2e2; color: #991b1b; }
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-high { background: #ffedd5; color: #9a3412; }
.badge-medium { background: #fef9c3; color: #854d0e; }
.badge-low { background: #dcfce7; color: #166534; }

/* Semantic security badges — defense perspective */
.badge-vuln { background: #fee2e2; color: #991b1b; }    /* Red — vulnerable */
.badge-safe { background: #dcfce7; color: #166534; }     /* Green — defended */
.badge-neutral { background: #e2e8f0; color: #475569; }  /* Gray — inconclusive */

/* Port tag */
.port-tag {
    display: inline-block;
    padding: 1px 6px;
    background: #e2e8f0;
    border-radius: 3px;
    font-size: 11px;
    margin: 1px 2px;
    font-family: monospace;
}

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}

.detail-grid div {
    padding: 4px 0;
    font-size: 13px;
}

/* Forms */
.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 480px;
}

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

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    background: #fff;
    min-width: 200px;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14,165,233,.15);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0284c7; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Flash messages */
.flash-container {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    animation: flashIn .3s ease;
}

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

.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.flash-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    padding: 0 4px;
}

.flash-close:hover { opacity: 1; }

/* Progress */
.progress-area {
    margin-top: 16px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: var(--radius);
}

.progress-text {
    font-size: 13px;
    color: var(--text-muted);
}

/* Page subtitle */
.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Card header row — title + KC badge */
.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header-row h2 {
    margin-bottom: 0;
}

/* Kill Chain phase badges */
.kc-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.kc-weaponization { background: #ede9fe; color: #5b21b6; }
.kc-delivery { background: #fce7f3; color: #9d174d; }
.kc-exploitation { background: #ffedd5; color: #9a3412; }
.kc-installation { background: #fef9c3; color: #854d0e; }
.kc-c2 { background: #dbeafe; color: #1e40af; }
.kc-impact { background: #fee2e2; color: #991b1b; }

/* Smaller form input */
.form-input-sm {
    min-width: 100px;
}

/* Progress bar */
.progress-bar-container {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.progress-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.live-count {
    font-weight: 600;
    color: var(--accent);
}

.progress-section {
    padding: 12px 0;
}
.progress-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}
.progress-bar-error {
    background: var(--danger, #e74c3c) !important;
}

/* Multi-target group progress */
.group-progress-area {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.group-progress-item {
    display: grid;
    grid-template-columns: 200px 1fr 120px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.group-label {
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-stats {
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

.progress-bar-sm {
    height: 5px;
}

/* Textarea form input */
textarea.form-input,
.form-textarea {
    min-height: 60px;
    resize: vertical;
    font-family: monospace;
    font-size: 13px;
}

.form-help {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Live device table (scanning) */
.live-devices {
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.live-devices .data-table {
    font-size: 12px;
}

/* Result area (operations) */
.result-area {
    margin-top: 12px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: var(--radius);
    font-size: 13px;
    display: none;
}

.result-area.visible {
    display: block;
}

.result-area pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: monospace;
    font-size: 12px;
}

.result-area.result-success {
    background: #dcfce7;
    color: #166534;
}

.result-area.result-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Monitor live area */
.monitor-area {
    margin-top: 12px;
    padding: 12px;
    background: #0f172a;
    color: #22c55e;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.monitor-area.visible {
    display: block;
}

.monitor-line {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

/* Action bar (device detail) */
.action-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Bulk action bar */
.bulk-action-bar {
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}
.bulk-action-bar .btn {
    background: rgba(255,255,255,.2);
    border-color: rgba(255,255,255,.3);
    color: #fff;
}
.bulk-action-bar .btn:hover { background: rgba(255,255,255,.35); }
.bulk-action-bar .result-area { color: #fff; font-weight: 400; }

/* Select column */
.col-select { width: 32px; text-align: center; }
.col-select input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }

/* Action cell (device table) */
.action-cell {
    white-space: nowrap;
}

.action-cell .btn {
    margin: 2px;
}

.action-cell .result-area {
    white-space: normal;
    margin-top: 4px;
}

/* Campaign action cell — butonlar yan yana, gerekirse alt satira */
.action-cell-wrap {
    white-space: normal;
    min-width: 120px;
}

.action-cell-wrap form {
    display: inline-block;
    margin: 2px 2px;
}

/* Widget grid columns */
.widget-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}
.widget-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Distribution grid (severity + vendor side by side) */
.dist-grid {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Bar chart */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    width: 80px;
    min-width: 80px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Vendor chart etiketleri için geniş alan */
.bar-label-wide {
    width: 120px;
    min-width: 120px;
}

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

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .3s ease;
    min-width: 2px;
}

.bar-critical { background: var(--danger); }
.bar-high { background: #f97316; }
.bar-medium { background: var(--warning); }
.bar-low { background: var(--success); }
.bar-vendor { background: var(--accent); }

.bar-value {
    min-width: 36px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* Active task rows */
.active-task-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: rgba(14,165,233,0.04);
    border-left: 3px solid var(--accent, #0ea5e9);
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s;
}

.active-task-row:hover {
    background: rgba(14,165,233,0.08);
}

.task-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(14,165,233,0.2);
    border-top-color: var(--accent, #0ea5e9);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.task-info {
    flex: 1; min-width: 0;
}

.task-info-top {
    display: flex; align-items: baseline; gap: 8px;
}

.task-type {
    font-weight: 700; font-size: 0.95em;
}

.task-target {
    font-family: monospace; font-size: 0.85em; color: #94a3b8;
    background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 4px;
}

.task-info-detail {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: baseline;
}
.task-detail-msg {
    font-size: 0.8em; color: #94a3b8;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 280px;
}
.task-detail-stat {
    font-size: 0.8em; font-weight: 600; color: #0ea5e9;
    background: rgba(14,165,233,0.1); padding: 1px 6px; border-radius: 3px;
}
.task-detail-found {
    font-size: 0.8em; font-weight: 600; color: #22c55e;
    background: rgba(34,197,94,0.1); padding: 1px 6px; border-radius: 3px;
}
.task-detail-ip {
    font-size: 0.78em; font-family: monospace; color: #64748b;
    background: rgba(255,255,255,0.04); padding: 1px 6px; border-radius: 3px;
}

.task-progress-wrap {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

.task-progress-bar {
    width: 140px;
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    overflow: hidden;
}

.task-progress-bar .progress-bar {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    transition: width 0.4s ease;
}

.task-percent {
    font-weight: 700;
    color: var(--accent, #0ea5e9);
    min-width: 38px;
    font-size: 0.92em;
}

.task-elapsed {
    font-size: 0.82em; flex-shrink: 0; min-width: 52px; text-align: right;
    color: #64748b;
    background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: 4px;
}

/* Export bar */
.export-bar {
    display: flex;
    gap: 8px;
}

/* Filter bar */
.filter-bar .form-inline {
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
}
.filter-bar .form-group {
    margin-bottom: 0;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}

.page-link {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    background: var(--card-bg);
    transition: background .15s, color .15s;
}

.page-link:hover:not(.disabled):not(.active) {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.page-link.disabled {
    color: var(--text-light);
    cursor: default;
    background: var(--content-bg);
}

.page-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 13px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    margin: 0 6px;
    color: var(--text-light);
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
}

/* Sidebar user */
.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}

.sidebar-user-name {
    color: var(--sidebar-text-active);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background .15s, color .15s;
}

.logout-btn:hover {
    background: var(--danger);
    color: #fff;
}

/* Utility */
.text-muted { color: var(--text-muted); }

/* ── Hamburger menu button ───────────────────────────────── */
.hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--sidebar-bg);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 1.2em;
    cursor: pointer;
}

/* ── Sidebar overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 90;
}

/* ── Mobile Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .content {
        margin-left: 0;
        padding: 56px 12px 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .form-inline {
        flex-direction: column;
    }
    .form-group {
        width: 100%;
    }
    .form-input {
        width: 100%;
    }

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

    .task-progress-wrap { display: none; }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    .card-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .filter-bar .form-inline {
        flex-direction: column;
    }

    .export-bar {
        flex-wrap: wrap;
    }

    .action-bar {
        flex-direction: column;
        gap: 6px;
    }

    .card-row { flex-direction: column; }
}

/* ── Passive Monitoring — Layout ──────────────────────────── */
.card-row { display: flex; gap: 20px; flex-wrap: wrap; }
.card.half { flex: 1; min-width: 280px; }
.card.third { flex: 1; min-width: 200px; }

.stat-big {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.stat-item { text-align: center; }
.stat-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); display: block; }
.stat-value { font-size: 18px; font-weight: 600; display: block; }

.capture-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.capture-stats { display: flex; gap: 16px; font-size: 13px; }
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.status-running { background: #dcfce7; color: #166534; }
.live-packets { margin-top: 16px; max-height: 500px; overflow-y: auto; }
.tag { display: inline-block; padding: 1px 6px; background: #e2e8f0; border-radius: 3px; font-size: 11px; margin: 1px 2px; }

/* ── Utility classes ──────────────────────────────────────── */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

/* ── Severity badge extras ────────────────────────────────── */
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef9c3; color: #854d0e; }

/* ── Anomaly row highlight ────────────────────────────────── */
.row-anomaly { background: #fff7ed !important; }
.row-anomaly:hover { background: #ffedd5 !important; }

/* ── Proxy / table row states ────────────────────────────── */
.row-danger { background: #fee2e2 !important; }
.row-danger:hover { background: #fecaca !important; }
.row-warning { background: #fff3cd !important; }
.row-warning:hover { background: #fef08a !important; }
.row-success { background: #dcfce7 !important; }
.row-success:hover { background: #bbf7d0 !important; }

.progress-bar-wrapper {
    background: var(--border);
    border-radius: 4px;
    height: 24px;
    overflow: hidden;
}
.progress-bar-wrapper > div {
    height: 100%;
    background: var(--accent);
    transition: width .3s ease;
}

/* ── Intent badges ────────────────────────────────────────── */
.intent-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.intent-reconnaissance { background: #dbeafe; color: #1e40af; }
.intent-actuation { background: #ffedd5; color: #9a3412; }
.intent-disruption { background: #fee2e2; color: #991b1b; }
.intent-exfiltration { background: #ede9fe; color: #5b21b6; }
.intent-persistence { background: #fef9c3; color: #854d0e; }
.intent-lateral { background: #fce7f3; color: #9d174d; }

/* ── Expandable observation detail row ────────────────────── */
.obs-clickable { cursor: pointer; }
.obs-clickable:hover { background: #e2e8f0 !important; }

.detail-row { display: none; }
.detail-row.open { display: table-row; }
.detail-row td {
    padding: 12px 20px;
    background: #f1f5f9;
    border-bottom: 2px solid var(--border);
}

.detail-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 24px;
    font-size: 12px;
}

.detail-content .detail-item {
    display: flex;
    gap: 6px;
}

.detail-content .detail-key {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 10px;
    min-width: 80px;
    flex-shrink: 0;
}

.detail-content .detail-val {
    font-family: monospace;
    word-break: break-all;
}

/* ── Register Monitor ──────────────────────────────────────────────── */

.register-flash { animation: regFlash 0.6s ease; }
@keyframes regFlash { 0% { background: #fef08a; } 100% { background: transparent; } }
.register-active { font-weight: 600; color: var(--warning); }
.register-static { color: var(--text-muted); }
.monitor-status { display: inline-block; padding: 4px 12px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.monitor-running { background: #dcfce7; color: #166534; }

/* ── Operations page — card descriptions, warnings, results ──── */
.card-description { color: var(--text-muted); font-size: 0.9em; margin: 4px 0 12px; line-height: 1.5; }
.card-warning { background: rgba(255,152,0,0.1); border-left: 3px solid #ff9800; padding: 8px 12px; margin: 8px 0; font-size: 0.85em; color: #9a3412; }
.badge-beta { background: #ff9800; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.75em; font-weight: 600; vertical-align: middle; }

.result-card { padding: 12px; border-radius: var(--radius); background: var(--content-bg); }
.result-row { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.result-row:last-child { border-bottom: none; }
.result-row span:first-child { font-weight: 600; min-width: 100px; color: var(--text-muted); flex-shrink: 0; }
.result-actions { margin-top: 8px; }

.pkt-field { display: flex; gap: 8px; padding: 2px 4px; font-family: monospace; font-size: 0.85em; align-items: baseline; }
.pkt-field .pkt-label { color: var(--text-muted); min-width: 130px; flex-shrink: 0; font-weight: 600; }
.pkt-field .pkt-hex { word-break: break-all; }

.monitor-redirect-card { text-align: center; padding: 24px; }
.monitor-redirect-card p { margin-bottom: 16px; }

/* ── Communication Map ─────────────────────────────────────────────── */

.map-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.map-controls select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card-bg); }

.map-layout { display: flex; gap: 16px; }

.cy-container {
    flex: 1;
    min-height: 400px;
    height: calc(100vh - 310px);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
}

.map-sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.map-sidebar .card { margin-bottom: 0; }
.map-sidebar h3 { font-size: 13px; margin-bottom: 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.legend-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.legend-color { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; border: 2px solid transparent; }
.legend-icon { width: 22px; height: 20px; flex-shrink: 0; }
.legend-line { width: 24px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.legend-line-dashed { width: 24px; height: 0; border-top: 3px dashed var(--danger); flex-shrink: 0; }

.map-info-panel { display: none; }
.map-info-panel.active { display: block; }
.info-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-key { color: var(--text-muted); font-weight: 600; }
.info-val { text-align: right; word-break: break-all; max-width: 160px; }

.talker-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.talker-item:last-child { border-bottom: none; }
.talker-ip { font-family: monospace; font-size: 12px; }
.talker-count { font-weight: 600; color: var(--accent); }

.map-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.map-empty svg { width: 64px; height: 64px; margin-bottom: 12px; opacity: 0.4; }

@media (max-width: 768px) {
    .map-layout { flex-direction: column; }
    .map-sidebar { width: 100%; max-height: none; }
    .cy-container { min-height: 400px; }
}

/* ── Kill Chain Stepper ── */
.kc-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 0;
    overflow-x: auto;
}
.kc-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}
.kc-step-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85em;
    background: var(--card-bg, #1e293b);
    border: 2px solid #475569;
    color: #94a3b8;
    transition: all 0.3s;
}
.kc-step.completed .kc-step-dot {
    background: #22c55e; border-color: #22c55e; color: #fff;
}
.kc-step.active .kc-step-dot {
    background: #0ea5e9; border-color: #0ea5e9; color: #fff;
    animation: kc-pulse 2s infinite;
}
@keyframes kc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(14,165,233,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(14,165,233,0); }
}
.kc-step-label {
    font-size: 0.72em; margin-top: 6px; color: #94a3b8;
    text-align: center; white-space: nowrap;
}
.kc-step.completed .kc-step-label { color: #22c55e; }
.kc-step.active .kc-step-label { color: #0ea5e9; font-weight: 600; }
.kc-step-line {
    flex: 1; height: 2px; min-width: 20px;
    background: #475569; margin: 0 4px; margin-bottom: 20px;
}
.kc-step-line.completed { background: #22c55e; }
.widget-sub { font-size: 0.75em; margin-top: 4px; }

/* ── Attack Flow — Stepper count ── */
.kc-step-count {
    font-size: 0.65em; color: #64748b; text-align: center; margin-top: 2px;
}
.kc-step.completed .kc-step-count { color: #22c55e; }
.kc-step.active .kc-step-count { color: #0ea5e9; }

/* ── Attack Flow — Filter bar ── */
.af-filter-bar { display: flex; gap: 4px; flex-wrap: wrap; }
.af-filter-btn {
    padding: 4px 12px; font-size: 0.78em; border-radius: 999px; cursor: pointer;
    background: var(--card-bg, #1e293b); color: #94a3b8;
    border: 1px solid var(--border, #334155); transition: all 0.2s;
}
.af-filter-btn:hover { background: rgba(255,255,255,0.06); }
.af-filter-btn.active {
    background: #0ea5e9; color: #fff; border-color: #0ea5e9;
}

/* ── Attack Flow — Timeline ── */
.af-timeline-scroll { max-height: 400px; overflow-y: auto; }
.af-tl-entry {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.af-tl-entry:last-child { border-bottom: none; }
.af-tl-time {
    flex-shrink: 0; width: 140px; font-size: 0.78em; color: #64748b;
    font-family: monospace;
}
.af-tl-dot {
    flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%;
    margin-top: 5px; background: #475569;
}
.af-tl-dot-completed { background: #22c55e; }
.af-tl-dot-active { background: #0ea5e9; }
.af-tl-dot-pending { background: #475569; }
.af-tl-body { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.af-tl-badge {
    display: inline-block; padding: 1px 8px; border-radius: 4px;
    font-size: 0.72em; font-weight: 600; white-space: nowrap;
}
.af-tl-action { font-size: 0.88em; }
.af-tl-target {
    font-size: 0.8em; color: #94a3b8; font-family: monospace;
    background: rgba(255,255,255,0.04); padding: 1px 6px; border-radius: 3px;
}
.af-tl-details {
    font-size: 0.75em; width: 100%; margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Phase badge renkleri */
.af-tl-phase-recon { background: #1e3a5f; color: #93c5fd; }
.af-tl-phase-weaponization { background: #422006; color: #fde68a; }
.af-tl-phase-delivery { background: #431407; color: #fed7aa; }
.af-tl-phase-exploitation { background: #450a0a; color: #fca5a5; }
.af-tl-phase-installation { background: #3b0764; color: #d8b4fe; }
.af-tl-phase-c2 { background: #1e1b4b; color: #a5b4fc; }
.af-tl-phase-impact { background: #500724; color: #f9a8d4; }

/* Filter butonlari icin ayni renkler */
.af-filter-btn.af-tl-phase-recon.active { background: #1e40af; border-color: #1e40af; color: #fff; }
.af-filter-btn.af-tl-phase-weaponization.active { background: #854d0e; border-color: #854d0e; color: #fff; }
.af-filter-btn.af-tl-phase-delivery.active { background: #9a3412; border-color: #9a3412; color: #fff; }
.af-filter-btn.af-tl-phase-exploitation.active { background: #991b1b; border-color: #991b1b; color: #fff; }
.af-filter-btn.af-tl-phase-installation.active { background: #6b21a8; border-color: #6b21a8; color: #fff; }
.af-filter-btn.af-tl-phase-c2.active { background: #3730a3; border-color: #3730a3; color: #fff; }
.af-filter-btn.af-tl-phase-impact.active { background: #9d174d; border-color: #9d174d; color: #fff; }

/* ── Attack Flow — Matrix ── */
.af-matrix { border-collapse: collapse; }
.af-matrix-header { text-align: center; font-size: 0.78em; padding: 6px 8px; }
.af-matrix-device { white-space: nowrap; }
.af-matrix-cell {
    text-align: center; padding: 8px 6px; min-width: 60px;
    transition: background 0.2s; vertical-align: middle;
}
.af-matrix-cell:hover { background: rgba(255,255,255,0.04); }
.af-matrix-done { background: rgba(34,197,94,0.08); }
.af-matrix-active { background: rgba(14,165,233,0.08); }
.af-matrix-selected { outline: 2px solid #facc15; outline-offset: -2px; }
.af-matrix-count { font-weight: 700; font-size: 1.1em; }
.af-matrix-done .af-matrix-count { color: #22c55e; }
.af-matrix-active .af-matrix-count { color: #0ea5e9; }
.af-matrix-icon { font-size: 0.7em; color: #64748b; margin-top: 2px; }
.af-matrix-done .af-matrix-icon { color: #22c55e; }
.af-matrix-active .af-matrix-icon { color: #0ea5e9; }
.af-matrix-empty { color: #334155; }

@media (max-width: 768px) {
    .af-tl-time { width: 100px; font-size: 0.7em; }
    .af-filter-bar { gap: 2px; }
    .af-filter-btn { padding: 3px 8px; font-size: 0.7em; }
    .kc-stepper { justify-content: flex-start; overflow-x: auto; }
    .af-matrix-cell { min-width: 45px; padding: 6px 3px; }
}
