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

:root {

	--primary: #0f766e;
	--primary-hover: #0d9488;
	--primary-soft: rgba(15, 118, 110, 0.08);

	--bg: #fafafa;
	--surface: #ffffff;
	--surface-alt: #f5f7f6;

	--text: #1a1a2e;
	--text-secondary: #586069;

	--border: #e1e4e8;

	--accent-blue: #2563eb;
	--accent-amber: #d97706;
	--accent-purple: #7c3aed;

	--hero-bg: linear-gradient(135deg, #0f172a 0%, #0f3433 50%, #134e4a 100%);
	--page-header-bg: var(--surface-alt);
	--page-header-text: var(--text);

	--sidebar-border: var(--border);
	--sidebar-link-active: var(--primary-soft);
	--sidebar-link-hover: var(--surface-alt);

	--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--font-mono: 'JetBrains Mono', 'Fira Code', monospace;

	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 20px;
	--space-6: 24px;
	--space-8: 32px;
	--space-10: 40px;
	--space-12: 48px;
	--space-16: 56px;
	--space-20: 64px;

	--container-width: 1160px;

	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 16px;
	--radius-full: 9999px;

	--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
	--shadow-md: 0 4px 12px rgba(0,0,0,0.07);
	--shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
	--shadow-card: 0 1px 3px rgba(0,0,0,0.03), 0 6px 16px rgba(0,0,0,0.05);
}

html.dark {
	--primary: #2dd4bf;
	--primary-hover: #5eead4;
	--primary-soft: rgba(45, 212, 191, 0.1);

	--bg: #0c1117;
	--surface: #161b22;
	--surface-alt: #1c2128;

	--text: #e6edf3;
	--text-secondary: #8b949e;

	--border: #30363d;

	--accent-blue: #58a6ff;
	--accent-amber: #f59e0b;
	--accent-purple: #a78bfa;

	--sidebar-border: #30363d;
	--sidebar-link-active: var(--primary-soft);
	--sidebar-link-hover: var(--surface-alt);

	--hero-bg: linear-gradient(135deg, #0c1117 0%, #0f2928 50%, #134e4a 100%);
	--page-header-bg: var(--surface);
	--page-header-text: var(--text);

	--shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
	--shadow-md: 0 4px 12px rgba(0,0,0,0.4);
	--shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
	--shadow-card: 0 1px 3px rgba(0,0,0,0.2), 0 6px 16px rgba(0,0,0,0.3);
}

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

html {
	scroll-behavior: smooth;
	font-size: 100%;
}

body {
	font-family: var(--font);
	line-height: 1.6;
	color: var(--text);
	background-color: var(--bg);
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

main {
	flex-grow: 1;
}

.container {
	max-width: var(--container-width);
	margin: 0 auto;
	padding: 0 var(--space-5);
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	color: var(--primary);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--primary-hover);
}

.header {
	background-color: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: var(--space-3) 0;
	z-index: 1000;
	transition: background-color 0.3s ease, border-color 0.3s ease;
	position: relative;
}

.navbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.logo {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	text-decoration: none;
	color: var(--text);
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.3px;
}

.logo:hover { color: var(--text); }

.logo img {
	height: 38px;
	width: auto;
}

.nav-menu {
	display: flex;
	align-items: center;
	gap: var(--space-6);
}

.nav-links {
	display: flex;
	list-style: none;
	gap: var(--space-1);
	align-items: center;
}

.nav-links a {
	text-decoration: none;
	color: var(--text-secondary);
	font-weight: 500;
	font-size: 0.9rem;
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-sm);
	transition: color 0.2s ease, background-color 0.2s ease;
	position: relative;
}

.nav-links a:hover {
	color: var(--primary);
	background-color: var(--primary-soft);
}

.nav-links a::after { display: none; }

.nav-links a[aria-current="page"],
.nav-links a.active {
	color: var(--primary);
	background-color: var(--primary-soft);
	font-weight: 600;
}

.btn-contribute {
	background-color: var(--primary) !important;
	color: #fff !important;
	padding: var(--space-2) var(--space-4) !important;
	border-radius: var(--radius-full) !important;
	font-weight: 600 !important;
	font-size: 0.85rem !important;
	transition: background-color 0.2s ease, transform 0.2s ease !important;
}

.btn-contribute:hover {
	background-color: var(--primary-hover) !important;
	transform: translateY(-1px) !important;
}

.nav-dropdown { position: relative; }

.dropdown-menu {
	position: absolute;
	top: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--surface);
	list-style: none;
	padding: var(--space-2);
	box-shadow: var(--shadow-lg);
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	min-width: 180px;
	display: none;
	z-index: 999;
}

