:root {
    --bg-dark: #0a0e14;
    --sidebar-bg: rgba(15, 20, 28, 0.85);
    --card-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-blue: #0078d4;
    --accent-neon: #00f2ff;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --sidebar-width: 320px;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    background-image: radial-gradient(circle at 50% -20%, #1a2a44, var(--bg-dark) 80%);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.home-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 8px;
}

.home-btn:hover {
    color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

.logo-container {
    width: 100px;
    height: 60px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.3);
    transition: 0.3s;
    padding: 8px;
}

.logo-container:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.5);
}

.sidebar-header {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, var(--accent-neon));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.search-container {
    padding: 0 0.5rem 1.5rem 0.5rem;
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    width: 16px;
    height: 16px;
}

.search-container input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    color: #fff;
    font-size: 0.85rem;
    transition: 0.3s;
}

.search-container input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 15px rgba(0, 120, 212, 0.2);
}

.nav-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 2px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

#course-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.course-item {
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.course-item:hover {
    background: var(--card-bg);
    border-color: var(--glass-border);
}

.course-item.active {
    background: rgba(0, 120, 212, 0.15);
    border-color: var(--accent-blue);
    position: relative;
}

.course-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: var(--accent-neon);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent-neon);
}

.course-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.course-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Main Viewer Styling */
.main-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.top-bar {
    height: 70px;
    padding: 0 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 14, 20, 0.5);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid var(--glass-border);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    width: 400px;
    border: 1px solid var(--glass-border);
}

.search-box input {
    background: transparent;
    border: none;
    color: #fff;
    width: 100%;
}

.search-box input:focus {
    outline: none;
}

.search-box i {
    color: var(--text-secondary);
    width: 18px;
}

.top-actions {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 0.6rem;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Content Rendering */
#content-area {
    padding: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.content-fade {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 80vh;
    padding: 2rem;
}

.welcome-badge {
    background: rgba(0, 120, 212, 0.1);
    color: var(--accent-blue);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 120, 212, 0.3);
}

.welcome-screen h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    max-width: 800px;
}

.welcome-screen p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    width: 100%;
    max-width: 600px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 16px;
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--accent-neon);
    margin-bottom: 0.5rem;
}

.stat-card p {
    margin: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.welcome-icon {
    width: 100px;
    height: 100px;
    background: var(--card-bg);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    color: var(--accent-neon);
}

.welcome-icon i {
    width: 48px;
    height: 48px;
}

/* Course Header */
.course-header {
    margin-bottom: 3rem;
}

.course-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.course-badge {
    background: var(--accent-blue);
    padding: 0.3rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Module Cards */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.module-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0, 120, 212, 0.1);
}

.module-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at top right, rgba(0, 242, 255, 0.1), transparent 70%);
}

.module-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-neon);
    margin-bottom: 1rem;
    display: block;
}

.module-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.topic-list {
    list-style: none;
}

.topic-item {
    display: flex;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding: 0.4rem;
    border-radius: 6px;
    transition: 0.2s;
    cursor: pointer;
}

.topic-item:hover {
    background: rgba(0, 120, 212, 0.1);
    color: var(--text-primary);
    transform: translateX(5px);
}

.topic-item i {
    width: 14px;
    height: 14px;
    margin-top: 3px;
    color: var(--accent-blue);
}

/* Reader Overlay Styling */
.reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 20, 0.8);
    backdrop-filter: blur(20px);
    z-index: 100;
    display: flex;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.reader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.05);
}

.reader-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    background: var(--bg-dark);
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
}

.reader-header {
    padding: 2rem 3rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 2rem;
}

.close-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 0.8rem;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    background: rgba(255, 0, 0, 0.1);
    border-color: rgba(255, 0, 0, 0.3);
}

.reader-info span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-neon);
    letter-spacing: 2px;
}

.reader-info h2 {
    font-size: 1.5rem;
}

.reader-body {
    flex: 1;
    overflow-y: auto;
    padding: 3rem;
    line-height: 1.8;
}

.reader-body h4 {
    color: var(--accent-neon);
    margin: 2rem 0 1rem;
    font-size: 1.25rem;
}

.reader-body p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.reader-body ul,
.reader-body ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.reader-body li {
    margin-bottom: 1rem;
}

.reader-body .highlight-box {
    background: rgba(0, 120, 212, 0.1);
    border-left: 4px solid var(--accent-blue);
    padding: 1.5rem;
    border-radius: 4px 12px 12px 4px;
    margin: 2rem 0;
}

.reader-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.reader-body pre {
    background: #0d1117;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--glass-border);
}

.reader-body code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--accent-neon);
}

.reader-body .cmd-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Footer Branding */
.footer-branding {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 280px;
    height: 30px;
    background: rgba(15, 20, 28, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    overflow: hidden;
    z-index: 2000;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.marquee-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
}

.marquee-text {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    color: var(--accent-neon);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: marquee-scroll 12s linear infinite;
    text-shadow: 0 0 8px rgba(0, 242, 255, 0.4);
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-230%);
    }
}

/* Quiz / Exam Styling Enhancements */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* Space between options */
    margin-top: 1.5rem;
}

.option-btn {
    width: 100%;
    text-align: left;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option-btn span {
    font-weight: 700;
    color: var(--accent-neon);
    font-family: monospace;
    /* Align letters nicely */
    font-size: 1.1rem;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    /* Slightly brighter on hover */
    border-color: var(--accent-blue);
    transform: translateX(6px);
    /* Interactive movement */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Feedback States */
.option-btn.correct {
    background: rgba(72, 187, 120, 0.15) !important;
    border-color: #48bb78 !important;
    color: #48bb78 !important;
    box-shadow: 0 0 15px rgba(72, 187, 120, 0.2);
}

.option-btn.wrong {
    background: rgba(245, 101, 101, 0.15) !important;
    border-color: #f56565 !important;
    color: #f56565 !important;
    opacity: 0.6;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 2rem;
    line-height: 1.5;
    color: #fff;
    border-left: 4px solid var(--accent-neon);
    padding-left: 1.5rem;
}

.quiz-footer {
    padding: 2rem 3rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    /* Align Next button to right */
    background: rgba(10, 14, 20, 0.3);
}

.primary-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    font-size: 1rem;
}

.primary-btn:hover {
    background: #0063b1;
    box-shadow: 0 0 15px rgba(0, 120, 212, 0.4);
}

/* --- Students Popup & Active Connections --- */
.students-popup {
    position: absolute;
    top: 60px;
    right: 10px;
    min-width: 320px;
    max-width: 380px;
    background: rgba(15, 20, 28, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    z-index: 500;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    flex-direction: column;
    gap: 0.75rem;
}

.students-popup-header {
    display: flex;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.connections-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.conn-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    transition: 0.2s;
}

.conn-item:hover {
    background: rgba(0, 120, 212, 0.08);
    border-color: var(--accent-blue);
}

.conn-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conn-flag {
    font-size: 1.2rem;
    line-height: 1;
}

.conn-ip {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.conn-local {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 400;
}

.conn-loc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.conn-ago {
    font-size: 0.7rem;
    color: var(--accent-neon);
    margin-top: 0.2rem;
    opacity: 0.7;
}

.conn-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 1.5rem 0;
}

.geo-warning {
    font-size: 0.72rem;
    color: #f0a020;
    background: rgba(240, 160, 32, 0.1);
    border: 1px solid rgba(240, 160, 32, 0.3);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    margin-top: 0.25rem;
}