/*
 * Aptitude Test — front-end styles
 */

.apt-wrapper {
	--apt-primary: #046BD2;
	--apt-primary-dark: #03539f;
	--apt-success: #28A745;
	--apt-danger: #DC3545;
	--apt-bg: #FFFFFF;
	--apt-border: #E1E6EC;
	--apt-text: #1F2933;
	--apt-muted: #6B7684;

	max-width: 560px;
	margin: 2rem auto;
	position: relative;
	overflow: hidden;
	background: var(--apt-bg);
	border: 1px solid var(--apt-border);
	border-radius: 18px;
	padding: 2.25rem 2.25rem 2rem;
	box-shadow: 0 18px 50px rgba(4, 107, 210, 0.12), 0 2px 6px rgba(15, 30, 50, 0.05);
	color: var(--apt-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
}

.apt-wrapper::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: linear-gradient(90deg, #046BD2 0%, #3d8be6 50%, #28A745 100%);
}

.apt-wrapper *,
.apt-wrapper *::before,
.apt-wrapper *::after {
	box-sizing: inherit;
}

.apt-panel {
	animation: apt-fade-in 0.35s ease;
}

@keyframes apt-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.apt-title {
	font-size: 1.4rem;
	margin: 0 0 0.35rem;
	color: var(--apt-text);
	font-weight: 700;
}

.apt-subtitle {
	color: var(--apt-muted);
	margin: 0 0 1.5rem;
	font-size: 0.9rem;
}

/* Registration step: centered header with a gradient icon badge. */
.apt-panel--registration .apt-title,
.apt-panel--registration .apt-subtitle {
	text-align: center;
}

.apt-panel--registration .apt-title::before {
	content: "";
	display: block;
	width: 56px;
	height: 56px;
	margin: 0 auto 0.85rem;
	border-radius: 16px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2'/%3E%3Crect x='9' y='3' width='6' height='4' rx='1'/%3E%3Cpath d='M9 12h6'/%3E%3Cpath d='M9 16h6'/%3E%3C/svg%3E"), linear-gradient(135deg, #046BD2, #0a4faf);
	background-repeat: no-repeat, no-repeat;
	background-position: center, center;
	background-size: 28px, cover;
	box-shadow: 0 10px 22px rgba(4, 107, 210, 0.32);
}

.apt-form {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.apt-exam-form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.apt-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.apt-field label {
	font-weight: 600;
	font-size: 0.85rem;
	color: var(--apt-text);
}

.apt-required {
	color: var(--apt-danger);
}

.apt-optional {
	color: var(--apt-muted);
	font-weight: 400;
	font-size: 0.85rem;
}

.apt-field input[type="text"],
.apt-field input[type="email"],
.apt-field select {
	padding: 0.6rem 0.85rem;
	border: 1px solid var(--apt-border);
	border-radius: 10px;
	font-size: 0.95rem;
	width: 100%;
	background: #F8FAFC;
	color: var(--apt-text);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.apt-field select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7684' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 18px;
	padding-right: 2.5rem;
	cursor: pointer;
}

.apt-field input:focus,
.apt-field select:focus {
	outline: none;
	border-color: var(--apt-primary);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(4, 107, 210, 0.15);
}

.apt-field input.apt-input-invalid,
.apt-field select.apt-input-invalid {
	border-color: var(--apt-danger);
}

.apt-error {
	color: var(--apt-danger);
	font-size: 0.8rem;
	line-height: 1.3;
	margin-top: 2px;
	display: block;
}

.apt-field .apt-error:empty {
	display: none;
	margin: 0;
}

.apt-field--general-error .apt-error:empty {
	display: none;
}

.apt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.8rem 1.5rem;
	border-radius: 8px;
	border: none;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}

.apt-btn:active {
	transform: scale(0.98);
}

.apt-btn--primary {
	background: linear-gradient(135deg, var(--apt-primary), var(--apt-primary-dark));
	color: #fff;
	box-shadow: 0 8px 18px rgba(4, 107, 210, 0.28);
}

.apt-btn--primary:hover {
	background: linear-gradient(135deg, #0561c0, #024a8f);
	box-shadow: 0 10px 22px rgba(4, 107, 210, 0.34);
}

.apt-btn--secondary {
	background: #F1F4F8;
	color: var(--apt-text);
}

.apt-btn--secondary:hover {
	background: #E4E9EF;
}

.apt-btn--success {
	background: var(--apt-success);
	color: #fff;
}

.apt-btn--success:hover {
	background: #218a38;
}

.apt-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

#apt-start-btn {
	width: 100%;
	margin-top: 0.4rem;
	padding-top: 0.85rem;
	padding-bottom: 0.85rem;
	font-size: 1.02rem;
}

.apt-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	border-radius: 50%;
	display: none;
	animation: apt-spin 0.7s linear infinite;
}