.dropdown-menu a {
	display: block;
	padding: var(--space-2) var(--space-3);
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 0.88rem;
	border-radius: var(--radius-sm);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-menu a::before,
.dropdown-menu a::after { display: none; }

.dropdown-menu a:hover {
	background: var(--primary-soft);
	color: var(--primary);
}

.nav-dropdown:hover .dropdown-menu { display: block; }

.hamburger {
	display: none;
	cursor: pointer;
	background: none;
	border: none;
	padding: 8px;
	width: 40px;
	height: 40px;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-sm);
	transition: background-color 0.2s ease;
	z-index: 1100;
	position: relative;
}

.hamburger:hover {
	background-color: var(--surface-alt);
}

.hamburger .icon-close { display: none; }
.hamburger.active .icon-open { display: none; }
.hamburger.active .icon-close { display: block; }

.theme-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--surface-alt);
	border: 1px solid var(--border);
	border-radius: var(--radius-full);
	width: 36px;
	height: 36px;
	cursor: pointer;
	color: var(--text-secondary);
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.theme-toggle:hover {
	background-color: var(--primary-soft);
	border-color: var(--primary);
	color: var(--primary);
}

.theme-icon { width: 18px; height: 18px; }

.sun-icon { display: none; }
.moon-icon { display: block; }
html.dark .sun-icon { display: block; }
html.dark .moon-icon { display: none; }

.btn {
	padding: var(--space-3) var(--space-6);
	border-radius: var(--radius-md);
	font-weight: 600;
	font-size: 0.9rem;
	border: 1.5px solid transparent;
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	line-height: 1.4;
	font-family: var(--font);
}

.btn-primary {
	background-color: var(--primary);
	color: #ffffff !important;
}

