:root {
    /* Color Palette - Dark Mode Default */
    --bg-main: #0B0E14;
    --bg-secondary: #151A23;
    --bg-card: rgba(25, 30, 41, 0.7);
    --bg-card-hover: rgba(35, 42, 57, 0.9);
    
    --text-main: #FFFFFF;
    --text-muted: #8E9BAE;
    
    --accent-primary: #00f2fe;
    --accent-secondary: #4facfe;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --glass-blur: blur(12px);
    
    --sidebar-width: 260px;
    
    /* Typography */
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-main: #F4F6F8;
    --bg-secondary: #FFFFFF;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 1);
    
    --text-main: #111827;
    --text-muted: #6B7280;
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Layout --- */
.dashboard-layout {
    display: flex;
    height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    transition: width 0.3s ease;
    z-index: 10;
}

.sidebar-header {
    padding: 0 24px;
    margin-bottom: 40px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
}

.brand-logo {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 12px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

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

.nav-item:hover, .nav-item.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

[data-theme="light"] .nav-item:hover, [data-theme="light"] .nav-item.active {
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-item.active {
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 4px;
    background: var(--accent-primary);
    border-radius: 0 4px 4px 0;
}

.sidebar-footer {
    padding: 20px 24px 0;
    border-top: 1px solid var(--border-color);
}

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

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

[data-theme="light"] .avatar {
    background: rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

/* Background effects */
.main-content::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.topbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 14, 20, 0.6);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 10;
}

[data-theme="light"] .topbar {
    background: rgba(244, 246, 248, 0.6);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 8px;
    width: 300px;
    border: 1px solid var(--border-color);
}

[data-theme="light"] .search-bar {
    background: rgba(0, 0, 0, 0.05);
}

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

.search-bar i {
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    gap: 16px;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.content-wrapper {
    padding: 40px;
    z-index: 1;
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* --- Welcome Banner --- */
.welcome-banner {
    background: linear-gradient(135deg, rgba(25, 30, 41, 0.6) 0%, rgba(25, 30, 41, 0.2) 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .welcome-banner {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.5) 100%);
}

.banner-content h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.banner-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
}

.glass-sphere {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    position: absolute;
    right: 10%;
    top: 50%;
    transform: translateY(-50%);
    animation: float 6s ease-in-out infinite;
}

[data-theme="light"] .glass-sphere {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.2), rgba(0, 242, 254, 0.05));
    border: 1px solid rgba(79, 172, 254, 0.3);
    box-shadow: 0 8px 32px 0 rgba(79, 172, 254, 0.1);
}

@keyframes float {
    0% { transform: translateY(-50%) rotate(0deg); }
    50% { transform: translateY(-60%) rotate(10deg); }
    100% { transform: translateY(-50%) rotate(0deg); }
}

/* --- Section Heading --- */
.section-heading {
    margin-bottom: 24px;
}

.section-heading h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
}

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

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .app-card:hover {
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.app-card:hover::before {
    opacity: 1;
}

.app-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.app-details {
    flex: 1;
}

.app-details h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.app-details p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

.app-actions {
    margin-top: auto;
}

.launch-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

[data-theme="light"] .launch-btn {
    background: rgba(0, 0, 0, 0.05);
}

.app-card:hover .launch-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .brand-text, .nav-label, .nav-item span, .user-info {
        display: none;
    }
    
    .brand-logo {
        font-size: 1.8rem;
    }
    
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    
    .nav-item i {
        font-size: 1.5rem;
    }
    
    .sidebar-header, .sidebar-footer {
        padding: 20px 16px;
        display: flex;
        justify-content: center;
    }
    
    .user-profile {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 10px 20px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        align-items: center;
    }
    
    .sidebar-nav {
        display: none; /* Mobile menu could be implemented in JS */
    }
    
    .sidebar-header {
        margin-bottom: 0;
        padding: 0;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .topbar {
        padding: 0 20px;
    }
    
    .search-bar {
        width: auto;
        flex: 1;
        margin-right: 10px;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    .welcome-banner {
        padding: 24px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .glass-sphere {
        display: none;
    }
}