.apt-btn.apt-loading .apt-spinner {
	display: inline-block;
}

.apt-btn.apt-loading .apt-btn-text {
	opacity: 0.85;
}

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

/* Exam header */
.apt-exam-header {
	margin-bottom: 1.5rem;
}

.apt-progress-track {
	background: #EEF2F6;
	border-radius: 999px;
	height: 8px;
	overflow: hidden;
	margin-bottom: 0.6rem;
}

.apt-progress-fill {
	height: 100%;
	background: var(--apt-primary);
	width: 0%;
	transition: width 0.3s ease;
}

.apt-question-counter {
	font-size: 0.9rem;
	color: var(--apt-muted);
	font-weight: 600;
}

.apt-questions-list {
	position: relative;
}

.apt-question {
	display: none;
}

.apt-question.apt-question--active {
	display: block;
	animation: apt-fade-in 0.25s ease;
}

.apt-question-text {
	font-size: 1.1rem;
	font-weight: 600;
	margin: 0 0 1rem;
	line-height: 1.5;
}

.apt-options {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.apt-option {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--apt-border);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.apt-option:hover {
	border-color: var(--apt-primary);
	background: #F5F9FE;
}

.apt-option input[type="radio"] {
	accent-color: var(--apt-primary);
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.apt-option.apt-option--selected {
	border-color: var(--apt-primary);
	background: #EAF3FD;
}

.apt-option-label {
	font-size: 1rem;
}

.apt-exam-actions {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.apt-exam-actions .apt-btn {
	flex: 1;
}

/* Thank you */
.apt-panel--thankyou {
	text-align: center;
	padding: 1.5rem 0;
}

.apt-thankyou-icon {
	width: 64px;
	height: 64px;
	line-height: 64px;
	border-radius: 50%;
	background: var(--apt-success);
	color: #fff;
	font-size: 2rem;
	margin: 0 auto 1rem;
}

.apt-panel--thankyou p {
	color: var(--apt-muted);
	margin: 0.25rem 0;
}

/* Responsive */
@media (max-width: 600px) {
	.apt-wrapper {
		margin: 1rem;
		padding: 1.25rem;
		border-radius: 10px;
	}

	.apt-title {
		font-size: 1.25rem;
	}

	.apt-exam-actions {
		flex-wrap: wrap;
	}

	.apt-exam-actions .apt-btn {
		flex: 1 1 100%;
	}
}

/* Accessibility */
.apt-wrapper :focus-visible {
	outline: 2px solid var(--apt-primary);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.apt-panel,
	.apt-question.apt-question--active,
	.apt-btn {
		animation: none !important;
		transition: none !important;
	}
}

/* =========================================================================
 * Admin area — modern dashboard, results table & detail view
 * ========================================================================= */

.apt-admin-wrap {
	--apt-primary: #046BD2;
	--apt-primary-dark: #03539f;
	--apt-success: #28A745;
	--apt-danger: #DC3545;
	--apt-border: #E1E6EC;
	--apt-text: #1F2933;
	--apt-muted: #6B7684;
}

/* Hero header ---------------------------------------------------------- */
.apt-admin-wrap .apt-hero {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	margin: 16px 0 24px;
	padding: 24px 28px;
	border-radius: 16px;
	background: linear-gradient(120deg, #046BD2 0%, #0a4faf 55%, #073a86 100%);
	box-shadow: 0 12px 30px rgba(4, 107, 210, 0.22);
	color: #fff;
}

.apt-admin-wrap .apt-hero-text h1 {
	margin: 0;
	padding: 0;
	color: #fff;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
}

.apt-admin-wrap .apt-hero-text p {
	margin: 6px 0 0;
	color: rgba(255, 255, 255, 0.82);
	font-size: 14px;
}

.apt-admin-wrap .apt-hero-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.16);
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: #fff;
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	backdrop-filter: blur(4px);
	transition: background 0.18s ease, transform 0.12s ease;
}

.apt-admin-wrap .apt-hero-btn:hover {
	background: rgba(255, 255, 255, 0.28);
	color: #fff;
	transform: translateY(-1px);
}

.apt-admin-wrap .apt-hero-btn--light {
	background: #fff;
	color: var(--apt-primary);
	border-color: #fff;
}

.apt-admin-wrap .apt-hero-btn--light:hover {
	background: #eef4fd;
	color: var(--apt-primary-dark);
}

.apt-admin-wrap .apt-hero-btn .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* Stat cards ----------------------------------------------------------- */
.apt-admin-wrap .apt-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 18px;
	margin: 0 0 12px;
}

.apt-admin-wrap .apt-card {
	display: flex;
	align-items: center;
	gap: 16px;
	background: #fff;
	border: 1px solid var(--apt-border);
	border-radius: 14px;
	padding: 20px 22px;
	position: relative;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(15, 30, 50, 0.05);
	transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.apt-admin-wrap .apt-card::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 5px;
	background: var(--apt-primary);
}

.apt-admin-wrap .apt-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 26px rgba(15, 30, 50, 0.12);
}

