/* ==========================================================================
   Aegis Suite - Premium Interactive Design System
   ========================================================================== */

:root {
    /* Color Palette - Deep Dark Glass Theme */
    --bg-color: #050505;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    
    /* Brand Colors (Vibrant Gradients) */
    --brand-primary: #3b82f6;
    --brand-primary-hover: #2563eb;
    --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --brand-gradient-hover: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    
    /* Status Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Glassmorphism Tokens */
    --glass-bg: rgba(20, 20, 25, 0.4);
    --glass-bg-hover: rgba(30, 30, 40, 0.6);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-border-light: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Metrics */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

/* ==========================================================================
   Base Reset
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

.text-gradient {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input { font-family: inherit; }

/* ==========================================================================
   Dynamic Background & Mesh
   ========================================================================== */
.bg-mesh {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: #050505;
}

.blob {
    position: absolute;
    filter: blur(90px);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 25s infinite ease-in-out alternate;
    mix-blend-mode: screen;
}

.blob-1 { top: -10%; left: -10%; width: 500px; height: 500px; background: rgba(59, 130, 246, 0.4); animation-delay: 0s; }
.blob-2 { bottom: -20%; right: -10%; width: 600px; height: 600px; background: rgba(139, 92, 246, 0.35); animation-delay: -5s; }
.blob-3 { top: 40%; left: 50%; width: 400px; height: 400px; background: rgba(16, 185, 129, 0.25); animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    33% { transform: translate(50px, -50px) scale(1.1) rotate(45deg); }
    66% { transform: translate(-30px, 40px) scale(0.9) rotate(-20deg); }
    100% { transform: translate(60px, 80px) scale(1.15) rotate(90deg); }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.hidden { display: none !important; }
.active { display: flex; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-l { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.fill-height { height: 100%; }

/* ==========================================================================
   Components
   ========================================================================== */
/* Glass Panel */
.glass-panel, .glass-card, .glass-sidebar, .glass-header, .glass-metric {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-panel:hover, .glass-metric:hover {
    border-color: var(--glass-border-light);
    transform: translateY(-5px);
    box-shadow: 0 15px 45px -10px rgba(0,0,0,0.7), 0 0 20px rgba(59, 130, 246, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--brand-gradient-hover); z-index: -1;
    opacity: 0; transition: opacity 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
}

.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(1px); }

.btn-block { width: 100%; }

.btn-icon {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 44px; height: 44px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--brand-primary);
    color: white;
    transform: rotate(10deg) scale(1.1);
    border-color: var(--brand-primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.btn-text {
    background: transparent; color: var(--brand-primary); font-weight: 500; transition: all 0.2s;
}
.btn-text:hover { color: var(--brand-primary-hover); transform: translateX(4px); }

/* Forms & Inputs */
.input-group {
    margin-bottom: var(--spacing-lg);
    display: flex; flex-direction: column; gap: var(--spacing-sm);
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s;
}

.input-group:focus-within label { color: var(--brand-primary); }

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

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: color 0.3s;
}

.input-wrapper input {
    width: 100%;
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 14px 16px 14px 48px;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    font-size: 1rem;
}

.input-wrapper input:focus {
    outline: none;
    background: rgba(15, 20, 30, 0.8);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), inset 0 0 10px rgba(0,0,0,0.5);
}

.input-wrapper input:focus + i, .input-wrapper:focus-within i { color: var(--brand-primary); }

.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 8px; text-align: center; animation: shake 0.5s; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ==========================================================================
   Views & Layouts
   ========================================================================== */
.app-container {
    width: 100vw; height: 100vh;
    display: flex; align-items: center; justify-content: center;
}

/* --- Login View --- */
#login-view {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    perspective: 1000px;
}

.login-card {
    width: 100%; max-width: 420px;
    padding: 48px 40px;
    border-radius: var(--radius-lg);
    animation: slideUpFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-style: preserve-3d;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center; margin-bottom: 40px;
}

.logo {
    width: 72px; height: 72px;
    background: var(--brand-gradient);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; color: white;
    margin: 0 auto 20px;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
    animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4); transform: scale(1); }
    100% { box-shadow: 0 15px 35px rgba(139, 92, 246, 0.6); transform: scale(1.05); }
}

.login-header h1 { font-size: 2.2rem; margin-bottom: 4px; font-weight: 700; letter-spacing: -1px; }
.login-header p { color: var(--text-secondary); font-size: 1.1rem; }

@keyframes slideUpFadeIn {
    0% { opacity: 0; transform: translateY(60px) rotateX(10deg); }
    100% { opacity: 1; transform: translateY(0) rotateX(0deg); }
}

/* --- Dashboard View --- */
#dashboard-view {
    width: 100%; height: 100%;
    display: flex;
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

/* Sidebar */
.glass-sidebar {
    width: 280px; height: 100%;
    border-radius: 0; border-top: none; border-bottom: none; border-left: none;
    display: flex; flex-direction: column;
    padding: 32px 24px;
    background: rgba(10, 10, 15, 0.6);
}

.sidebar-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 48px;
    padding-left: 8px;
}

.sidebar-header i { font-size: 2.2rem; color: var(--brand-primary); filter: drop-shadow(0 0 8px rgba(59,130,246,0.5)); }
.sidebar-header h2 { font-size: 1.8rem; letter-spacing: -0.5px; font-weight: 700; }

.sidebar-nav {
    display: flex; flex-direction: column; gap: 8px; flex-grow: 1;
}

.nav-item {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--brand-primary); transform: scaleY(0); transition: transform 0.3s;
    border-radius: 0 4px 4px 0;
}

