/* =============================================================================
   APG Coaching — Auth / Profile / History Styles
   ============================================================================= */

/* Shared font stack */
.apg-auth-wrap,
.apg-history-wrap {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
}

/* =========================================================================
   Auth card (login + profile)
   ========================================================================= */

.apg-auth-wrap {
	max-width: 560px;
	margin: 0 auto;
}

.apg-auth-card {
	background: #ffffff;
	padding: 40px;
	border-radius: 12px;
	box-shadow: 0 2px 16px rgba( 0, 0, 0, 0.08 );
}

.apg-auth-title {
	font-size: 1.6rem;
	font-weight: 700;
	color: #1a1a2e;
	margin: 0 0 28px;
}

/* =========================================================================
   Profile header (avatar + name)
   ========================================================================= */

.apg-profile-card {
	max-width: 680px;
}

.apg-profile-header {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-bottom: 32px;
	padding-bottom: 24px;
	border-bottom: 1px solid #eee;
}

.apg-avatar {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.4rem;
	font-weight: 700;
	color: #ffffff;
	flex-shrink: 0;
	letter-spacing: 0.02em;
}

/* =========================================================================
   Section titles inside forms
   ========================================================================= */

.apg-section-title {
	font-size: 1rem;
	font-weight: 700;
	color: #333;
	margin: 28px 0 16px;
	padding-bottom: 8px;
	border-bottom: 1px solid #eee;
}

/* =========================================================================
   Form elements (shared with frontend, but scoped here for auth screens)
   ========================================================================= */

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

.apg-form-group {
	margin-bottom: 20px;
}

.apg-form-group label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	color: #222;
	font-size: 0.925rem;
}

.apg-input {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid #dde1e7;
	border-radius: 8px;
	font-size: 1rem;
	color: #333;
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
	font-family: inherit;
}

.apg-input:focus {
	outline: none;
	border-color: #1a3a5c;
	box-shadow: 0 0 0 3px rgba( 74, 108, 247, 0.12 );
}

/* =========================================================================
   Buttons
   ========================================================================= */

.apg-btn {
	display: inline-block;
	padding: 11px 28px;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	border: none;
	transition: background 0.2s, transform 0.1s;
	font-family: inherit;
	letter-spacing: 0.01em;
	text-decoration: none;
	text-align: center;
}

.apg-btn-primary {
	background: #1a3a5c;
	color: #ffffff;
}

.apg-btn-primary:hover {
	background: #0f2942;
	color: #ffffff;
}

.apg-btn-secondary {
	background: #f3f4f6;
	color: #444;
	border: 1.5px solid #dde1e7;
}

.apg-btn-secondary:hover {
	background: #e9eaec;
	color: #222;
}

.apg-btn-full {
	width: 100%;
	display: block;
}

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

/* =========================================================================
   Form footer
   ========================================================================= */

.apg-form-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid #eee;
}

/* =========================================================================
   Messages (reuses .apg-notice from frontend, adds inline message styles)
   ========================================================================= */

.apg-notice {
	padding: 12px 16px;
	border-radius: 6px;
	margin-bottom: 20px;
	font-size: 0.95rem;
	line-height: 1.5;
}

.apg-notice-info {
	background: #e8f4fd;
	border-left: 4px solid #2196f3;
	color: #1565c0;
}

.apg-notice-warning {
	background: #fff8e1;
	border-left: 4px solid #ffc107;
	color: #f57f17;
}

.apg-message {
	padding: 12px 16px;
	border-radius: 6px;
	margin-bottom: 20px;
	font-size: 0.95rem;
	font-weight: 500;
}

.apg-message-success {
	background: #e8f5e9;
	border-left: 4px solid #4caf50;
	color: #1b5e20;
}

.apg-message-error {
	background: #ffebee;
	border-left: 4px solid #f44336;
	color: #b71c1c;
}

/* =========================================================================
   History
   ========================================================================= */

.apg-history-wrap {
	max-width: 800px;
	margin: 0 auto;
}

.apg-history-title {
	font-size: 1.6rem;
	font-weight: 700;
	color: #1a1a2e;
	margin: 0 0 24px;
}

.apg-history-grid {
	display: grid;
	gap: 20px;
}

.apg-history-card {
	background: #ffffff;
	border-radius: 12px;
	padding: 24px;
	box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.07 );
}

.apg-history-card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid #eee;
}