.apt-admin-wrap .apt-card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 12px;
	background: rgba(4, 107, 210, 0.1);
	color: var(--apt-primary);
	flex-shrink: 0;
}

.apt-admin-wrap .apt-card-icon .dashicons {
	font-size: 26px;
	width: 26px;
	height: 26px;
}

.apt-admin-wrap .apt-card-body {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}

.apt-admin-wrap .apt-card-value {
	font-size: 30px;
	font-weight: 700;
	color: var(--apt-text);
}

.apt-admin-wrap .apt-card-label {
	margin-top: 4px;
	font-size: 13px;
	color: var(--apt-muted);
}

/* Per-tone accents */
.apt-admin-wrap .apt-card--green::before { background: var(--apt-success); }
.apt-admin-wrap .apt-card--green .apt-card-icon { background: rgba(40, 167, 69, 0.12); color: var(--apt-success); }

.apt-admin-wrap .apt-card--red::before { background: var(--apt-danger); }
.apt-admin-wrap .apt-card--red .apt-card-icon { background: rgba(220, 53, 69, 0.12); color: var(--apt-danger); }

.apt-admin-wrap .apt-card--purple::before { background: #7A5AF8; }
.apt-admin-wrap .apt-card--purple .apt-card-icon { background: rgba(122, 90, 248, 0.12); color: #7A5AF8; }

/* Section titles & tables --------------------------------------------- */
.apt-admin-wrap .apt-section-title {
	position: relative;
	padding-left: 12px;
	margin-bottom: 12px;
	font-size: 17px;
}

.apt-admin-wrap .apt-section-title::before {
	content: "";
	position: absolute;
	left: 0;
	top: 3px;
	bottom: 3px;
	width: 4px;
	border-radius: 4px;
	background: var(--apt-primary);
}

.apt-admin-wrap .apt-info-table,
.apt-admin-wrap .apt-answer-table {
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid var(--apt-border);
	box-shadow: 0 4px 14px rgba(15, 30, 50, 0.05);
}

.apt-admin-wrap .apt-info-table th {
	width: 200px;
	background: #f6f9fd;
	color: var(--apt-text);
}

/* Results list table polish ------------------------------------------- */
.apt-results-wrap .wp-list-table {
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid var(--apt-border);
	box-shadow: 0 4px 14px rgba(15, 30, 50, 0.05);
}

.apt-results-wrap .wp-list-table thead th,
.apt-results-wrap .wp-list-table thead td {
	background: #f6f9fd;
	color: var(--apt-text);
	font-weight: 600;
}

.apt-results-wrap .wp-list-table tbody tr:hover {
	background: #f2f7fe;
}

@media screen and (max-width: 640px) {
	.apt-admin-wrap .apt-hero { padding: 20px; }
	.apt-admin-wrap .apt-hero-text h1 { font-size: 20px; }
}
