/* ==========================================
   CSS Variables & Reset
   ========================================== */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    
    /* Secondary Colors */
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    
    /* Neutrals */
    --bg-dark: #0f172a;
    --bg-medium: #1e293b;
    --bg-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Status Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Spacing */
    --header-height: 64px;
    --sidebar-width: 260px;
    
    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* ==========================================
   Portal Container
   ========================================== */
.portal-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    transition: filter var(--transition-base);
}

.portal-container.blurred {
    filter: blur(8px);
    pointer-events: none;
}

/* ==========================================
   Header Styles
   ========================================== */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    background: var(--bg-medium);
    border-bottom: 1px solid var(--bg-light);
    position: relative;
    z-index: 100;
}

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================
   CIA Menu Styles
   ========================================== */
.cia-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-dark);
    padding: 6px;
    border-radius: var(--radius-full);
    position: relative;
}

.cia-slider {
    position: absolute;
    height: calc(100% - 12px);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
    z-index: 1;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.cia-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: color var(--transition-fast);
    position: relative;
    z-index: 2;
}

.cia-item:hover {
    color: var(--text-primary);
}

.cia-item.active {
    color: white;
}

.cia-item i {
    font-size: 16px;
}

/* ==========================================
   Profile Dropdown
   ========================================== */
.profile-dropdown {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-trigger:hover {
    background: var(--bg-light);
    border-color: var(--primary);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.profile-name {
    font-size: 14px;
    font-weight: 500;
}

.profile-arrow {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.profile-dropdown.open .profile-arrow {
    transform: rotate(180deg);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: var(--bg-medium);
    border: 1px solid var(--bg-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.profile-dropdown.open .profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.profile-menu-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.profile-menu-info {
    display: flex;
    flex-direction: column;
}

.profile-menu-name {
    font-weight: 600;
    font-size: 14px;
}

.profile-menu-email {
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-menu-divider {
    height: 1px;
    background: var(--bg-light);
    margin: 8px 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.profile-menu-item:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.profile-menu-item i {
    width: 20px;
    text-align: center;
}

.profile-menu-item.logout {
    color: var(--error);
}

.profile-menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ==========================================
   Portal Body
   ========================================== */
.portal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ==========================================
   Sidebar Styles
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-medium);
    border-right: 1px solid var(--bg-light);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    display: block;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: all var(--transition-fast);
}

.sidebar-item:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.sidebar-item.active .sidebar-badge {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-badge.new {
    background: var(--error);
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--bg-light);
}

.storage-info {
    background: var(--bg-dark);
    padding: 16px;
    border-radius: var(--radius-md);
}

.storage-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.storage-bar {
    height: 6px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
}

.storage-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================
   Main Content
   ========================================== */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-dark);
}

.content-header {
    margin-bottom: 32px;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.content-header p {
    color: var(--text-secondary);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.content-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-medium);
    border-radius: var(--radius-lg);
    border: 1px solid var(--bg-light);
    transition: all var(--transition-fast);
}

.content-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.card-icon.blue {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.card-icon.green {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.card-icon.orange {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.card-icon.purple {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.card-info h3 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.card-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Content Section */
.content-section {
    background: var(--bg-medium);
    border-radius: var(--radius-lg);
    border: 1px solid var(--bg-light);
    padding: 24px;
}

.content-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-dark);
    border-radius: var(--radius-md);
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

.activity-details p {
    font-size: 14px;
    margin-bottom: 4px;
}

.activity-details span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==========================================
   Login Overlay
   ========================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.login-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Login Modal */
.login-modal {
    width: 100%;
    max-width: 420px;
    background: var(--bg-medium);
    border-radius: var(--radius-xl);
    border: 1px solid var(--bg-light);
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-base);
    overflow: hidden;
}

.login-overlay.active .login-modal {
    transform: scale(1) translateY(0);
}

/* Login Header */
.login-header {
    text-align: center;
    padding: 32px 32px 24px;
    background: linear-gradient(180deg, var(--bg-light) 0%, transparent 100%);
}

.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.login-logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.login-logo span {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Login Form */
.login-form {
    padding: 0 32px 32px;
}

/* Error Message */
.login-error {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: #fca5a5;
    font-size: 14px;
    margin-bottom: 20px;
    animation: shake 0.5s ease;
}

.login-error.show {
    display: flex;
}

.login-error i {
    color: var(--error);
    font-size: 18px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Form Group */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i:first-child {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 16px;
    transition: color var(--transition-fast);
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    transition: all var(--transition-fast);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.input-wrapper input:focus + i,
.input-wrapper:focus-within i:first-child {
    color: var(--primary);
}

.toggle-password {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-primary);
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.remember-me input {
    display: none;
}

.remember-me .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--bg-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.remember-me input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.remember-me .checkmark::after {
    content: '✓';
    color: white;
    font-size: 12px;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-fast);
}

.remember-me input:checked + .checkmark::after {
    opacity: 1;
    transform: scale(1);
}

.forgot-password {
	display: none;
    font-size: 14px;
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-password:hover {
    color: var(--primary);
}

/* Form Buttons */
.form-buttons {
    display: flex;
    gap: 12px;
}

.btn-login,
.btn-cancel {
    flex: 1;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-login {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-login .btn-text,
.btn-login .btn-loader {
    transition: opacity var(--transition-fast);
}

.btn-login .btn-loader {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login.loading .btn-loader {
    opacity: 1;
}

.btn-cancel {
	display: none;
    background: var(--bg-dark);
    color: var(--text-secondary);
    border: 2px solid var(--bg-light);
}

.btn-cancel:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

/* Login Footer */
.login-footer {
	display: none;
    text-align: center;
    padding: 20px 32px;
    background: var(--bg-dark);
    border-top: 1px solid var(--bg-light);
}

.login-footer p {
    font-size: 14px;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    color: var(--primary);
}

/* ==========================================
   Scrollbar Styles
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-section-title,
    .sidebar-item span,
    .sidebar-badge,
    .storage-info {
        display: none;
    }
    
    .sidebar-item {
        justify-content: center;
        padding: 14px;
    }
    
    .sidebar-item i {
        width: auto;
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .cia-menu {
        display: none;
    }
    
    .login-modal {
        max-width: 100%;
        margin: 16px;
        border-radius: var(--radius-lg);
    }
    
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .portal-header {
        padding: 0 16px;
    }
    
    .profile-name {
        display: none;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 20px;
    }
}