.apg-history-period {
	font-size: 1.05rem;
	font-weight: 700;
	color: #1a1a2e;
}

.apg-history-date {
	font-size: 0.85rem;
	color: #999;
}

.apg-history-ratings {
	display: flex;
	gap: 24px;
	margin-bottom: 16px;
}

.apg-history-rating {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.apg-history-rating-label {
	font-size: 0.78rem;
	font-weight: 600;
	color: #666;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.apg-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #1a3a5c;
	color: #fff;
	border-radius: 20px;
	font-weight: 700;
	font-size: 0.85rem;
	padding: 2px 10px;
	min-width: 32px;
}

.apg-badge-lg {
	font-size: 1rem;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	padding: 0;
}

.apg-history-content {
	font-size: 0.95rem;
	line-height: 1.7;
	color: #444;
	white-space: pre-line;
}

/* =========================================================================
   Notification preference section
   ========================================================================= */

.apg-notif-section {
	margin-top: 32px;
	padding-top: 28px;
	border-top: 1px solid #eee;
}

/* Toggle switch */
.apg-toggle-label {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	user-select: none;
}

.apg-toggle-wrap {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
}

.apg-toggle-wrap input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.apg-toggle-slider {
	position: absolute;
	inset: 0;
	background: #ccc;
	border-radius: 24px;
	transition: background 0.2s;
}

.apg-toggle-slider::before {
	content: '';
	position: absolute;
	width: 18px;
	height: 18px;
	background: #fff;
	border-radius: 50%;
	left: 3px;
	top: 3px;
	transition: transform 0.2s;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.2 );
}

.apg-toggle-wrap input:checked + .apg-toggle-slider {
	background: #1a3a5c;
}

.apg-toggle-wrap input:checked + .apg-toggle-slider::before {
	transform: translateX( 20px );
}

.apg-toggle-wrap input:focus-visible + .apg-toggle-slider {
	outline: 2px solid #1a3a5c;
	outline-offset: 2px;
}

.apg-toggle-text {
	font-size: 0.975rem;
	color: #333;
	font-weight: 500;
}

.apg-notif-status-msg {
	font-size: 0.82rem;
	color: #27ae60;
	margin-top: 10px;
	min-height: 1.2em;
	font-style: italic;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media ( max-width: 600px ) {
	.apg-auth-card {
		padding: 24px 18px;
	}

	.apg-form-row {
		grid-template-columns: 1fr;
	}

	.apg-history-ratings {
		gap: 16px;
	}

	.apg-form-footer {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.apg-btn {
		width: 100%;
		text-align: center;
	}
}

/* Group badge — pill with two segments: "Group" label + group name */
.apg-group-badge {
	display: inline-flex;
	align-items: stretch;
	border-radius: 999px;
	overflow: hidden;
	font-size: 0.78rem;
	font-weight: 700;
	color: #fff;
	line-height: 1;
	letter-spacing: 0.3px;
	border: 2px solid #1a3a5c;
	box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.apg-group-badge__label {
	padding: 5px 9px;
	background: rgba(0,0,0,0.22);
	text-transform: uppercase;
	font-size: 0.68rem;
	letter-spacing: 0.6px;
}
.apg-group-badge__name {
	padding: 5px 12px;
}

/* Check-in history — use semaphore dots (no text inside the badge) */
.apg-history-rating .apg-badge--score-1,
.apg-history-rating .apg-badge--score-2,
.apg-history-rating .apg-badge--score-3,
.apg-history-rating .apg-badge--score-0 {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	font-size: 0 !important;
	line-height: 0;
	padding: 0 !important;
	min-width: 0;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.apg-history-rating .apg-badge--score-0 {
	background: #e5e7eb !important;
}

/* MFA section in the profile */
.apg-mfa-section {
	margin-top: 24px;
	padding-top: 18px;
	border-top: 1px solid #e3e6ef;
}
.apg-mfa-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 12px;
}
@media (max-width: 600px) {
	.apg-mfa-options { grid-template-columns: 1fr; }
}
.apg-mfa-card {
	background: #fafbfd;
	border: 1px solid #e3e6ef;
	border-radius: 8px;
	padding: 16px;
}
.apg-mfa-card h4 {
	margin: 0 0 8px;
	color: #1a3a5c;
	font-size: 1rem;
}
.apg-mfa-card p {
	margin: 0 0 10px;
	font-size: 0.88rem;
	color: #555;
	line-height: 1.5;
}
