/* note.css - Styles for CSIT Notes PDF Viewer */

.note-content {
	padding-top: 40px;
	padding-bottom: 80px;
	max-width: 850px;
	margin: 0 auto;
}

/* Coming Soon Card Styling */
.coming-soon-box {
	text-align: center;
	padding: 60px 20px;
	background-color: var(--surface-color) !important;
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	box-shadow: var(--shadow) !important;
}

.coming-soon-box h2 {
	font-size: clamp(1.5rem, 5vw, 2.2rem);
	color: var(--dark-blue);
	border-bottom: none !important;
	margin-top: 20px;
}

.coming-soon-box p {
	color: var(--text-muted);
	margin: 20px 0;
}

/* =============================
   NOTES VIEWER LAYOUT
   ============================= */
.notes-viewer-section {
	padding: 30px 0 60px;
}

.notes-layout {
	display: grid;
	grid-template-columns: 260px 1fr;
	gap: 24px;
	align-items: start;
}

/* =============================
   CHAPTER SIDEBAR
   ============================= */
.chapter-sidebar {
	background-color: var(--surface-color);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	position: sticky;
	top: 80px;
}

.sidebar-title {
	font-size: 1rem;
	font-weight: 700;
	padding: 16px 20px;
	color: var(--text-color);
	border-bottom: 1px solid var(--border-color);
	margin: 0;
}

.chapter-list {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: 65vh;
	overflow-y: auto;
}

.chapter-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 20px;
	text-decoration: none;
	color: var(--text-color);
	border-left: 3px solid transparent;
	transition:
		background-color 0.2s ease,
		border-color 0.2s ease,
		color 0.2s ease;
}

.chapter-link:hover {
	background-color: var(--light-gray);
	color: var(--primary-color);
}

.chapter-link.active {
	background-color: rgba(63, 174, 143, 0.08);
	border-left-color: var(--primary-color);
	color: var(--primary-color);
	font-weight: 600;
}

.ch-num {
	font-size: 0.8rem;
	font-weight: 600;
	white-space: nowrap;
	min-width: 38px;
	color: var(--text-muted);
}

.chapter-link.active .ch-num {
	color: var(--primary-color);
}

.ch-title {
	font-size: 0.9rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* =============================
   PDF VIEWER
   ============================= */
.pdf-viewer-container {
	background-color: var(--surface-color);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.pdf-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	background-color: var(--off-white);
	border-bottom: 1px solid var(--border-color);
	gap: 12px;
}

.pdf-chapter-title {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--text-color);
}

.pdf-status-badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	background: rgba(0, 0, 0, 0.06);
	color: var(--text-muted);
	white-space: nowrap;
}

.pdf-status-badge.loading {
	background: rgba(237, 138, 43, 0.14);
	color: #9c5c19;
}

.pdf-status-badge.ready {
	background: rgba(63, 174, 143, 0.14);
	color: #1f7058;
}

.pdf-status-badge.error {
	background: rgba(209, 49, 49, 0.14);
	color: #a12525;
}

.pdf-status-badge.pending {
	background: rgba(237, 138, 43, 0.14);
	color: #9c5c19;
}

.pdf-wrapper {
	position: relative;
	height: 80vh;
	min-height: 500px;
}

.pdf-frame {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* Overlay to block right-click download on the iframe area */
.pdf-overlay {
	position: absolute;
	top: 0;
	right: 0;
	width: 48px;
	height: 48px;
	z-index: 10;
	cursor: default;
}

/* =============================
   LOADING STATE
   ============================= */
.pdf-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 16px;
	color: var(--text-muted);
}

.spinner {
	width: 40px;
	height: 40px;
	border: 4px solid var(--border-color);
	border-top-color: var(--primary-color);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* =============================
   ERROR STATE
   ============================= */
.pdf-error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 12px;
	color: var(--text-muted);
	padding: 40px 20px;
	text-align: center;
}

.pdf-error svg {
	opacity: 0.5;
}

.pdf-error p {
	font-size: 1.05rem;
	max-width: 400px;
}

.pdf-error-title {
	margin: 0;
	font-size: 1.15rem;
	color: var(--text-color);
}

.pdf-error-hint {
	font-size: 0.92rem;
	color: var(--text-muted);
	max-width: 520px;
	margin: -2px 0 0;
}

.pdf-error-code {
	font-size: 0.8rem;
	letter-spacing: 0.02em;
	color: var(--text-muted);
	opacity: 0.9;
	margin-top: -2px;
}

.pdf-error-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: center;
	margin-top: 8px;
}

/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 900px) {
	.notes-layout {
		grid-template-columns: 1fr;
	}

	.chapter-sidebar {
		position: static;
	}

	.chapter-list {
		max-height: none;
		display: flex;
		overflow-x: auto;
		gap: 0;
	}

	.chapter-list li {
		flex-shrink: 0;
	}

	.chapter-link {
		flex-direction: column;
		gap: 2px;
		padding: 10px 16px;
		border-left: none;
		border-bottom: 3px solid transparent;
		white-space: nowrap;
		text-align: center;
	}

	.chapter-link.active {
		border-left-color: transparent;
		border-bottom-color: var(--primary-color);
	}

	.pdf-wrapper {
		height: 70vh;
		min-height: 400px;
	}
}

@media (max-width: 768px) {
	.cta-btns {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}
	.cta-btns .btn {
		width: 100%;
	}

	.pdf-wrapper {
		height: 60vh;
		min-height: 350px;
	}

	.pdf-error-actions {
		flex-direction: column;
		width: 100%;
	}

	.pdf-error-actions .btn {
		width: 100%;
	}
}