.btn-primary:hover {
	background-color: var(--primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 14px rgba(15, 118, 110, 0.25);
}

.btn-secondary {
	background: transparent;
	color: var(--primary);
	border-color: var(--primary);
}

.btn-secondary:hover {
	background-color: var(--primary);
	color: #ffffff;
}

.btn-ghost {
	background: transparent;
	color: var(--text-secondary);
	border-color: var(--border);
}

.btn-ghost:hover {
	border-color: var(--primary);
	color: var(--primary);
	background-color: var(--primary-soft);
}

.btn-sm {
	padding: var(--space-2) var(--space-4);
	font-size: 0.82rem;
}

.page-header {
	background-color: var(--page-header-bg);
	color: var(--page-header-text);
	padding: var(--space-6) var(--space-5);
	border-bottom: 1px solid var(--border);
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.page-header h1 {
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.5px;
}

.page-header p {
	color: var(--text-secondary);
	margin-top: var(--space-2);
	font-size: 0.95rem;
}

.breadcrumbs {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-3) 0;
	font-size: 0.85rem;
	color: var(--text-secondary);
	flex-wrap: wrap;
}

.breadcrumbs a {
	color: var(--text-secondary);
	text-decoration: none;
	transition: color 0.2s ease;
}

.breadcrumbs a:hover { color: var(--primary); }

.breadcrumbs .separator {
	color: var(--border);
	font-size: 0.75rem;
}

.breadcrumbs .current {
	color: var(--text);
	font-weight: 500;
}

.subject-nav-section {
	background-color: var(--surface);
	padding: var(--space-3) 0;
	border-bottom: 1px solid var(--border);
	transition: background-color 0.3s ease, border-color 0.3s ease;
}

.subject-nav {
	display: flex;
	justify-content: center;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.subject-nav .btn {
	padding: var(--space-3) var(--space-8);
	font-size: 0.95rem;
	border-radius: var(--radius-full);
	font-weight: 600;
}

.section-title {
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 800;
	color: var(--text);
	letter-spacing: -0.5px;
	margin-bottom: var(--space-4);
}

.section-subtitle {
	color: var(--text-secondary);
	font-size: 1.05rem;
	max-width: 640px;
}

.footer {
	background-color: #1a1f2e;
	color: #c8cdd5;
	padding: var(--space-10) 0 0;
	margin-top: auto;
}

.footer-grid {
	display: grid;
	grid-template-columns: 1.5fr 1fr 1.2fr 1.2fr;
	gap: var(--space-8);
	padding-bottom: var(--space-8);
}

.footer-column {
	display: flex;
	flex-direction: column;
}

.footer .logo {
	color: #fff;
	margin-bottom: var(--space-3);
	font-size: 1.1rem;
}

.footer .logo:hover { color: #fff; }

.footer-heading {
	color: #fff;
	font-size: 0.85rem;
	font-weight: 700;
	margin-bottom: var(--space-4);
	text-transform: uppercase;
	letter-spacing: 1px;
}

.footer-heading::after { display: none; }

.footer-about {
	color: #8b95a5;
	line-height: 1.6;
	font-size: 0.88rem;
	margin-bottom: var(--space-4);
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: var(--space-2); }

.list-2-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 var(--space-4);
}

.footer-links a {
	color: #8b95a5;
	text-decoration: none;
	font-size: 0.9rem;
	transition: color 0.2s ease;
}

.footer-links a:hover {
	color: var(--primary);
}

.social-icons {
	display: flex;
	gap: var(--space-3);
}

.social-icons a {
	width: 36px;
	height: 36px;
	border-radius: var(--radius-full);
	background-color: rgba(255,255,255,0.05);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	border: 1px solid rgba(255,255,255,0.05);
}

.social-icons a:hover {
	background-color: rgba(45, 212, 191, 0.1);
	border-color: var(--primary);
	transform: translateY(-2px);
}

.social-icons a img {
	width: 16px;
	height: 16px;
	filter: brightness(0) invert(0.7);
	transition: filter 0.2s ease;
}

.social-icons a:hover img {
	filter: brightness(0) invert(1);
}

.footer-bottom {
	border-top: 1px solid rgba(255,255,255,0.08);
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--space-5) 0;
	font-size: 0.85rem;
	color: #6b7585;
}

.footer-legal-links {
	display: flex;
	align-items: center;
}

.footer-legal-links a {
	color: #6b7585;
	text-decoration: none;
	transition: color 0.2s ease;
}

.footer-legal-links a:hover {
	color: var(--primary);
}

.footer-dot {
	margin: 0 var(--space-2);
	opacity: 0.5;
}

body,
.header,
.footer,
.semester-card,
.subject-card,
.chapter-card,
.year-sidebar,
.main-content-area,
.dropdown-menu,
.nav-menu,
.page-header,
.exam-paper,
.exam-instructions,
.answer,
.question-number {
	transition:
		background-color 0.3s ease,
		color 0.3s ease,
		border-color 0.3s ease;
}

.form-group {
	margin-bottom: var(--space-5);
}

.form-group label {
	display: block;
	font-weight: 600;
	font-size: 0.88rem;
	color: var(--text);
	margin-bottom: var(--space-2);
}

.form-group input,
.form-group textarea,
.form-group select {
	width: 100%;
	padding: var(--space-3) var(--space-4);
	border: 1.5px solid var(--border);
	border-radius: var(--radius-md);
	font-family: var(--font);
	font-size: 0.9rem;
	color: var(--text);
	background-color: var(--surface);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-group textarea {
	resize: vertical;
	min-height: 120px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
	color: var(--text-secondary);
	opacity: 0.6;
}

.nav-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 1090;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.nav-backdrop.active {
	opacity: 1;
	pointer-events: auto;
}

html.dark .nav-backdrop {
	background: rgba(0, 0, 0, 0.7);
}

.mobile-nav-drawer {
	position: fixed;
	top: 0;
	right: 0;
	width: 300px;
	max-width: 88vw;
	height: 100dvh;
	height: 100vh; 
	background-color: var(--surface);
	z-index: 1100;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
	box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
	overflow: hidden;
	visibility: hidden;
}

.mobile-nav-drawer.active {
	transform: translateX(0);
	visibility: visible;
}

html.dark .mobile-nav-drawer {
	box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
}

.mobile-nav-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-4) var(--space-5);
	border-bottom: 1px solid var(--border);
	min-height: 64px;
	flex-shrink: 0;
	transition: border-color 0.3s ease;
}

.mobile-nav-logo {
	gap: var(--space-2);
	font-size: 1rem;
}

.mobile-nav-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: var(--surface-alt);
	border: 1px solid var(--border);
	border-radius: var(--radius-full);
	cursor: pointer;
	color: var(--text-secondary);
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.mobile-nav-close:hover {
	background-color: var(--primary-soft);
	border-color: var(--primary);
	color: var(--primary);
	transform: rotate(90deg);
}

.mobile-nav-body {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-4) var(--space-5);
	-webkit-overflow-scrolling: touch;
}

.mobile-nav-section {
	margin-bottom: var(--space-4);
}

.mobile-nav-label {
	display: block;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1.2px;
	color: var(--text-secondary);
	margin-bottom: var(--space-2);
	padding: 0 var(--space-2);
	opacity: 0.7;
}

