:root {
    --bg-dark: #05050a;
    --bg-sidebar: #0a0a14;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --neon-cyan: #00f2ff;
    --neon-violet: #b026ff;
    --text-main: #e0e0e0;
    --text-dim: #9090a0;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

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

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

.dashboard-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--neon-cyan);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-violet));
    border-radius: 8px;
    box-shadow: 0 0 15px var(--neon-cyan);
}

nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

nav a:hover, nav a.active {
    background: var(--glass-bg);
    color: var(--neon-cyan);
    border: 1px solid var(--glass-border);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
}

.status-indicator {
    font-size: 0.85rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ff00;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 1; }
    70% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(0.95); opacity: 1; }
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: radial-gradient(circle at top right, rgba(176, 38, 255, 0.05), transparent);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.search-bar input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px 20px;
    border-radius: 30px;
    color: white;
    width: 400px;
    outline: none;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

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

.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--neon-violet);
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 50%;
}

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

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--neon-violet);
}

/* Glass Cards */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

/* Stats Grid */
.grid {
    display: grid;
    gap: 20px;
}

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

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-label {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--neon-cyan);
}

.stat-trend {
    font-size: 0.85rem;
}

.stat-trend.positive { color: #00ff00; }
.stat-trend.neutral { color: var(--text-dim); }

.stat-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background: var(--neon-cyan);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--neon-cyan);
}

.progress-bar.warning {
    background: var(--neon-violet);
    box-shadow: 0 0 10px var(--neon-violet);
}

/* Middle Row */
.row-middle {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    height: 380px; /* Stabilize height */
}

.viz-card, .chart-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.viz-card h3, .chart-card h3, .agents-list h3, .logs-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.core-img-container {
    position: relative;
    width: 100%;
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    height: 300px; /* Base height for stabilization */
}

.chart-container {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(0, 242, 255, 0.02), transparent);
}

.core-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.8) contrast(1.2);
}

.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to bottom, transparent, var(--neon-cyan), transparent);
    box-shadow: 0 0 15px var(--neon-cyan);
    opacity: 0.5;
    animation: scan 3s linear infinite;
    pointer-events: none;
}

@keyframes scan {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(340px); }
}

/* Bottom Row */
.row-bottom {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 20px;
    height: 320px; /* Stabilize bottom row */
}

.agents-list, .logs-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.agent-avatar {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.agent-info {
    flex: 1;
}

.agent-info strong { display: block; font-size: 0.95rem; }
.agent-info span { font-size: 0.8rem; color: var(--text-dim); }

.agent-status {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
}

.agent-status.warning {
    background: rgba(176, 38, 255, 0.1);
    color: var(--neon-violet);
}

/* System Logs */
.logs-container {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    height: 240px; /* Force fixed height to prevent resizing */
}

.log-entry {
    margin-bottom: 8px;
    line-height: 1.4;
}

.log-time { color: var(--neon-cyan); margin-right: 10px; }
.log-msg { color: var(--text-main); }
.log-type.info { color: var(--text-dim); }
.log-type.warn { color: var(--neon-violet); }

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 5000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.modal-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    text-align: center;
    padding: 3rem;
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.2);
    background: var(--bg-sidebar);
    border-radius: 20px;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
}

.security-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    background: var(--neon-cyan);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--neon-cyan);
}
.security-icon::after {
    content: "L4";
    color: black;
    font-weight: 900;
    font-size: 1.2rem;
}

.auth-box {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-box input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 8px;
    color: var(--neon-cyan);
    text-align: center;
    font-family: 'Space Mono', monospace;
    outline: none;
}

.btn-auth {
    background: var(--neon-cyan);
    color: black;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
}

.btn-auth:hover {
    box-shadow: 0 0 20px var(--neon-cyan);
}
