:root {
    --bg-dark: #0d1117;
    --bg-darker: #010409;
    --accent-blue: #58a6ff;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --border-dim: rgba(240, 246, 252, 0.1);
    --glass-bg: rgba(13, 17, 23, 0.8);
    --sidebar-width: 250px;
    --top-bar-height: 70px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-darker);
    color: var(--text-primary);
    overflow: hidden; /* App container will handle scroll if needed */
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    z-index: 10;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border-dim);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-blue);
    margin-bottom: 3rem;
    letter-spacing: 2px;
}

.logo i {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px var(--accent-blue));
}

.nav-links {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover {
    background: rgba(88, 166, 255, 0.1);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--accent-blue), #1e4eb8);
    color: white;
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.3);
}

.sidebar-footer {
    padding-top: 2rem;
    border-top: 1px solid var(--border-dim);
}

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

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

@keyframes pulse-glow {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Main Dashboard Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 15;
}

.main-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0.3;
}

.top-bar {
    height: var(--top-bar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--border-dim);
    backdrop-filter: blur(12px);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-darker);
    border: 1px solid var(--border-dim);
    padding: 10px 15px;
    border-radius: 10px;
    width: 350px;
    gap: 10px;
}

.search-bar input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-family: inherit;
}

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

.notifications {
    position: relative;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.notifications .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-red);
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 10px;
}

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

.profile-info .role {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono';
}

.avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #30363d, #21262d);
    border: 1px solid var(--border-dim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent-blue);
}

.module-area {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-dim) transparent;
}

.module-area::-webkit-scrollbar {
    width: 6px;
}

.module-area::-webkit-scrollbar-thumb {
    background-color: var(--border-dim);
    border-radius: 10px;
}

/* Background Effects */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(rgba(88, 166, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(88, 166, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 1;
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 2;
    opacity: 0.4;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: rgba(88, 166, 255, 0.1);
    top: -200px;
    right: -200px;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: rgba(63, 185, 80, 0.05);
    bottom: -100px;
    left: -100px;
}

/* Glass Card Generic Styles */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-dim);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Animations for Module Entrance */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.stat-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dim);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(5px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.status-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.status-tag.critical { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); border: 1px solid rgba(248, 81, 73, 0.3); }
.status-tag.safe { background: rgba(63, 185, 80, 0.15); color: var(--accent-green); border: 1px solid rgba(63, 185, 80, 0.3); }

/* Map Component */
.map-viz {
    height: 400px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1a2332 0%, #0d1117 100%);
    border-radius: 12px;
    margin-top: 1.5rem;
    border: 1px solid rgba(88, 166, 255, 0.2);
}

.map-viz::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(88, 166, 255, 0.1), transparent);
    animation: scanline-move 4s linear infinite;
    pointer-events: none;
}

@keyframes scanline-move {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.ping {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-red);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--accent-red);
}

.ping::after {
    content: '';
    position: absolute;
    width: 300%;
    height: 300%;
    border: 2px solid var(--accent-red);
    border-radius: 50%;
    top: -100%;
    left: -100%;
    animation: ping-expand 2s infinite;
}

@keyframes ping-expand {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Form Elements */
.input-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.mono-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    color: var(--text-primary);
    padding: 12px 15px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
    outline: none;
    transition: border-color 0.3s;
}

.mono-input:focus {
    border-color: var(--accent-blue);
}

.primary-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.4);
}

/* Header Cards */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.header-card {
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.header-card.safe { background: rgba(63, 185, 80, 0.1); border: 1px solid rgba(63, 185, 80, 0.3); color: var(--accent-green); }
.header-card.critical { background: rgba(248, 81, 73, 0.1); border: 1px solid rgba(248, 81, 73, 0.3); color: var(--accent-red); }
.header-card.warning { background: rgba(227, 179, 65, 0.1); border: 1px solid rgba(227, 179, 65, 0.3); color: #e3b341; }

/* Strength Bar */
.strength-meter-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.4s ease, background 0.4s;
}

.mt-2 { margin-top: 2rem; }
.text-small { font-size: 0.85rem; }
.full-width { width: 100%; }
