/**
 * Tobalt Mokymai — Frontend styles.
 *
 * @package Tobalt_Mokymai
 * @author  Tobalt — https://tobalt.lt
 */

/* ── Base ──────────────────────────────────────────── */

.tm-flow {
	max-width: 720px;
	margin: 30px auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tm-step {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
	padding: 30px;
	margin-bottom: 20px;
}

.tm-step-header {
	margin-bottom: 24px;
	text-align: center;
}

.tm-step-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: #3498db;
	color: #fff;
	border-radius: 50%;
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 12px;
}

.tm-step-badge.tm-success {
	background: #27ae60;
}

.tm-step-header h3 {
	margin: 0 0 8px;
	font-size: 22px;
	color: #2c3e50;
}

.tm-step-desc {
	color: #666;
	margin: 0;
}

/* ── Questions ─────────────────────────────────────── */

.tm-questions {
	margin-bottom: 24px;
}

.tm-question {
	margin-bottom: 20px;
	padding-bottom: 20px;
	border-bottom: 1px solid #f0f0f0;
}

.tm-question:last-child {
	border-bottom: none;
	margin-bottom: 0;
}

.tm-question-text {
	margin: 0 0 12px;
	font-size: 15px;
}

.tm-option {
	display: block;
	padding: 10px 14px;
	margin: 6px 0;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s;
}

.tm-option:hover {
	background: #f7f9fc;
	border-color: #3498db;
}

.tm-option input {
	margin-right: 10px;
}

.tm-option input:checked + span {
	font-weight: 600;
}

/* ── Form ──────────────────────────────────────────── */

.tm-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 16px;
}

@media (max-width: 600px) {
	.tm-form-row {
		grid-template-columns: 1fr;
	}
}

.tm-form-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
	font-size: 14px;
	color: #333;
}

.tm-form-field .required {
	color: #e74c3c;
}

.tm-form-field input {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #d0d0d0;
	border-radius: 8px;
	font-size: 15px;
	box-sizing: border-box;
}

.tm-form-field input:focus {
	outline: none;
	border-color: #3498db;
	box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* ── Buttons ───────────────────────────────────────── */

.tm-step-actions {
	text-align: center;
	margin-top: 24px;
}

.tm-btn {
	display: inline-block;
	padding: 12px 32px;
	border: none;
	border-radius: 8px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s;
}

.tm-btn-primary {
	background: #3498db;
	color: #fff;
}

.tm-btn-primary:hover {
	background: #2980b9;
}

.tm-btn-primary:disabled {
	background: #bdc3c7;
	cursor: not-allowed;
}

.tm-btn-small {
	padding: 6px 16px;
	font-size: 13px;
	background: #3498db;
	color: #fff;
	border-radius: 6px;
}

.tm-error-msg {
	color: #e74c3c;
	margin-top: 10px;
	font-size: 14px;
}

.tm-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid #e0e0e0;
	border-top-color: #3498db;
	border-radius: 50%;
	animation: tm-spin 0.6s linear infinite;
	vertical-align: middle;
	margin-left: 10px;
}

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

/* ── Attendance ────────────────────────────────────── */

.tm-code-input {
	text-align: center;
	margin: 24px 0;
}

.tm-code-input input {
	width: 160px;
	font-size: 32px;
	text-align: center;
	letter-spacing: 12px;
	padding: 12px;
	border: 2px solid #d0d0d0;
	border-radius: 12px;
}

.tm-code-input input:focus {
	border-color: #3498db;
	outline: none;
}

.tm-video-wrapper {
	margin: 20px 0;
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	overflow: hidden;
	border-radius: 8px;
}

.tm-video-wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.tm-progress-bar {
	background: #e0e0e0;
	border-radius: 10px;
	height: 12px;
	overflow: hidden;
	margin: 16px 0 8px;
}

.tm-progress-fill {
	background: #27ae60;
	height: 100%;
	border-radius: 10px;
	transition: width 0.5s ease;
}

.tm-progress-text {
	font-size: 14px;
	color: #666;
}

/* ── Confirmation ──────────────────────────────────── */

.tm-detail-card {
	background: #f7f9fc;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
}

.tm-detail-card h4 {
	margin: 0 0 12px;
	color: #2c3e50;
}

.tm-bookmark-note {
	background: #fef9e7;
	padding: 14px;
	border-radius: 8px;
	border-left: 4px solid #f1c40f;
}

/* ── Growth Summary ────────────────────────────────── */

