/**
 * VigilSentinel.Vigil - Enterprise Security Monitoring Platform
 * Copyright (c) 2026 Vigil Cyber. All Rights Reserved.
 * PROPRIETARY AND CONFIDENTIAL - See LICENSE file for details.
 */
/* VigilSentinel.Vigil - Centralized Security Intelligence - Theme System */

/* ========== DARK THEME (Default) ========== */
:root, [data-theme="dark"] {
    /* Dark Theme Colors */
    --bg-primary: #071923;
    --bg-secondary: #0d2735;
    --bg-card: #12384a;
    --bg-card-hover: #16465d;
    --bg-sidebar: #082433;
    
    /* Accent Colors */
    --accent-cyan: #00bceb;
    --accent-cyan-dim: rgba(0, 188, 235, 0.12);
    --accent-purple: #7b61ff;
    --accent-green: #2bb673;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-blue: #0077b6;
    
    /* Text Colors */
    --text-primary: #f4fbff;
    --text-secondary: #b7ccd8;
    --text-muted: #7fa2b3;
    
    /* Borders */
    --border-color: rgba(215, 239, 248, 0.12);
    --border-glow: rgba(0, 188, 235, 0.32);
    
    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 188, 235, 0.24);
    
    /* Spacing */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Theme-specific */
    --logo-filter: drop-shadow(0 0 10px rgba(0, 188, 235, 0.5));
    --chart-grid: rgba(215, 239, 248, 0.06);
    --input-bg: var(--bg-secondary);
    --scrollbar-thumb: var(--accent-cyan-dim);
    --scrollbar-thumb-hover: var(--accent-cyan);
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
    /* Light Theme Colors */
    --bg-primary: #f4f9fc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #eaf4f9;
    --bg-sidebar: #eaf4f9;
    
    /* Accent Colors - Slightly adjusted for light mode */
    --accent-cyan: #0077b6;
    --accent-cyan-dim: rgba(0, 119, 182, 0.1);
    --accent-purple: #7c3aed;
    --accent-green: #1f9d63;
    --accent-red: #dc2626;
    --accent-orange: #d97706;
    --accent-blue: #005ea8;
    
    /* Text Colors */
    --text-primary: #102a3a;
    --text-secondary: #365568;
    --text-muted: #7894a3;
    
    /* Borders */
    --border-color: #d8e8ef;
    --border-glow: rgba(0, 119, 182, 0.28);
    
    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(0, 119, 182, 0.16);
    
    /* Theme-specific */
    --logo-filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    --chart-grid: rgba(0, 0, 0, 0.05);
    --input-bg: #f4f9fc;
    --scrollbar-thumb: #bfd7e3;
    --scrollbar-thumb-hover: #7fa2b3;
}

/* Light theme overrides for specific elements */
[data-theme="light"] .VigilSentinel-header {
    background: linear-gradient(180deg, #ffffff 0%, #f4f9fc 100%);
    border-bottom: 1px solid #d8e8ef;
}

[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #eaf4f9 0%, #d8e8ef 100%);
    border-right: 1px solid #d8e8ef;
}

[data-theme="light"] .card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .btn-secondary {
    background: #eef7fb;
    color: #365568;
    border: 1px solid #d8e8ef;
}

[data-theme="light"] .btn-secondary:hover {
    background: #d8e8ef;
    color: #102a3a;
}

[data-theme="light"] .form-control {
    background: #ffffff;
    border: 1px solid #d8e8ef;
    color: #102a3a;
}

[data-theme="light"] .form-control:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

[data-theme="light"] .table th {
    background: #f4f9fc;
    color: #365568;
}

[data-theme="light"] .table tbody tr:hover {
    background: #eaf4f9;
}

[data-theme="light"] .stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f4f9fc 100%);
    border: 1px solid #d8e8ef;
}

[data-theme="light"] .badge {
    background: #d8e8ef;
    color: #365568;
}

[data-theme="light"] .badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

[data-theme="light"] .badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

[data-theme="light"] .badge-warning {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
}

[data-theme="light"] .badge-info {
    background: rgba(0, 119, 182, 0.1);
    color: #0077b6;
}

[data-theme="light"] .alert {
    border: 1px solid #d8e8ef;
}

