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

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

.nest-student-management,
.nest-enrollment-wrapper,
.nest-student-dashboard,
.nest-student-profile {
	box-sizing: border-box;
	width: var(--nest-sm-page-width);
	max-width: none;
	margin-right: auto;
	margin-left: auto;
	color: var(--nest-sm-text);
}

.nest-student-management *,
.nest-enrollment-wrapper *,
.nest-student-dashboard *,
.nest-student-profile *,
.nest-modal * {
	box-sizing: border-box;
}

.nest-sm-header {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.5rem;
}

.nest-sm-limit-info {
	margin: 0;
	color: var(--nest-sm-muted);
	font-size: 0.9em;
}

.nest-sm-limit-reached {
	color: #c00;
	font-weight: 600;
}

/* Buttons */
.nest-button {
	display: inline-block;
	padding: 7px 14px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #f8f8f8;
	color: inherit;
	cursor: pointer;
	font-size: 0.9em;
	text-decoration: none;
}

.nest-button:hover {
	background: #eee;
}

.nest-button-primary {
	border-color: var(--nest-sm-primary);
	background: var(--nest-sm-primary);
	color: #fff;
}

.nest-button-primary:hover {
	background: var(--nest-sm-primary-hover);
	color: #fff;
}

/* Tables */
.nest-sm-table {
	width: 100%;
	margin-bottom: 2rem;
	border-collapse: collapse;
}

.nest-sm-table th,
.nest-sm-table td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--nest-sm-border);
	text-align: left;
	vertical-align: middle;
}

.nest-sm-table th {
	background: var(--nest-sm-soft);
	font-weight: 600;
}

.nest-sm-table td.nest-sm-actions {
	display: table-cell;
	white-space: nowrap;
}

.nest-sm-archived {
	opacity: 0.75;
}

/* Action icons */
.nest-sm-actions {
	text-align: left;
}

.nest-sm-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-right: 8px;
	color: inherit;
	text-decoration: none;
	opacity: 0.7;
	transition: opacity 0.15s;
}

.nest-sm-action:hover {
	opacity: 1;
}

.nest-sm-action .dashicons {
	width: 18px;
	height: 18px;
	font-size: 18px;
}

/* Modals */
.nest-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, 0.5);
}

.nest-modal-content {
	position: relative;
	width: min(92vw, 720px);
	max-height: 90vh;
	overflow-y: auto;
	padding: 28px;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 20px 35px rgba(0, 0, 0, 0.18);
}

.nest-close {
	position: absolute;
	top: 12px;
	right: 14px;
	border: 0;
	background: none;
	cursor: pointer;
	font-size: 1.5rem;
	line-height: 1;
}

.nest-modal-content h2 {
	margin-top: 0;
}

/* Enrollment status */
.nest-enrollment-status {
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.875em;
}

.nest-enrollment-status.enrolled {
	background: #d4edda;
	color: #155724;
}

.nest-enrollment-status.not-enrolled {
	background: #f8f9fa;
	color: #6c757d;
}

.nest-enrolled-status {
	margin: 0.5rem 0;
	font-size: 0.9em;
}

/* Avatars */
.nest-sm-avatar {
	display: inline-block;
	margin-right: 8px;
	border-radius: 50%;
	object-fit: cover;
	vertical-align: middle;
}

.nest-sm-edit-avatar-wrap {
	display: flex;
	gap: 16px;
	align-items: center;
	margin-bottom: 1.25rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--nest-sm-border);
}

.nest-sm-edit-avatar-upload {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.nest-sm-edit-picture-msg {
	color: var(--nest-sm-muted);
	font-size: 0.85em;
}

/* Student profile page */
.nest-profile-header {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
	align-items: flex-start;
	margin-bottom: 2rem;
}

.nest-profile-avatar-wrap {
	display: flex;
	flex-shrink: 0;
	flex-direction: column;
	gap: 8px;
	align-items: center;
}

.nest-profile-avatar {
	width: 120px;
	height: 120px;
	border-radius: 50%;
	object-fit: cover;
}

.nest-avatar-upload-label {
	cursor: pointer;
	font-size: 0.85em;
	text-align: center;
}

.nest-profile-picture-msg {
	min-height: 1em;
	margin: 0;
	color: var(--nest-sm-muted);
	font-size: 0.8em;
	text-align: center;
}

.nest-profile-info {
	flex: 1;
	min-width: 200px;
}

.nest-profile-displayname {
	margin: 0 0 4px;
	font-size: 1.5em;
}

.nest-profile-username {
	margin: 0 0 1rem;
	color: var(--nest-sm-muted);
	font-size: 0.9em;
}

.nest-profile-edit-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: flex-end;
}