.tm-growth-overview {
	text-align: center;
	margin-bottom: 30px;
}

.tm-score-comparison {
	display: inline-flex;
	gap: 40px;
	align-items: flex-end;
	height: 180px;
	padding: 0 30px;
	margin-bottom: 16px;
}

.tm-score-block {
	position: relative;
	width: 80px;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.tm-score-label {
	font-size: 13px;
	color: #666;
	margin-bottom: 6px;
}

.tm-score-value {
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 8px;
}

.tm-bar {
	width: 100%;
	min-height: 4px;
	border-radius: 6px 6px 0 0;
	transition: height 1s ease;
}

.tm-score-pre .tm-bar {
	background: #e0e0e0;
}

.tm-score-post .tm-bar {
	background: #27ae60;
}

.tm-growth-badge {
	display: inline-block;
	padding: 8px 20px;
	border-radius: 20px;
	font-size: 16px;
	font-weight: 700;
	background: #f0f0f0;
	color: #666;
}

.tm-growth-badge.tm-positive {
	background: #e8f8f0;
	color: #27ae60;
}

.tm-growth-badge.tm-negative {
	background: #fde8e8;
	color: #e74c3c;
}

.tm-breakdown-stats {
	display: flex;
	gap: 16px;
	justify-content: center;
	margin: 16px 0;
}

.tm-stat {
	padding: 6px 14px;
	border-radius: 6px;
	font-size: 13px;
}

.tm-stat.tm-improved { background: #e8f8f0; color: #27ae60; }
.tm-stat.tm-same { background: #f0f0f0; color: #666; }
.tm-stat.tm-regressed { background: #fde8e8; color: #e74c3c; }

.tm-question-list {
	list-style: none;
	padding: 0;
}

.tm-question-list li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border-bottom: 1px solid #f0f0f0;
	font-size: 14px;
}

.tm-question-list li.tm-improved { background: #fafff8; }
.tm-question-list li.tm-regressed { background: #fff8f8; }

.tm-q-icon { font-size: 12px; width: 16px; }
.tm-q-text { flex: 1; }
.tm-q-status { color: #999; font-size: 13px; white-space: nowrap; }

/* ── Certificate Preview ───────────────────────────── */

.tm-certificate-preview {
	border: 3px solid #d4af37;
	border-radius: 12px;
	padding: 40px;
	text-align: center;
	background: #fffef8;
	margin-bottom: 24px;
}

.tm-cert-logo {
	max-height: 60px;
	margin-bottom: 20px;
}

.tm-cert-title {
	font-size: 20px;
	letter-spacing: 3px;
	color: #2c3e50;
	margin: 0 0 20px;
	text-transform: uppercase;
}

.tm-cert-name {
	font-size: 28px;
	color: #2c3e50;
	margin: 16px 0;
	border-bottom: 2px solid #d4af37;
	display: inline-block;
	padding-bottom: 8px;
}

.tm-cert-text {
	color: #555;
	font-size: 15px;
}

.tm-cert-date {
	color: #888;
	font-size: 14px;
	margin: 12px 0;
}

.tm-cert-scores {
	margin: 20px 0;
	font-size: 14px;
	color: #666;
}

.tm-cert-growth {
	margin-left: 16px;
	font-weight: 600;
}

.tm-cert-footer {
	margin-top: 30px;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
}

.tm-cert-line {
	width: 200px;
	border-bottom: 1px solid #333;
	margin-bottom: 8px;
}

.tm-cert-sig-name {
	margin: 0;
	font-weight: 600;
}

.tm-cert-sig-title {
	margin: 0;
	font-size: 13px;
	color: #666;
}

.tm-cert-meta {
	text-align: right;
	font-size: 12px;
	color: #999;
}

.tm-cert-code {
	margin: 0;
	font-weight: 600;
}

.tm-cert-verify-url {
	margin: 2px 0 0;
	word-break: break-all;
}

/* ── Portfolio ─────────────────────────────────────── */

.tm-portfolio {
	max-width: 800px;
	margin: 30px auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tm-portfolio-header {
	margin-bottom: 24px;
}

.tm-portfolio-header h2 {
	margin: 0 0 4px;
}

.tm-portfolio-email,
.tm-portfolio-org {
	margin: 0;
	color: #666;
	font-size: 14px;
}

.tm-portfolio-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-bottom: 30px;
}

.tm-stat-card {
	background: #f7f9fc;
	border-radius: 12px;
	padding: 20px;
	text-align: center;
}

.tm-stat-value {
	display: block;
	font-size: 28px;
	font-weight: 700;
	color: #2c3e50;
}

.tm-stat-label {
	font-size: 13px;
	color: #666;
}

.tm-portfolio-item {
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	padding: 16px 20px;
	margin-bottom: 12px;
}

.tm-portfolio-item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
}

.tm-portfolio-item-header h4 {
	margin: 0;
}

.tm-portfolio-date {
	color: #999;
	font-size: 13px;
}

.tm-portfolio-item-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	font-size: 13px;
}

.tm-portfolio-status {
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 600;
}

.tm-status-completed { background: #e8f8f0; color: #27ae60; }
.tm-status-in_progress { background: #fef9e7; color: #f39c12; }
.tm-status-failed { background: #fde8e8; color: #e74c3c; }

.tm-portfolio-scores {
	color: #666;
}

.tm-growth.tm-positive {
	color: #27ae60;
	font-weight: 600;
}

.tm-portfolio-cert-link {
	color: #3498db;
	font-weight: 600;
}

/* ── Trainings Hub ─────────────────────────────────── */

.tm-hub {
	max-width: 800px;
	margin: 30px auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tm-hub-header {
	text-align: center;
	margin-bottom: 30px;
}

.tm-hub-header h3 {
	font-size: 26px;
	color: #2c3e50;
	margin: 0 0 8px;
}

.tm-hub-header p {
	color: #666;
	margin: 0;
	font-size: 15px;
}

.tm-hub-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
	gap: 20px;
}

.tm-hub-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
	padding: 24px;
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
	position: relative;
}

.tm-hub-card:hover {
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
	border-color: #3498db;
}

.tm-hub-card__badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	background: #eaf2ff;
	color: #3498db;
	margin-bottom: 12px;
	align-self: flex-start;
}

.tm-hub-card__title {
	font-size: 20px;
	font-weight: 600;
	color: #2c3e50;
	margin: 0 0 12px;
	line-height: 1.3;
}

.tm-hub-card__meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 16px;
	font-size: 14px;
	color: #666;
}

.tm-hub-card__date::before {
	content: "\1F4C5 ";
}

.tm-hub-card__location::before {
	content: "\1F4CD ";
}

.tm-hub-card__stats {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 13px;
	color: #999;
	margin-bottom: 16px;
	margin-top: auto;
}

.tm-hub-card__stats span {
	background: #f5f5f5;
	padding: 4px 10px;
	border-radius: 6px;
}

.tm-hub-card__action {
	margin-top: auto;
}

@media (max-width: 420px) {
	.tm-hub-grid {
		grid-template-columns: 1fr;
	}
}

/* ── Verification ──────────────────────────────────── */

.tm-verify-page {
	max-width: 500px;
	margin: 40px auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tm-verify-card {
	border-radius: 12px;
	padding: 40px;
	text-align: center;
}

.tm-verify-card.tm-valid {
	background: #f0faf0;
	border: 2px solid #27ae60;
}

.tm-verify-card.tm-invalid {
	background: #fff5f5;
	border: 2px solid #e74c3c;
}

.tm-verify-icon {
	font-size: 48px;
	margin-bottom: 16px;
}

.tm-verify-icon.tm-success { color: #27ae60; }
.tm-verify-icon.tm-failure { color: #e74c3c; }

.tm-verify-details table {
	width: 100%;
	text-align: left;
	margin: 20px 0;
}

.tm-verify-details th {
	padding: 8px 12px;
	color: #666;
	font-weight: 600;
	width: 120px;
}

.tm-verify-details td {
	padding: 8px 12px;
}

.tm-verify-org {
	color: #999;
	font-size: 13px;
}

/* ── Print styles (certificate) ────────────────────── */

@media print {
	body > *:not(.tm-flow),
	.tm-step-actions,
	.tm-step-header .tm-step-badge,
	.tm-step-header h3,
	header, footer, nav, aside,
	.tm-step:not(.tm-step-certificate) {
		display: none !important;
	}

	.tm-certificate-preview {
		border: none;
		box-shadow: none;
	}

	.tm-step-certificate {
		border: none;
		padding: 0;
	}
}

@media (max-width: 600px) {
	.tm-portfolio-stats {
		grid-template-columns: 1fr;
	}

	.tm-score-comparison {
		gap: 20px;
	}

	.tm-cert-footer {
		flex-direction: column;
		align-items: center;
		gap: 20px;
	}
}