.nav-item i { font-size: 1.3rem; transition: transform 0.3s; }

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, transparent 100%);
    color: var(--text-primary);
    border: 1px solid transparent;
}

.nav-item.active::before { transform: scaleY(1); }
.nav-item.active i { color: var(--brand-primary); }

.sidebar-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

.user-profile { display: flex; align-items: center; gap: 12px; }
.user-profile img { width: 44px; height: 44px; border-radius: var(--radius-full); border: 2px solid var(--brand-primary); padding: 2px; transition: transform 0.3s; }
.user-profile:hover img { transform: rotate(10deg) scale(1.1); }
.user-info { display: flex; flex-direction: column; }
.user-info span:first-child { font-weight: 600; font-size: 0.95rem; }
.user-info span:last-child { color: var(--brand-primary); font-size: 0.8rem; font-weight: 500; }

/* Main Content Area */
.dashboard-content {
    flex-grow: 1; height: 100%;
    display: flex; flex-direction: column;
    position: relative;
}

.glass-header {
    height: 88px;
    padding: 0 40px;
    display: flex; align-items: center; justify-content: space-between;
    border-radius: 0; border-top: none; border-left: none; border-right: none;
    background: rgba(15, 15, 20, 0.4);
    z-index: 10;
}

.header-search { position: relative; width: 360px; }
.header-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); transition: color 0.3s;}
.header-search input {
    width: 100%; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--glass-border);
    padding: 12px 16px 12px 48px; border-radius: var(--radius-full); color: white;
    transition: all 0.3s;
}
.header-search input:focus {
    background: rgba(15, 23, 42, 0.6);
    border-color: var(--brand-primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}
.header-search input:focus + i { color: var(--brand-primary); }

.header-actions { display: flex; gap: 12px; }

.content-scroll {
    flex-grow: 1; padding: 40px; overflow-y: auto; scroll-behavior: smooth;
}

/* Staggered Animations for Dashboard Elements */
.dashboard-section.active .glass-metric:nth-child(1) { animation: slideInUp 0.5s 0.1s both; }
.dashboard-section.active .glass-metric:nth-child(2) { animation: slideInUp 0.5s 0.2s both; }
.dashboard-section.active .glass-metric:nth-child(3) { animation: slideInUp 0.5s 0.3s both; }
.dashboard-section.active .split-layout { animation: slideInUp 0.6s 0.4s both; }

@keyframes slideInUp {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.section-header { margin-bottom: 36px; animation: slideInUp 0.5s both; }
.section-header h2 { font-size: 2.2rem; margin-bottom: 8px; font-weight: 700; letter-spacing: -0.5px;}
.section-header p { color: var(--text-secondary); font-size: 1.1rem; }

/* Metrics Grid */
.metrics-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px;
}

.glass-metric {
    padding: 28px; border-radius: var(--radius-lg);
    display: flex; align-items: center; gap: 24px;
    position: relative; overflow: hidden;
}

.glass-metric::after {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    opacity: 0; transition: opacity 0.4s; pointer-events: none;
}
.glass-metric:hover::after { opacity: 1; }

.metric-icon {
    width: 72px; height: 72px; border-radius: 20px;
    display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: white;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.glass-metric:hover .metric-icon { transform: scale(1.1) rotate(5deg); }

.bg-blue { background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.3)); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
.bg-green { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3)); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);}
.bg-purple { background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.3)); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.4); box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);}

.metric-info h3 { color: var(--text-secondary); font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1.5px; }
.metric-info h2 { font-size: 2.8rem; font-weight: 700; color: var(--text-primary); font-family: var(--font-heading); line-height: 1;}

/* Panels & Lists */
.split-layout {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 32px;
}

.glass-panel {
    border-radius: var(--radius-lg); padding: 32px;
}

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--glass-border);
}
.panel-header h3 { font-size: 1.4rem; font-weight: 600; }

.list-group { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.list-item {
    display: flex; align-items: center; gap: 16px;
    padding: 16px; border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border-light);
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.avatar-sm { 
    width: 48px; height: 48px; border-radius: var(--radius-full); 
    background: var(--brand-gradient); 
    display: flex; align-items: center; justify-content: center; 
    font-weight: 700; font-size: 1.1rem; color: white; 
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.item-details { flex-grow: 1; }
.item-details h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 2px;}
.item-details p { font-size: 0.9rem; color: var(--text-secondary); }

/* Tables */
.table-responsive { width: 100%; overflow-x: auto; border-radius: var(--radius-md); }
.aegis-table { width: 100%; border-collapse: collapse; }
.aegis-table th { text-align: left; padding: 20px 16px; color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1.5px; border-bottom: 1px solid var(--glass-border); font-weight: 600; }
.aegis-table td { padding: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 1rem; transition: background 0.2s;}
.aegis-table tr:hover td { background: rgba(255, 255, 255, 0.04); }

.loader {
    width: 40px; height: 40px; border: 3px solid var(--glass-border);
    border-top-color: var(--brand-primary); border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite; margin: 30px auto;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Toast */
.toast-container { position: fixed; bottom: 32px; right: 32px; z-index: 9999; display: flex; flex-direction: column; gap: 16px; }
.toast {
    background: rgba(15, 20, 30, 0.9); backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--brand-primary);
    padding: 16px 24px; border-radius: var(--radius-md);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white; font-weight: 500; display: flex; align-items: center; gap: 12px;
}

.toast i { color: var(--brand-primary); font-size: 1.5rem; }

@keyframes slideInRight {
    0% { transform: translateX(120%) scale(0.9); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}
