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

:root {
    --bg-base: #080b11;
    --bg-surface: #101524;
    --bg-surface-glass: rgba(16, 21, 36, 0.75);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-glow: rgba(99, 102, 241, 0.15);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --primary-hover: #4f46e5;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --neon-red: #ff4d4d;
    --neon-red-glow: rgba(255, 77, 77, 0.4);
    --neon-orange: #ffa502;
    --neon-orange-glow: rgba(255, 165, 2, 0.4);
    --neon-yellow: #eccc68;
    --neon-yellow-glow: rgba(236, 204, 104, 0.4);
    --neon-cyan: #2ed573;
    --neon-cyan-glow: rgba(46, 213, 115, 0.4);
    --neon-blue: #00d2d3;
    --neon-blue-glow: rgba(0, 210, 211, 0.4);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --sidebar-width: 500px;
}

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

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 10%, rgba(0, 210, 211, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 90%, rgba(255, 77, 77, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
}

/* Base Layout Container */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header Section */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition-normal);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-container {
    background: linear-gradient(135deg, var(--primary), var(--neon-blue));
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--primary-glow);
    color: #fff;
}

.brand-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-primary), #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.controls-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* System Status Indicator */
.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan-glow);
    animation: status-pulse 2s infinite;
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* File Upload Button styling */
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.btn-upload {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(0, 210, 211, 0.15) 100%);
    border: 1px solid var(--primary);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.btn-upload:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--neon-blue) 100%);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-1px);
}

.file-upload-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* KPI Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: var(--transition-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--border-glass-glow);
}

.stat-card.critical::before { background: var(--neon-red); }
.stat-card.active::before { background: var(--neon-orange); }
.stat-card.mitigated::before { background: var(--neon-cyan); }
.stat-card.score::before { background: var(--primary); }

.stat-card.critical:hover { box-shadow: 0 8px 30px rgba(255, 77, 77, 0.1); }
.stat-card.active:hover { box-shadow: 0 8px 30px rgba(255, 165, 2, 0.1); }
.stat-card.mitigated:hover { box-shadow: 0 8px 30px rgba(46, 213, 115, 0.1); }
.stat-card.score:hover { box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15); }

.stat-info h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    transition: var(--transition-normal);
}

.stat-card:hover .stat-icon-wrapper {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.stat-card.critical .stat-icon-wrapper { color: var(--neon-red); background: rgba(255, 77, 77, 0.05); }
.stat-card.active .stat-icon-wrapper { color: var(--neon-orange); background: rgba(255, 165, 2, 0.05); }
.stat-card.mitigated .stat-icon-wrapper { color: var(--neon-cyan); background: rgba(46, 213, 115, 0.05); }
.stat-card.score .stat-icon-wrapper { color: var(--primary); background: rgba(99, 102, 241, 0.05); }

/* Dashboard Main Grid Area */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
    align-items: start;
}

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

/* Card Panels */
.panel {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-body {
    padding: 24px;
}

/* Filter Bar styles */
.filter-bar {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .filter-bar {
        grid-template-columns: 1fr;
    }
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    background: rgba(255, 255, 255, 0.06);
}

.select-filter {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.select-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.select-filter option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

/* Interactive Logs Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.1);
    max-height: 550px;
    position: relative;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background: rgba(16, 21, 36, 0.9);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

tbody tr {
    cursor: pointer;
    transition: var(--transition-fast);
}

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

tbody tr.selected {
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary);
}

/* Badges for Threat Severities and Statuses */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-critical {
    background: rgba(255, 77, 77, 0.1);
    color: var(--neon-red);
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.badge-high {
    background: rgba(255, 165, 2, 0.1);
    color: var(--neon-orange);
    border: 1px solid rgba(255, 165, 2, 0.2);
}

.badge-medium {
    background: rgba(236, 204, 104, 0.15);
    color: var(--neon-yellow);
    border: 1px solid rgba(236, 204, 104, 0.25);
}

.badge-low {
    background: rgba(0, 210, 211, 0.15);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 210, 211, 0.2);
}

/* Status Indicators */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-indicator.active {
    background-color: var(--neon-red);
    box-shadow: 0 0 6px var(--neon-red-glow);
    animation: status-pulse 1.5s infinite;
}

.status-indicator.investigating {
    background-color: var(--neon-orange);
    box-shadow: 0 0 6px var(--neon-orange-glow);
    animation: status-pulse 2s infinite;
}

.status-indicator.mitigated {
    background-color: var(--neon-cyan);
    box-shadow: 0 0 6px var(--neon-cyan-glow);
}

/* Right-hand side Charts Panel container */
.charts-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chart-wrapper {
    position: relative;
    height: 220px;
    width: 100%;
}

/* Slide-out AI Countermeasure Drawer */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    max-width: 100vw;
    height: 100vh;
    background: rgba(13, 18, 32, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-glass);
    z-index: 101;
    transform: translateX(100%);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(16, 21, 36, 0.5);
}

.drawer-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.drawer-title i {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: var(--transition-fast);
}

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

.drawer-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Detail Blocks inside Drawer */
.detail-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

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

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

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

.detail-value {
    font-size: 0.95rem;
    font-weight: 500;
}

/* AI Suggestion Console Box */
.ai-console {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(0, 210, 211, 0.05) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.05);
}

.ai-console-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-pulse-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    animation: pulse-border 2s infinite;
}

.ai-console-title {
    font-weight: 600;
    font-size: 1rem;
    color: #a5b4fc;
}

.ai-recommendation-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Codeblock box inside Drawer */
.codeblock-wrapper {
    background: #060913;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
}

.codeblock-header {
    background: rgba(16, 21, 36, 0.8);
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.codeblock-lang {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.btn-copy {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

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

pre {
    padding: 14px;
    overflow-x: auto;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Dynamic Countermeasure Steps list */
.countermeasure-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.countermeasure-step {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.step-num {
    background: var(--primary-glow);
    color: #a5b4fc;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content h5 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.step-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Empty log state styling */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--border-glass);
}

/* Animations declarations */
@keyframes status-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* Responsive Overrides */
@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    .app-container {
        padding: 0;
        gap: 16px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
    }
    
    .controls-section {
        width: 100%;
        justify-content: space-between;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}
