/* ── Nest LMS Gradebook styles ──────────────────────────────────────────── */

/* ── Course selector ────────────────────────────────────────────────────── */
.nest-gb-course-selector {
	margin-bottom: 1.5rem;
	display: flex;
	align-items: center;
	gap: 10px;
}

.nest-gb-course-selector select {
	padding: 6px 10px;
	font-size: 1rem;
	border: 1px solid #ccc;
	border-radius: 4px;
}

/* ── Settings / categories panels ───────────────────────────────────────── */
.nest-gb-settings-wrap,
.nest-gb-categories-wrap {
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	margin-bottom: 1.25rem;
}

.nest-gb-settings-wrap summary,
.nest-gb-categories-wrap summary {
	padding: 10px 14px;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
}

.nest-gb-settings-inner,
.nest-gb-categories-inner {
	padding: 14px 16px;
	border-top: 1px solid #e0e0e0;
}

.nest-gb-setting-group {
	margin-bottom: 1rem;
}

.nest-gb-setting-group h4 {
	margin: 0 0 6px;
	font-size: 0.9em;
	font-weight: 600;
}

/* ── Letter scale rows ──────────────────────────────────────────────────── */
.nest-gb-scale-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}

.nest-gb-remove-scale-row,
.nest-gb-remove-cat {
	color: #c00;
	text-decoration: none;
	font-size: 0.85em;
}

/* ── Category rows ──────────────────────────────────────────────────────── */
.nest-gb-category-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.nest-gb-cat-name {
	flex: 1;
	padding: 5px 8px;
	border: 1px solid #ccc;
	border-radius: 4px;
}

.nest-gb-cat-weight {
	width: 60px;
	padding: 5px 8px;
	border: 1px solid #ccc;
	border-radius: 4px;
}

/* ── Grade table ────────────────────────────────────────────────────────── */
.nest-gb-table-wrap {
	overflow-x: auto;
	margin-top: 1.5rem;
}

.nest-gb-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
	min-width: 600px;
}

.nest-gb-table th,
.nest-gb-table td {
	padding: 8px 10px;
	border: 1px solid #e0e0e0;
	text-align: left;
	vertical-align: middle;
}

.nest-gb-table th {
	background: #f8f8f8;
	font-weight: 600;
	white-space: nowrap;
}

.nest-gb-item-col {
	text-align: center;
}

.nest-gb-item-title {
	display: block;
	font-size: 0.85em;
}

.nest-gb-item-max {
	display: block;
	font-size: 0.75em;
	color: #888;
}

.nest-gb-overall-col {
	font-weight: 600;
	text-align: center;
	white-space: nowrap;
}

/* ── Grade cells ────────────────────────────────────────────────────────── */
.nest-gb-grade-cell {
	text-align: center;
	position: relative;
}

.nest-gb-grade-cell:hover .nest-gb-cell-actions {
	opacity: 1;
}

.nest-gb-cell-actions {
	opacity: 0;
	transition: opacity 0.15s;
	display: flex;
	gap: 4px;
	justify-content: center;
	margin-top: 4px;
}

.nest-gb-grade-btn,
.nest-gb-submission-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 1em;
	padding: 2px 4px;
	opacity: 0.7;
}

.nest-gb-grade-btn:hover,
.nest-gb-submission-btn:hover {
	opacity: 1;
}

.nest-gb-pending-badge {
	display: inline-block;
	background: #f59e0b;
	color: #fff;
	font-size: 0.7em;
	padding: 1px 5px;
	border-radius: 3px;
	margin-left: 4px;
}

