/* Reset & Base */
*,
*::before,
*::after {
	box-sizing: border-box;
}
body {
	margin: 0;
	font-family: 'Segoe UI', system-ui, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: #333;
	background: #f5f5f5;
}
h1,
h2,
h3 {
	margin: 0 0 0.5em;
}
label {
	display: block;
	margin-bottom: 0.25em;
	font-weight: 500;
}
input,
select,
textarea {
	font-size: 1rem;
	padding: 0.5em 0.75em;
	border: 1px solid #ccc;
	border-radius: 4px;
	width: 100%;
}
input:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: #0066cc;
}
input.error,
select.error,
textarea.error {
	border-color: #c00;
}
.error-msg {
	color: #c00;
	font-size: 0.875em;
	margin-top: 0.25em;
}
button {
	cursor: pointer;
	padding: 0.6em 1.2em;
	font-size: 1rem;
	border-radius: 4px;
	border: none;
}
.btn-primary {
	background: #0066cc;
	color: #fff;
}
.btn-primary:hover {
	background: #0052a3;
}
.btn-secondary {
	background: #6c757d;
	color: #fff;
}
.btn-secondary:hover {
	background: #5a6268;
}
.btn-outline {
	background: transparent;
	border: 1px solid #0066cc;
	color: #0066cc;
}
.btn-outline:hover {
	background: #e6f0ff;
}

/* Layout */
.container {
	max-width: 720px;
	margin: 0 auto;
	padding: 1.5rem;
}
.section {
	background: #fff;
	border-radius: 8px;
	padding: 1.5rem;
	margin-bottom: 1.5rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.section-title {
	font-size: 1.125rem;
	color: #0066cc;
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid #0066cc;
}
.form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	margin-bottom: 1rem;
}
.form-row.full {
	grid-template-columns: 1fr;
}
.form-group {
	margin-bottom: 1rem;
}
.form-group label {
	margin-bottom: 0.35em;
}

/* Toast */
.toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	padding: 1rem 1.5rem;
	border-radius: 8px;
	color: #fff;
	z-index: 9999;
	max-width: 360px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.toast.success {
	background: #28a745;
}
.toast.error {
	background: #dc3545;
}
.toast.warning {
	background: #ffc107;
	color: #333;
}

/* Modal */
.modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 1000;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}
.modal-overlay.active {
	display: flex;
}
.modal {
	background: #fff;
	border-radius: 12px;
	max-width: 560px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
}
.modal-header {
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid #eee;
	font-weight: 600;
	font-size: 1.125rem;
}
.modal-body {
	padding: 1.5rem;
}
.modal-footer {
	padding: 1rem 1.5rem;
	border-top: 1px solid #eee;
	display: flex;
	gap: 0.75rem;
	justify-content: flex-end;
}
.preview-item {
	margin-bottom: 0.75rem;
}
.preview-item strong {
	display: inline-block;
	min-width: 140px;
	color: #555;
}

/* Major rows */
.major-row {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	margin-bottom: 0.75rem;
}
.major-row select {
	flex: 1;
}
.major-row .btn-remove {
	padding: 0.4em 0.6em;
	background: #dc3545;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 1.2em;
	line-height: 1;
}
.major-row .btn-remove:hover {
	background: #c82333;
}
#major-list .major-row:first-child .btn-remove {
	display: none;
}

/* Grades section */
.grades-subtitle {
	font-size: 0.9em;
	color: #555;
	margin: -0.5em 0 0.5em;
}
.grades-period {
	font-size: 1rem;
	color: #0066cc;
	margin: 1.25rem 0 0.75rem;
	padding-bottom: 0.25rem;
}
.grades-subject-group {
	margin-bottom: 1rem;
}
.grades-subject-group h4 {
	font-size: 0.9rem;
	color: #555;
	margin: 0 0 0.5rem;
	font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
	.form-row {
		grid-template-columns: 1fr;
	}
	.container {
		padding: 1rem;
	}
	.section {
		padding: 1rem;
	}
}