.nest-profile-edit-form .nest-field {
	flex: 1;
	min-width: 150px;
	margin-bottom: 0;
}

.nest-profile-nickname-msg {
	display: block;
	width: 100%;
	color: green;
	font-size: 0.85em;
}

/* Enrolled courses grid */
.nest-course-grid {
	display: grid;
	gap: 20px;
	margin: 1rem 0;
}

.nest-cols-1 { grid-template-columns: 1fr; }
.nest-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nest-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nest-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.nest-course-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--nest-sm-border);
	border-radius: 8px;
}

.nest-course-card-image img {
	display: block;
	width: 100%;
	height: 160px;
	object-fit: cover;
}

.nest-course-card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px 16px;
}

.nest-course-card-title {
	margin: 0;
	font-size: 1.05em;
}

.nest-course-card-title a {
	text-decoration: none;
}

.nest-course-card-instructor {
	margin: 0;
	color: var(--nest-sm-muted);
	font-size: 0.85em;
}

/* Progress bar */
.nest-progress-wrap {
	height: 6px;
	margin-top: auto;
	overflow: hidden;
	border-radius: 3px;
	background: var(--nest-sm-border);
}

.nest-progress-bar {
	height: 100%;
	border-radius: 3px;
	background: var(--nest-sm-primary);
	transition: width 0.3s ease;
}

.nest-progress-label {
	margin: 0;
	color: var(--nest-sm-muted);
	font-size: 0.8em;
}

.nest-no-courses {
	color: var(--nest-sm-muted);
	font-style: italic;
}

/* Student dashboard */
.nest-dashboard-header {
	display: flex;
	gap: 16px;
	align-items: center;
	margin-bottom: 2rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--nest-sm-border);
}

.nest-dashboard-avatar-img {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
}

.nest-dashboard-greeting h2 {
	margin: 0;
	font-size: 1.4em;
}

.nest-dashboard-panel {
	margin-bottom: 2.5rem;
}

.nest-dashboard-panel-title {
	margin: 0 0 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--nest-sm-border);
	font-size: 1.1em;
	font-weight: 600;
}

/* Form fields */
.nest-field {
	margin-bottom: 1rem;
}

.nest-field label {
	display: block;
	margin-bottom: 4px;
	font-weight: 600;
}

.nest-field input[type="text"],
.nest-field input[type="email"],
.nest-field input[type="password"],
.nest-field select {
	width: 100%;
	max-width: 440px;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 1rem;
}

.nest-modal .nest-field input[type="text"],
.nest-modal .nest-field input[type="email"],
.nest-modal .nest-field input[type="password"],
.nest-modal .nest-field select {
	max-width: 100%;
}

.nest-field .description {
	margin: 4px 0 0;
	color: var(--nest-sm-muted);
	font-size: 0.85em;
}

.nest-field .required,
.required {
	color: #c00;
}

.nest-inline-label {
	display: inline-flex;
	gap: 6px;
	align-items: center;
	margin-top: 6px;
	font-size: 0.9em;
	font-weight: normal;
}

.nest-sm-username-display {
	margin: 0;
	font-family: monospace;
	font-size: 1.1em;
}

.nest-sm-message {
	min-height: 1.5em;
	margin: 0.75rem 0;
}

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

	.nest-sm-table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}

	.nest-cols-2,
	.nest-cols-3,
	.nest-cols-4 {
		grid-template-columns: 1fr;
	}

	.nest-modal {
		padding: 12px;
	}

	.nest-modal-content {
		width: 100%;
		padding: 22px;
	}
}