/* ── Status colours ─────────────────────────────────────────────────────── */
.nest-gb-status-pending    { background: #fffbeb; }
.nest-gb-status-excused    { background: #f3f4f6; color: #6b7280; }
.nest-gb-status-unsubmitted { color: #9ca3af; }
.nest-gb-focused           { background: #eff6ff; }
.nest-gb-passing           { color: #16a34a; }
.nest-gb-failing           { color: #dc2626; }

/* ── Pending table on teacher dashboard ─────────────────────────────────── */
.nest-gb-pending-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}

.nest-gb-pending-table th,
.nest-gb-pending-table td {
	padding: 8px 10px;
	border-bottom: 1px solid #e0e0e0;
	text-align: left;
}

.nest-gb-pending-table th {
	font-weight: 600;
}

/* ── Student grades view ────────────────────────────────────────────────── */
.nest-gb-student-grades {
	max-width: none;
	margin-right: auto;
	margin-left: auto;
}

.nest-gb-course-block {
	margin-bottom: 2.5rem;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
}

.nest-gb-course-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 14px 16px;
	background: #f8f8f8;
	border-bottom: 1px solid #e0e0e0;
}

.nest-gb-course-header h3 {
	margin: 0;
	font-size: 1.1em;
}

.nest-gb-overall-grade {
	font-size: 1.4em;
	font-weight: 700;
	margin-right: 8px;
}

.nest-gb-status-badge {
	font-size: 0.8em;
	padding: 2px 8px;
	border-radius: 4px;
	background: #e0e0e0;
}

.nest-gb-status-badge.nest-gb-passing { background: #dcfce7; }
.nest-gb-status-badge.nest-gb-failing  { background: #fee2e2; }

.nest-gb-category-block {
	padding: 0 16px 16px;
}

.nest-gb-category-name {
	margin: 14px 0 8px;
	font-size: 0.95em;
	display: flex;
	gap: 8px;
	align-items: baseline;
}

.nest-gb-category-weight {
	font-size: 0.8em;
	color: #888;
	font-weight: normal;
}

.nest-gb-student-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}

.nest-gb-student-table th,
.nest-gb-student-table td {
	padding: 7px 10px;
	border-bottom: 1px solid #f0f0f0;
	text-align: left;
}

.nest-gb-student-table th {
	font-weight: 600;
	color: #555;
	font-size: 0.85em;
}

.nest-gb-feedback-col {
	font-size: 0.85em;
	color: #555;
	max-width: 200px;
}

.nest-gb-threshold-note {
	font-size: 0.75em;
	color: #888;
	margin-left: 6px;
}

.nest-gb-status-label {
	font-size: 0.8em;
	padding: 2px 6px;
	border-radius: 3px;
	background: #f3f4f6;
}

.nest-gb-status-label.nest-gb-status-graded,
.nest-gb-status-label.nest-gb-status-auto { background: #dcfce7; color: #15803d; }
.nest-gb-status-label.nest-gb-status-pending     { background: #fef9c3; color: #854d0e; }
.nest-gb-status-label.nest-gb-status-excused     { background: #f3f4f6; color: #6b7280; }
.nest-gb-status-label.nest-gb-status-unsubmitted { background: #fef2f2; color: #991b1b; }

/* ── Lesson grade widget (after_lesson_content) ──────────────────────────── */
.nest-gb-lesson-grade {
	margin-top: 1.5rem;
	padding: 12px 16px;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	background: #fafafa;
}

.nest-gb-grade-score,
.nest-gb-grade-pending,
.nest-gb-grade-excused {
	margin: 0 0 6px;
}

.nest-gb-grade-pending { color: #92400e; }
.nest-gb-grade-excused  { color: #6b7280; }

.nest-gb-feedback {
	margin-top: 8px;
	font-size: 0.9em;
}

/* ── Submission detail modal ─────────────────────────────────────────────── */
.nest-gb-sub-modal-content {
	max-width: 700px;
}

#nest-gb-grade-modal.nest-modal,
#nest-gb-submission-modal.nest-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(17, 24, 39, 0.55);
}

#nest-gb-grade-modal .nest-modal-content,
#nest-gb-submission-modal .nest-modal-content {
	position: relative;
	width: min(640px, calc(100vw - 48px));
	max-height: min(760px, calc(100vh - 64px));
	overflow: auto;
	padding: 28px;
	border: 1px solid var(--nest-gb-border, #e0e0e0);
	border-radius: 8px;
	background: #fff;
	color: var(--nest-gb-text, #1f2937);
	box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

#nest-gb-submission-modal .nest-gb-sub-modal-content {
	width: min(720px, calc(100vw - 48px));
}

#nest-gb-grade-modal .nest-modal-content h2,
#nest-gb-submission-modal .nest-modal-content h2 {
	margin-top: 0;
}

#nest-gb-grade-modal .nest-close,
#nest-gb-submission-modal .nest-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	color: var(--nest-gb-text, #1f2937);
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
}

#nest-gb-grade-modal .nest-close:hover,
#nest-gb-submission-modal .nest-close:hover {
	border-color: var(--nest-gb-border, #e0e0e0);
	background: var(--nest-gb-soft, #f8f8f8);
}

#nest-gb-grade-modal .nest-field,
#nest-gb-submission-modal .nest-field {
	margin-bottom: 14px;
}

#nest-gb-grade-modal label,
#nest-gb-submission-modal label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
}

#nest-gb-grade-modal input[type="number"],
#nest-gb-grade-modal textarea,
#nest-gb-submission-modal input[type="number"],
#nest-gb-submission-modal textarea {
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--nest-gb-border, #d1d5db);
	border-radius: 4px;
	padding: 8px 10px;
	font: inherit;
}

#nest-gb-grade-modal input[type="checkbox"],
#nest-gb-submission-modal input[type="checkbox"] {
	width: auto;
	margin-right: 6px;
}

#nest-gb-grade-modal label:has(input[type="checkbox"]),
#nest-gb-submission-modal label:has(input[type="checkbox"]) {
	display: flex;
	align-items: center;
	font-weight: 400;
}

:root {
	--nest-gb-page-width: min(1120px, calc(100vw - 96px));
	--nest-gb-border: var(--wp--preset--color--contrast-3, #e0e0e0);
	--nest-gb-soft: var(--wp--preset--color--base-2, #f8f8f8);
	--nest-gb-primary: var(--wp--preset--color--primary, #2563eb);
	--nest-gb-muted: #666;
	--nest-gb-text: var(--wp--preset--color--contrast, #1f2937);
}

.nest-gb-page .entry-content,
.nest-gb-page .wp-block-post-content,
.nest-gb-page main .wp-block-group,
.nest-gb-page main .wp-block-group__inner-container {
	max-width: none;
}

.nest-gb-wrap,
.nest-gb-student-grades {
	box-sizing: border-box;
	width: var(--nest-gb-page-width);
	max-width: none;
	margin-right: auto;
	margin-left: auto;
	color: var(--nest-gb-text);
}

.nest-gb-wrap *,
.nest-gb-student-grades * {
	box-sizing: border-box;
}

@media (max-width: 700px) {
	:root {
		--nest-gb-page-width: calc(100vw - 32px);
	}
}