.mobile-nav-links {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.mobile-nav-link {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	width: 100%;
	padding: 13px var(--space-3);
	min-height: 48px;
	border-radius: var(--radius-md);
	color: var(--text);
	font-size: 0.95rem;
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
	cursor: pointer;
	background: none;
	border: none;
	text-align: left;
	font-family: var(--font);
	line-height: 1;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus-visible {
	background-color: var(--primary-soft);
	color: var(--primary);
	outline: none;
}

.mobile-nav-link svg:first-child {
	flex-shrink: 0;
	opacity: 0.65;
	transition: opacity 0.15s ease;
}

.mobile-nav-link:hover svg:first-child {
	opacity: 1;
}

.mobile-nav-link.active,
.mobile-nav-link[aria-current="page"] {
	background-color: var(--primary-soft);
	color: var(--primary);
	font-weight: 600;
}

.mobile-nav-dropdown .mobile-chevron {
	margin-left: auto;
	transition: transform 0.25s ease;
	opacity: 0.5;
}

.mobile-nav-dropdown.open > .mobile-dropdown-toggle .mobile-chevron {
	transform: rotate(180deg);
	opacity: 1;
}

.mobile-semester-grid {
	list-style: none;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-2);
	padding: var(--space-3) var(--space-2);
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.25s ease;
	opacity: 0;
}

.mobile-nav-dropdown.open .mobile-semester-grid {
	max-height: 300px;
	opacity: 1;
}

.mobile-semester-grid a {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px var(--space-2);
	min-height: 44px;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	color: var(--text-secondary);
	font-size: 0.85rem;
	font-weight: 500;
	text-align: center;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.mobile-semester-grid a:hover {
	background-color: var(--primary-soft);
	border-color: var(--primary);
	color: var(--primary);
}

.mobile-nav-divider {
	height: 1px;
	background-color: var(--border);
	margin: var(--space-2) 0;
	opacity: 0.6;
	transition: background-color 0.3s ease;
}

.mobile-nav-topbar {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3) var(--space-5);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
	transition: border-color 0.3s ease;
}

.mobile-cta-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	flex: 1;
	padding: 12px var(--space-4);
	min-height: 44px;
	border-radius: var(--radius-full);
	background-color: var(--primary);
	color: #fff !important;
	font-weight: 700;
	font-size: 0.88rem;
	text-decoration: none;
	transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 4px 14px rgba(15, 118, 110, 0.25);
}

.mobile-cta-btn:hover {
	background-color: var(--primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(15, 118, 110, 0.4);
}

html.dark .mobile-cta-btn {
	box-shadow: 0 4px 14px rgba(45, 212, 191, 0.2);
}

html.dark .mobile-cta-btn:hover {
	box-shadow: 0 6px 18px rgba(45, 212, 191, 0.3);
}

.mobile-theme-btn {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
}

.mobile-nav-theme-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 4px var(--space-3);
	min-height: 48px;
	border-radius: var(--radius-md);
}

.mobile-theme-label {
	font-size: 0.95rem;
	font-weight: 500;
	color: var(--text);
}

@media (max-width: 768px) {
	.hamburger { display: flex; }

	.nav-menu {
		display: none;
	}

	.page-header {
		padding: var(--space-6) var(--space-4);
	}

	.page-header h1 { font-size: 1.5rem; }

	.subject-nav {
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: var(--space-2);
		-webkit-overflow-scrolling: touch;
		padding-bottom: var(--space-2);
	}

	.subject-nav .btn {
		white-space: nowrap;
		flex-shrink: 0;
		padding: var(--space-2) var(--space-4);
		font-size: 0.82rem;
	}
}

@media (min-width: 769px) {
	.mobile-nav-drawer,
	.nav-backdrop {
		display: none !important;
	}
}

@media (max-width: 900px) {
	.footer-grid {
		grid-template-columns: 1fr 1fr;
		gap: var(--space-8);
	}
}

@media (max-width: 480px) {
	.footer-grid {
		grid-template-columns: 1fr 1fr;
		gap: var(--space-6) var(--space-4);
	}

	.footer-column:nth-child(1) {
		display: none; 
	}

	.footer-column:nth-child(2) {
		grid-column: 1;
		grid-row: 1;
	}

	.footer-column:nth-child(4) {
		grid-column: 2;
		grid-row: 1;
	}

	.footer-column:nth-child(3) {
		grid-column: span 2;
		grid-row: 2;
	}

	.footer-about { display: none; }
	.connect-subtitle { display: none; }

	.list-2-col {
		grid-template-columns: 1fr 1fr; 
	}

	.footer-bottom {
		flex-direction: column;
		gap: var(--space-2);
		text-align: center;
		font-size: 0.75rem;
		padding: var(--space-4) 0;
	}

	.container { padding: 0 var(--space-4); }
}

.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }

/* Pagination Utilities */
.pagination-container {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 24px;
}

.pagination-link {
	min-width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-md);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s;
	text-decoration: none !important;
}

.pagination-link:hover {
	border-color: var(--primary);
	color: var(--primary);
	background: var(--primary-soft);
}

.pagination-link.active {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff !important;
}

.pagination-link.disabled {
	opacity: 0.5;
	pointer-events: none;
	background: var(--surface-alt);
}