[data-theme="light"] .company-name {
    color: #102a3a;
}

[data-theme="light"] .nav-links a {
    color: #365568;
}

[data-theme="light"] .nav-links a:hover,
[data-theme="light"] .nav-links a.active {
    color: #0077b6;
}

[data-theme="light"] .sidebar-menu a {
    color: #365568;
}

[data-theme="light"] .sidebar-menu a:hover,
[data-theme="light"] .sidebar-menu a.active {
    background: rgba(0, 119, 182, 0.1);
    color: #0077b6;
}

[data-theme="light"] .loading::after {
    border-top-color: #0077b6;
}

[data-theme="light"] code, 
[data-theme="light"] pre {
    background: #eef7fb;
    color: #102a3a;
}

/* Theme toggle button styles */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    transform: scale(1.05);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* Smooth theme transition */
body, .VigilSentinel-header, .sidebar, .card, .btn, .form-control, .table, .stat-card {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: visible;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-cyan-dim);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* ========== HEADER ========== */
.app-header, .VigilSentinel-header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
}

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

.logo {
    height: 40px;
    width: auto;
    filter: var(--logo-filter);
    transition: all 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
}

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

.brand-name, .company-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* Professional logo style for VigilSentinel wordmark */
.VigilSentinel-logo {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.2em !important;
    text-transform: uppercase;
    text-decoration: none;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Inter', sans-serif;
    transition: transform 0.3s ease, filter 0.3s ease;
}
.VigilSentinel-logo:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

.brand-badge {
    font-size: 0.65rem;
    background: var(--accent-cyan);
    color: var(--bg-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-nav {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    position: relative;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--accent-cyan-dim);
}

.nav-links a.active {
    color: var(--accent-cyan);
    background: var(--accent-cyan-dim);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    background: var(--accent-cyan);
    border-radius: 2px;
}

.header-right, .header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.header-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

.header-btn svg {
    width: 18px;
    height: 18px;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--accent-red);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-badge.hidden {
    display: none;
}

/* ========== IN-APP TOAST NOTIFICATIONS ========== */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    min-width: 280px;
    max-width: 400px;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid;
    animation: notifSlideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.notification-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--accent-blue, #3b82f6);
}

.notification-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--accent-orange);
}

.notification-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-green);
}

.notification-error, .notification-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.notification .notification-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.notification .notification-content p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.85;
}

.notification .notification-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    flex-shrink: 0;
}

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

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== NOTIFICATION DROPDOWN PANEL ========== */
.notification-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 450px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notification-panel.open {
    display: flex;
}

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

