@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Core Palette - Deep Space / Cyberpunk Lite */
    --bg-app: #050507;
    --bg-panel: #0e0e11;
    --bg-card: #131316;
    --bg-hover: #1c1c21;
    --bg-link: #1c1c21;
    --bg-secondary: #17171b;

    --border-subtle: #27272a;
    --border-light: #3f3f46;

    /* Accents */
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --primary-dim: rgba(99, 102, 241, 0.1);

    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-green-rgb: 16, 185, 129;
    --accent-red-rgb: 239, 68, 68;
    --green: #10b981;
    --orange: #f97316;

    /* Text */
    --text-main: #fafafa;
    --text-muted: #a1a1aa;
    --text-faint: #52525b;
    --text-danger: #ef4444;

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-squish: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.25;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    height: 100vh;
    overflow: hidden;
    overflow-x: hidden;
    line-height: 1.5;
}

/* --- Layout Grid --- */
.app-container {
    display: grid;
    grid-template-columns: 80px 1fr;
    /* Slim sidebar + Main */
    height: 100vh;
}

/* --- Sidebar (Icon Only Mode) --- */
.sidebar {
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    z-index: 50;
    transition: width 0.3s ease;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    box-shadow: 0 0 20px var(--primary-glow);
}

.brand-logo svg {
    color: white;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    align-items: center;
}

.nav-item {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: var(--text-muted);
    transition: all 0.2s var(--ease-smooth);
    position: relative;
    text-decoration: none;
}

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

.nav-item.active {
    background: var(--primary-dim);
    color: var(--primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.nav-tooltip {
    position: absolute;
    left: 60px;
    background: var(--bg-hover);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
    transition: all 0.2s;
    white-space: nowrap;
    border: 1px solid var(--border-subtle);
}

.nav-item:hover .nav-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* --- Main Content --- */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Scroll handled internally */
    position: relative;
}

/* Top Header */
.top-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(5, 5, 7, 0.8);
    backdrop-filter: blur(12px);
    z-index: 40;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, #a1a1aa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.stat-pill {
    background: var(--bg-link);
    border: 1px solid var(--border-subtle);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-pill svg {
    width: 14px;
    height: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Action Buttons */
.btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    transition: all 0.2s var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: #5558e6;
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

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

.btn-secondary:hover {
    background: var(--bg-hover);
}

/* --- Dashboard Grid --- */
.dashboard-view {
    padding: 40px;
    overflow-y: auto;
    height: calc(100vh - 80px);
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card.highlighted {
    background: linear-gradient(180deg, var(--bg-card) 0%, #151520 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Chart Section */
.chart-card {
    grid-column: span 3;
    height: 380px;
}

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

.chart-title {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 500;
}

.chart-value {
    font-size: 32px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(45deg, var(--primary), var(--accent-pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chart-canvas-wrapper {
    flex-grow: 1;
    position: relative;
    width: 100%;
}

/* Side Metrics */
.metrics-stack {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 380px;
}

.metric-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s;
}

.metric-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-value {
    font-size: 28px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* Bottom Stats Row */
.stats-row {
    grid-column: span 4;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease-out;
}

.modal-content {
    background: #0e0e11;
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content.lg {
    max-width: 900px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

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

.modal-content.lg .modal-header {
    padding: 24px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-dim);
}

/* Victim Split View */
.split-layout {
    display: flex;
    height: 100%;
}

.sidebar-list {
    width: 320px;
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
}

.list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.victim-scroller {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.victim-item {
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.victim-item:hover {
    background: var(--bg-hover);
}

.victim-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.victim-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.victim-name {
    font-weight: 600;
    font-size: 14px;
}

.victim-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.details-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
}

.details-header {
    padding: 24px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
}

.message-feed {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* In-app notifications and confirmations */
.ux-toast-host {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.ux-toast {
    min-width: 240px;
    max-width: 360px;
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-panel);
    color: var(--text-main);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ux-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.ux-toast-success {
    border-color: rgba(var(--accent-green-rgb), 0.5);
}

.ux-toast-error {
    border-color: rgba(var(--accent-red-rgb), 0.5);
}

.ux-toast-info {
    border-color: rgba(99, 102, 241, 0.5);
}

.ux-confirm-overlay {
    z-index: 1300;
}

.ux-confirm-text {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.ux-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}



/* Animations */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Helpers */
.text-success {
    color: var(--accent-green);
}

.text-danger {
    color: var(--accent-red);
}

.text-cyan {
    color: var(--accent-cyan);
}

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

.glow-success {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* Responsive layout tuning */
@media (max-width: 1280px) {
    .top-header {
        padding: 0 20px;
    }

    .header-stats {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .dashboard-view {
        padding: 24px;
    }

    .grid-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .chart-card {
        grid-column: span 2;
        height: 320px;
    }

    .metrics-stack {
        grid-column: span 2;
        height: auto;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 980px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: 12px 16px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: sticky;
        top: 0;
        background: rgba(14, 14, 17, 0.95);
        backdrop-filter: blur(10px);
    }

    .brand-logo {
        margin-bottom: 0;
        width: 38px;
        height: 38px;
    }

    .nav-links {
        flex-direction: row;
        width: auto;
        gap: 8px;
    }

    .nav-item {
        width: 42px;
        height: 42px;
    }

    .nav-item.active::before,
    .nav-tooltip {
        display: none;
    }

    .main-content {
        overflow: visible;
    }

    .top-header {
        min-height: 72px;
        height: auto;
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
        align-items: flex-start;
    }

    .page-title h1 {
        font-size: 20px;
    }

    .header-stats {
        width: 100%;
        justify-content: flex-start;
    }

    .stat-pill {
        padding: 6px 12px;
        font-size: 12px;
    }

    .btn {
        padding: 9px 14px;
        font-size: 13px;
    }

    .dashboard-view {
        height: auto;
        overflow: visible;
        padding: 16px;
    }

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

    .chart-card,
    .metrics-stack {
        grid-column: span 1;
    }

    .chart-card {
        height: 280px;
    }

    .metrics-stack {
        grid-template-columns: 1fr;
        display: grid;
        gap: 12px;
    }

    .metric-card {
        min-height: 92px;
    }

    .modal-content {
        width: calc(100% - 24px);
        max-width: 100%;
        padding: 20px;
        border-radius: 16px;
    }

    .modal-content.lg {
        height: 92vh;
    }

    .split-layout {
        flex-direction: column;
    }

    .sidebar-list {
        width: 100%;
        max-height: 38vh;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .details-panel {
        min-height: 0;
    }

    .message-feed,
    .details-header {
        padding: 14px;
    }
}

@media (max-width: 600px) {
    .top-header {
        padding: 10px 12px;
    }

    .dashboard-view {
        padding: 12px;
    }

    .card,
    .metric-card {
        padding: 14px;
        border-radius: 16px;
    }

    .chart-value {
        font-size: 24px;
    }

    .modal-content {
        width: calc(100% - 16px);
        padding: 16px;
    }

    .ux-toast-host {
        top: 12px;
        right: 10px;
        left: 10px;
    }

    .ux-toast {
        min-width: 0;
        max-width: 100%;
    }
}