@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    /* Theme: Dark (Default) */
    --bg-primary: #080810;
    --bg-secondary: #0f0f20;
    --bg-tertiary: #161630;
    --sidebar-bg: rgba(13, 13, 29, 0.75);
    --card-bg: rgba(22, 22, 48, 0.5);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-primary: #00f2fe; /* Neon Cyan for general and physics theme */
    --color-primary-rgb: 0, 242, 254;
    --color-thermo: #ff6a00; /* Neon Orange/Red for Thermodynamics */
    --color-thermo-rgb: 255, 106, 0;
    --color-electricity: #00c6ff; /* Neon Blue for Electricity */
    --color-electricity-rgb: 0, 198, 255;
    --color-success: #10b981; /* Emerald Green */
    --color-warning: #f59e0b; /* Amber */
    --color-danger: #ef4444; /* Rose */
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(0, 242, 254, 0.3);
    --glow-shadow: 0 0 20px rgba(0, 242, 254, 0.15);
    --glow-thermo: 0 0 20px rgba(255, 106, 0, 0.2);
    --glow-electricity: 0 0 20px rgba(0, 198, 255, 0.2);
    
    --glass-blur: 12px;
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #edf2f7;
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --card-bg: rgba(255, 255, 255, 0.75);
    
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    
    --color-primary: #0088cc;
    --color-primary-rgb: 0, 136, 204;
    --color-thermo: #dd6b20;
    --color-thermo-rgb: 221, 107, 32;
    --color-electricity: #2b6cb0;
    --color-electricity-rgb: 43, 108, 176;
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 136, 204, 0.3);
    --glow-shadow: 0 8px 30px rgba(0, 136, 204, 0.08);
    --glow-thermo: 0 8px 30px rgba(221, 107, 32, 0.08);
    --glow-electricity: 0 8px 30px rgba(43, 108, 176, 0.08);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom Scrollbar for Webkit */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    height: 100%;
    background: var(--sidebar-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 100;
    transition: width var(--transition-normal), transform var(--transition-normal), background var(--transition-normal);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2.5rem;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-electricity));
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.sidebar-logo svg {
    width: 24px;
    height: 24px;
    fill: #000;
}

.sidebar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-title span {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-primary);
    -webkit-text-fill-color: initial;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    cursor: pointer;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-link:hover svg {
    transform: translateX(2px);
}

.nav-item.active .nav-link {
    color: #080810;
    background: linear-gradient(90deg, var(--color-primary), #00c6ff);
    font-weight: 600;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.25);
    border-color: transparent;
}

[data-theme="light"] .nav-item.active .nav-link {
    color: #ffffff;
    background: linear-gradient(90deg, var(--color-primary), var(--color-electricity));
}

.nav-item.active .nav-link svg {
    stroke: currentColor;
}

/* Sidebar Footer & Theme Toggle */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.student-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--color-primary);
}

.student-info {
    overflow: hidden;
}

.student-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

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

.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 6px;
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: calc(var(--border-radius-md) - 4px);
    transition: all var(--transition-fast);
}

.theme-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.theme-btn.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .theme-btn.active {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* View Wrapper (SPA views) */
.view-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    overflow-y: auto;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.view-container.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
    z-index: 10;
}

/* Mobile Nav / Hamburger */
.mobile-header {
    display: none;
    width: 100%;
    height: 60px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.25rem;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
}

/* Grid & Layout Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        width: 280px;
        height: calc(100vh - 60px);
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-header {
        display: flex;
    }
    
    .view-container {
        padding: 5rem 1.25rem 2rem 1.25rem;
    }
}