.notification-panel-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-panel-header button {
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.notification-panel-header button:hover {
    background: rgba(0, 212, 255, 0.1);
}

.notification-panel-body {
    overflow-y: auto;
    flex: 1;
    max-height: 380px;
}

.notification-panel-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-panel-item:hover {
    background: var(--bg-secondary);
}

.notification-panel-item.unread {
    background: rgba(0, 212, 255, 0.05);
}

.notification-panel-item .notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.notification-panel-item .notif-icon.info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.notification-panel-item .notif-icon.warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.notification-panel-item .notif-icon.success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.notification-panel-item .notif-icon.danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.notification-panel-item .notif-content {
    flex: 1;
    min-width: 0;
}

.notification-panel-item .notif-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-panel-item .notif-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-panel-item .notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

.notification-panel-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.connection-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

.connection-status.disconnected .status-dot {
    background: var(--accent-red);
    box-shadow: 0 0 6px var(--accent-red);
    animation: none;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== MAIN LAYOUT ========== */
.main-container {
    display: flex;
    min-height: 100vh;
    padding-top: 65px;
    position: relative;
    overflow-x: visible;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: calc(100vh - 65px);
    overflow-y: auto;
    overflow-x: visible;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sidebar section - allows overflow for side panel */
.sidebar-section {
    margin-bottom: 1rem;
    position: relative;
    overflow: visible;
    padding: 0 0.75rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section.sidebar-status {
    margin-top: auto;
    padding: 1rem;
}

.sidebar-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Category header styles - Professional, refined design */
.sidebar-title.category-header {
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0.2px;
    color: var(--text-muted) !important;
    padding: 0.5rem 0.75rem !important;
    margin-bottom: 0.375rem !important;
    cursor: default;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin-left: 0;
    margin-right: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    user-select: none;
}

.sidebar-title.category-header:hover {
    background: transparent;
    color: var(--text-secondary) !important;
}

.sidebar-title.category-header .category-name {
    font-weight: 500;
    font-size: 0.8125rem;
    color: inherit;
    letter-spacing: 0.3px;
}

/* Submenu - Hidden by default, shown below category on hover */
.sidebar-section .submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.25s ease;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Show submenu on category hover */
.sidebar-section:hover .submenu,
.sidebar-section:focus-within .submenu {
    max-height: 500px;
    opacity: 1;
    margin-top: 0.125rem;
    margin-bottom: 0;
}

/* Always show submenu if it contains an active item */
.sidebar-section:has(.submenu .active) .submenu {
    max-height: 500px;
    opacity: 1;
    margin-top: 0.125rem;
    margin-bottom: 0;
}

/* Visual indicator for categories with active items */
.sidebar-section:has(.submenu .active) {
    background: transparent;
    border-radius: 0;
    margin: 0;
    padding: 0 0.75rem;
}

.sidebar-section:has(.submenu .active) .category-header {
    color: var(--accent-cyan) !important;
    font-weight: 600 !important;
}

.sidebar-section:has(.submenu .active) .category-header::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 70%;
    background: linear-gradient(180deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    border-radius: 0 2px 2px 0;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 6px rgba(0, 212, 255, 0.3);
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu li {
    margin: 0.125rem 0;
    padding: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    position: relative;
    font-weight: 400;
    margin: 0 0.25rem;
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.75;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.sidebar-menu a:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    transform: translateX(2px);
}

.sidebar-menu a:hover i {
    opacity: 1;
}

.sidebar-menu a.active {
    background: linear-gradient(90deg, var(--accent-cyan-dim) 0%, transparent 100%);
    color: var(--accent-cyan);
    font-weight: 500;
}

.sidebar-menu a.active i {
    opacity: 1;
    color: var(--accent-cyan);
}

.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: linear-gradient(180deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.sidebar-menu .icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.sidebar-menu .badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    line-height: 1.2;
}

/* Status Card in Sidebar */
.status-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

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

.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

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

.status-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ========== CONTENT AREA ========== */
.content-area {
    flex: 1;
    margin-left: 260px;
    padding: 1.5rem 2rem;
    background: var(--bg-primary);
    min-height: calc(100vh - 65px);
}

/* ========== PAGE HEADER ========== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-cyan);
}

.stat-card.critical::before { background: var(--accent-red); }
.stat-card.warning::before { background: var(--accent-orange); }
.stat-card.success::before { background: var(--accent-green); }
.stat-card.info::before { background: var(--accent-blue); }

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.stat-card-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--accent-cyan-dim);
    color: var(--accent-cyan);
}

.stat-card.critical .stat-card-icon { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }
.stat-card.warning .stat-card-icon { background: rgba(245, 158, 11, 0.1); color: var(--accent-orange); }
.stat-card.success .stat-card-icon { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }

.stat-card-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.stat-card-change.positive { color: var(--accent-green); }
.stat-card-change.negative { color: var(--accent-red); }

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

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

/* ========== TABLES (Reports & Data – no overlapping text) ========== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.table-container .data-table {
    margin-bottom: 0;
    min-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-secondary);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    vertical-align: top;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    vertical-align: top;
}

/* Fixed layout: prevents column overlap; use with col or column classes for widths */
.data-table.fixed-layout {
    table-layout: fixed;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* Report pages: consistent card and table presentation */
.report-page .card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.report-page .card-body {
    padding: 1.5rem;
}

.report-page .table-container {
    overflow-x: auto;
}

.report-page .data-table th,
.report-page .data-table td {
    padding: 0.75rem 1rem;
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-critical, .badge-high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.badge-warning, .badge-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.badge-success, .badge-low {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.badge-online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, #00a8cc 100%);
    color: var(--bg-primary);
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    transform: translateY(-1px);
}

/* Marketing landing: long CTA copy — smaller type, similar control footprint */
.btn-marketing-cta-compact {
    max-width: 22rem;
    width: 100%;
    min-height: 2.85rem;
    padding: 0.65rem 1.1rem;
    font-size: 0.7rem;
    line-height: 1.35;
    font-weight: 600;
    letter-spacing: 0.03em;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.btn-marketing-cta-compact .btn-marketing-cta-compact__label {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
}

.btn-marketing-cta-compact > i:first-child {
    flex-shrink: 0;
    font-size: 1.05em;
    opacity: 0.95;
}

@media (min-width: 480px) {
    .btn-marketing-cta-compact {
        font-size: 0.75rem;
        letter-spacing: 0.025em;
    }
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
}

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

.btn-danger:hover {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

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

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px var(--accent-cyan-dim);
}

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

select.form-control {
    cursor: pointer;
}

/* ========== ALERTS ========== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-green);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--accent-orange);
}

/* ========== CHART CONTAINER ========== */
.chart-container {
    position: relative;
    height: 300px;
    padding: 1rem;
}

/* ========== ACTIVITY FEED ========== */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.activity-icon.critical { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.activity-icon.warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.activity-icon.info { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.activity-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========== AGENT CARDS ========== */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.agent-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.agent-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.agent-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.agent-status.online {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.agent-status.offline {
    background: var(--accent-red);
    box-shadow: 0 0 10px var(--accent-red);
}

.agent-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.agent-details {
    display: grid;
    gap: 0.5rem;
}

.agent-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

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

.agent-detail-value {
    color: var(--text-secondary);
}

/* ========== THREAT MAP ========== */
.threat-map-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    height: 400px;
    position: relative;
    overflow: hidden;
}

.threat-map-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
}

.world-map-svg {
    opacity: 0.3;
    width: 100%;
    height: 100%;
}

/* ========== FOOTER ========== */
.VigilSentinel-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    margin-left: 260px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ========== LOADING STATES ========== */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-title,
    .sidebar-menu span:not(.icon):not(.badge) {
        display: none;
    }
    
    .sidebar-menu a {
        justify-content: center;
    }
    
    .content-area {
        margin-left: 80px;
    }
    
    .VigilSentinel-footer {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .content-area,
    .VigilSentinel-footer {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Staggered animation delays */
.animate-delay-1 { animation-delay: 0.1s; opacity: 0; }
.animate-delay-2 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-3 { animation-delay: 0.3s; opacity: 0; }
.animate-delay-4 { animation-delay: 0.4s; opacity: 0; }

/* ========== COMPACT MODE ========== */
.compact-mode .card {
    padding: 0.75rem;
}

.compact-mode .card-header {
    padding: 0.75rem;
}

.compact-mode .card-body {
    padding: 0.75rem;
}

.compact-mode .sidebar-menu a {
    padding: 0.5rem 1rem;
}

.compact-mode .stat-card {
    padding: 1rem;
}

.compact-mode .page-header {
    padding: 1rem 0;
}

.compact-mode .content-area {
    padding: 1rem;
}

/* ========== NO ANIMATIONS ========== */
.no-animations * {
    animation: none !important;
    transition: none !important;
}

/* ========== RTL SUPPORT (Arabic) ========== */
[dir="rtl"] {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

[dir="rtl"] .content-area {
    margin-left: 0;
    margin-right: 260px;
}

[dir="rtl"] .VigilSentinel-footer {
    margin-left: 0;
    margin-right: 260px;
}

[dir="rtl"] .sidebar-menu a {
    border-left: none;
    border-right: 3px solid transparent;
}

[dir="rtl"] .sidebar-menu a:hover,
[dir="rtl"] .sidebar-menu a.active {
    border-left: none;
    border-right-color: var(--accent-cyan);
}

[dir="rtl"] .sidebar-menu .badge {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .header-nav {
    margin-left: 0;
    margin-right: 2rem;
}

[dir="rtl"] .header-right {
    gap: 0.75rem;
}

[dir="rtl"] .card-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .stat-card-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .btn i {
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] .form-group {
    text-align: right;
}

[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td {
    text-align: right;
}

[dir="rtl"] .alert {
    text-align: right;
}

[dir="rtl"] .brand {
    flex-direction: row-reverse;
}

[dir="rtl"] .logo-container {
    flex-direction: row-reverse;
}

@media (max-width: 1024px) {
    [dir="rtl"] .content-area {
        margin-right: 80px;
    }
    
    [dir="rtl"] .VigilSentinel-footer {
        margin-right: 80px;
    }
}

@media (max-width: 768px) {
    [dir="rtl"] .content-area,
    [dir="rtl"] .VigilSentinel-footer {
        margin-right: 0;
    }
}

/* ========================================================================
   AI DASHBOARD COMPONENTS
   ======================================================================== */

/* ============ AI Dashboard Styles ============ */

/* Dashboard Header */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.dash-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.dash-header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}
.dash-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}
.dash-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* AI Badge */
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a78bfa;
}

/* Glass Button */
.glass-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}
[data-theme="light"] .glass-btn { background: rgba(255, 255, 255, 0.7); }
.glass-btn:hover { border-color: var(--border-glow); background: rgba(255, 255, 255, 0.1); }
.glass-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Status Pill */
.status-pill { cursor: default; }
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 4px #10b981; }
    50% { box-shadow: 0 0 16px #10b981; }
}

/* Fade-up Animation */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease calc(var(--delay, 0s)), transform 0.5s ease calc(var(--delay, 0s));
}
.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== Stats Grid ========== */
.ai-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ========== Glass Card ========== */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}
.glass-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

/* ========== AI Stat Cards ========== */
.stat-card-ai {
    padding: 1.5rem;
}
.stat-ai-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.stat-ai-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.25rem;
}
.stat-ai-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.25rem 0;
    line-height: 1;
}
.stat-ai-change {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}
.stat-ai-change.up { color: #10b981; }
.stat-ai-change.down { color: #ef4444; }
.stat-ai-change.neutral { color: var(--text-muted); }
.stat-ai-icon {
    padding: 0.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-ai-icon.red { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.stat-ai-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.stat-ai-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.stat-ai-icon.purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

/* ========== AI Features Row ========== */
.ai-features-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ========== Card Header AI ========== */
.card-header-ai {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.card-header-ai h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.card-header-ai p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* ========== Card Icon Badge ========== */
.card-icon-badge {
    padding: 0.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}
.card-icon-badge.purple-pink { background: linear-gradient(135deg, #a855f7, #ec4899); }
.card-icon-badge.cyan-blue { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.card-icon-badge.small { padding: 0.35rem; }

/* ========== AI Insights ========== */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 380px;
    overflow-y: auto;
}
.insight-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 12px;
    border: 2px solid transparent;
    animation: slideUp 0.4s ease forwards;
    opacity: 0;
}
.insight-item.critical { border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
.insight-item.high { border-color: rgba(234, 88, 12, 0.4); background: rgba(234, 88, 12, 0.08); }
.insight-item.medium { border-color: rgba(202, 138, 4, 0.4); background: rgba(202, 138, 4, 0.08); }
.insight-item.low { border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.08); }
.insight-item.info { border-color: rgba(6, 182, 212, 0.4); background: rgba(6, 182, 212, 0.08); }

.insight-icon {
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.15rem;
    height: fit-content;
}
[data-theme="light"] .insight-icon { background: rgba(241, 245, 249, 0.8); }

.insight-content {
    flex: 1;
    min-width: 0;
}
.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.insight-header h4 {
    font-weight: 500;
    font-size: 0.95rem;
    margin: 0;
}
.confidence-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 9999px;
    color: var(--text-muted);
    white-space: nowrap;
}
[data-theme="light"] .confidence-badge { background: rgba(241, 245, 249, 0.8); }

.insight-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.35rem;
    line-height: 1.5;
}
.insight-impact {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
}
.insight-action {
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}
.insight-action:hover { color: #22d3ee; filter: brightness(1.2); }

/* ========== Anomaly Detection Card ========== */
.anomaly-stats-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.anomaly-big-number {
    display: flex;
    flex-direction: column;
}
.anomaly-big-number span {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.anomaly-big-number small {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.anomaly-trend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
}
[data-theme="light"] .anomaly-trend { background: rgba(241, 245, 249, 0.8); }
.anomaly-trend.good { color: #10b981; }
.anomaly-trend.bad { color: #ef4444; }
.anomaly-chart-container {
    position: relative;
    height: 180px;
}

/* ========== Predictions Row ========== */
.predictions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ========== Predictive Card ========== */
.predictive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}
.predictive-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.predictive-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0;
}
.trend-indicator {
    padding: 0.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-muted);
}
[data-theme="light"] .trend-indicator { background: rgba(241, 245, 249, 0.8); }
.trend-indicator.good { color: #10b981; background: rgba(16, 185, 129, 0.15); }
.trend-indicator.bad { color: #ef4444; background: rgba(239, 68, 68, 0.15); }

/* ========== Risk Score ========== */
.risk-score-section {
    margin-bottom: 1.25rem;
}
.risk-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.risk-score-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.risk-score-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 9999px;
    overflow: hidden;
}
.risk-score-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 1s ease;
}
.risk-score-fill.high { background: linear-gradient(90deg, #ef4444, #dc2626); }
.risk-score-fill.medium { background: linear-gradient(90deg, #eab308, #f59e0b); }
.risk-score-fill.low { background: linear-gradient(90deg, #10b981, #059669); }

/* ========== Forecast Grid ========== */
.forecast-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.forecast-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
}
[data-theme="light"] .forecast-item { background: rgba(241, 245, 249, 0.8); }
.forecast-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.25rem;
}
.forecast-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.forecast-unit {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0;
}

/* ========== Chart Subtitle ========== */
.chart-subtitle {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
}

/* ========== Glass Card Title ========== */
.glass-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

/* ========== AI Recommendations ========== */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
}
.rec-item {
    padding: 1rem;
    border-radius: 12px;
    border-left: 4px solid;
    animation: slideUp 0.4s ease forwards;
    opacity: 0;
}
.rec-item.high { border-color: #ef4444; background: rgba(239, 68, 68, 0.08); }
.rec-item.medium { border-color: #eab308; background: rgba(234, 179, 8, 0.08); }
.rec-item.low { border-color: #3b82f6; background: rgba(59, 130, 246, 0.08); }
.rec-item.critical { border-color: #dc2626; background: rgba(220, 38, 38, 0.08); }

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.35rem;
    gap: 0.5rem;
}
.rec-action {
    font-weight: 500;
    font-size: 0.9rem;
    margin: 0;
}
.rec-priority-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 9999px;
    text-transform: capitalize;
    white-space: nowrap;
    color: var(--text-muted);
}
[data-theme="light"] .rec-priority-badge { background: rgba(241, 245, 249, 0.8); }
.rec-priority-badge.high { color: #ef4444; }
.rec-priority-badge.critical { color: #dc2626; }
.rec-priority-badge.medium { color: #eab308; }
.rec-priority-badge.low { color: #3b82f6; }

.rec-impact {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

/* ========== Charts Row ========== */
.charts-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ========== Recent Alerts ========== */
.recent-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
}
.alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.4);
    transition: background 0.2s;
}
[data-theme="light"] .alert-item { background: rgba(241, 245, 249, 0.8); }
.alert-item:hover { background: rgba(15, 23, 42, 0.6); }
[data-theme="light"] .alert-item:hover { background: rgba(226, 232, 240, 0.8); }

.severity-pill {
    font-size: 0.65rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.severity-pill.critical { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.severity-pill.high { background: rgba(234, 88, 12, 0.2); color: #ea580c; }
.severity-pill.medium { background: rgba(202, 138, 4, 0.2); color: #ca8a04; }
.severity-pill.low { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.severity-pill.info { background: rgba(6, 182, 212, 0.2); color: #06b6d4; }

.alert-item-content {
    flex: 1;
    min-width: 0;
}
.alert-item-title {
    font-weight: 500;
    font-size: 0.85rem;
    margin: 0;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.alert-item-source {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0;
}
.alert-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========== AI Chat Assistant ========== */
.ai-chat-fab {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
    transition: all 0.3s;
}
.ai-chat-fab:hover { transform: scale(1.05); box-shadow: 0 6px 30px rgba(6, 182, 212, 0.5); }
.ai-chat-fab.hidden { display: none; }

.chat-fab-pulse {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.ai-chat-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    z-index: 1001;
    width: 380px;
    max-width: calc(100vw - 1rem);
    height: 550px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(12px);
}
.ai-chat-window.open {
    display: flex;
}

.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.ai-chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.ai-chat-header-left h4 {
    margin: 0;
    font-size: 0.95rem;
}
.ai-chat-header-left p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ai-chat-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-chat-close:hover { background: var(--bg-card-hover); }

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    display: flex;
}
.chat-message.user { justify-content: flex-end; }
.chat-message.assistant { justify-content: flex-start; }

.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.chat-bubble p { margin: 0; }

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-message.assistant .chat-bubble {
    background: rgba(15, 23, 42, 0.5);
    border-bottom-left-radius: 4px;
}
[data-theme="light"] .chat-message.assistant .chat-bubble { background: rgba(241, 245, 249, 0.8); }

.chat-time {
    display: block;
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 0.35rem;
}

/* Typing indicator */
.chat-bubble.typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0.75rem 1.25rem;
}
.chat-bubble.typing .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-cyan);
    animation: typing-bounce 1.4s infinite;
}
.chat-bubble.typing .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-bubble.typing .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Quick Actions */
.ai-chat-quick-actions {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
}
.quick-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.quick-btns button {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: none;
    color: var(--text-secondary);
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
}
[data-theme="light"] .quick-btns button { background: rgba(241, 245, 249, 0.8); }
.quick-btns button:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* Chat Input */
.ai-chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}
.ai-chat-input input {
    flex: 1;
    padding: 0.5rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
[data-theme="light"] .ai-chat-input input { background: rgba(241, 245, 249, 0.8); }
.ai-chat-input input:focus { border-color: var(--accent-cyan); }
.ai-chat-input input::placeholder { color: var(--text-muted); }

.ai-chat-input button {
    padding: 0.5rem;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.ai-chat-input button:hover { filter: brightness(1.1); }
.ai-chat-input button:disabled { opacity: 0.5; }

/* ========== Skeleton Loading ========== */
.insight-skeleton {
    padding: 1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.3);
}
[data-theme="light"] .insight-skeleton { background: rgba(241, 245, 249, 0.6); }
.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 0.5rem;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.w75 { width: 75%; }
.skeleton-line.w50 { width: 50%; }

/* ========== Slide Up Animation ========== */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Detail Modal ========== */
.detail-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.detail-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}
.detail-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 600px;
    max-width: calc(100vw - 2rem);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s ease;
}
.detail-modal-overlay.open .detail-modal {
    transform: translateY(0) scale(1);
}
.detail-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.detail-modal-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.detail-modal-title-row h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}
.detail-modal-badges {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}
.detail-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}
.detail-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Modal Section */
.modal-section {
    margin-bottom: 1.5rem;
}
.modal-section:last-child { margin-bottom: 0; }
.modal-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}
.modal-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Modal Impact Bar */
.modal-impact-bar {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.4);
}
[data-theme="light"] .modal-impact-bar { background: rgba(241, 245, 249, 0.8); }
.modal-impact-level {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    display: inline-block;
    color: white;
}

/* Modal Steps */
.modal-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.modal-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 10px;
    transition: background 0.2s;
}
[data-theme="light"] .modal-step { background: rgba(241, 245, 249, 0.6); }
.modal-step:hover { background: rgba(15, 23, 42, 0.5); }
[data-theme="light"] .modal-step:hover { background: rgba(226, 232, 240, 0.8); }
.modal-step-num {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.modal-step-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 0.15rem !important;
}
.modal-step-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 !important;
    line-height: 1.5;
}

/* Modal Context Grid */
.modal-context-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.modal-context-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 8px;
}
[data-theme="light"] .modal-context-item { background: rgba(241, 245, 249, 0.6); }
.modal-context-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.modal-context-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .detail-modal { width: calc(100vw - 1rem); max-height: 90vh; }
    .modal-context-grid { grid-template-columns: 1fr; }
}

/* ========== AI Dashboard Responsive ========== */
@media (max-width: 1200px) {
    .ai-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .ai-features-row { grid-template-columns: 1fr; }
    .predictions-row { grid-template-columns: 1fr; }
    .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .ai-stats-grid { grid-template-columns: 1fr; }
    .dash-header { flex-direction: column; align-items: flex-start; }
    .forecast-grid { grid-template-columns: repeat(3, 1fr); }
    .ai-chat-window { width: calc(100vw - 1rem); right: 0.5rem; bottom: 5rem; height: 70vh; }
    .glass-btn span { display: none; }
}
