/**
 * Youth Growth AI MCQ — public base stylesheet.
 * Mobile-first, theme-agnostic (relies on the theme's own font-family/
 * color scheme where sensible, and only sets its own tokens for
 * things the theme won't provide). Loaded on every page (small
 * footprint); feature-specific stylesheets (ygam-quiz.css) load only
 * where needed — see includes/class-ygam-assets.php.
 */

:root {
	--ygam-primary: #1a73e8;
	--ygam-primary-dark: #0f52ba;
	--ygam-success: #1a7a1a;
	--ygam-danger: #b02a2a;
	--ygam-warning: #a35c00;
	--ygam-border: #e0e0e0;
	--ygam-bg-muted: #f7f8fa;
	--ygam-text-muted: #5f6368;
	--ygam-radius: 8px;
	--ygam-spacing: 16px;
}

/* ---------------------------------------------------------------
   Accessibility helpers
--------------------------------------------------------------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ygam-page a:focus-visible,
.ygam-page button:focus-visible,
.ygam-page input:focus-visible,
.ygam-page select:focus-visible,
.ygam-page textarea:focus-visible {
	outline: 3px solid var(--ygam-primary);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Layout primitives
--------------------------------------------------------------- */
.ygam-page * {
	box-sizing: border-box;
}

.ygam-section-title {
	margin: 32px 0 16px;
	font-size: 1.25rem;
}

.ygam-loading {
	color: var(--ygam-text-muted);
	font-style: italic;
	padding: 12px 0;
}

.ygam-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin: 16px 0;
}

@media (min-width: 600px) {
	.ygam-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 960px) {
	.ygam-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

.ygam-stat-box {
	background: var(--ygam-bg-muted);
	border: 1px solid var(--ygam-border);
	border-radius: var(--ygam-radius);
	padding: 16px;
}

.ygam-stat-value {
	display: block;
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--ygam-primary);
}

.ygam-stat-label {
	font-size: 0.85rem;
	color: var(--ygam-text-muted);
}

/* ---------------------------------------------------------------
   Buttons
--------------------------------------------------------------- */
.ygam-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	border-radius: var(--ygam-radius);
	font-weight: 600;
	text-decoration: none;
	border: 1px solid transparent;
	cursor: pointer;
	font-size: 0.95rem;
	min-height: 44px; /* touch target size */
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.ygam-btn:active {
	transform: translateY(1px);
}

.ygam-btn-primary {
	background: var(--ygam-primary);
	color: #fff;
}

.ygam-btn-primary:hover {
	background: var(--ygam-primary-dark);
	color: #fff;
}

.ygam-btn-secondary {
	background: #fff;
	border-color: var(--ygam-border);
	color: #202124;
}

.ygam-btn-danger {
	background: var(--ygam-danger);
	color: #fff;
}

/* ---------------------------------------------------------------
   Forms
--------------------------------------------------------------- */
.ygam-form-row {
	margin-bottom: 16px;
}

.ygam-form-row label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

.ygam-form-row input,
.ygam-form-row select,
.ygam-form-row textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--ygam-border);
	border-radius: var(--ygam-radius);
	font-size: 1rem;
	min-height: 44px;
}

.ygam-form-row textarea {
	min-height: 88px;
}

/* ---------------------------------------------------------------
   Toolbar / filters
--------------------------------------------------------------- */
.ygam-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 20px;
}

.ygam-toolbar select,
.ygam-toolbar input {
	min-height: 40px;
	padding: 6px 10px;
	border: 1px solid var(--ygam-border);
	border-radius: var(--ygam-radius);
}

/* ---------------------------------------------------------------
   Tables (responsive: switch to stacked cards under 600px)
--------------------------------------------------------------- */
.ygam-table {
	width: 100%;
	border-collapse: collapse;
}

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

@media (max-width: 599px) {
	.ygam-table thead {
		display: none;
	}
	.ygam-table,
	.ygam-table tbody,
	.ygam-table tr,
	.ygam-table td {
		display: block;
		width: 100%;
	}
	.ygam-table tr {
		margin-bottom: 12px;
		border: 1px solid var(--ygam-border);
		border-radius: var(--ygam-radius);
		padding: 8px 0;
	}
	.ygam-table td {
		border: none;
		padding: 6px 12px;
	}
}

/* ---------------------------------------------------------------
   Pagination
--------------------------------------------------------------- */
.ygam-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 16px;
}

.ygam-pagination button {
	min-width: 40px;
	min-height: 40px;
}

/* ---------------------------------------------------------------
   Notices
--------------------------------------------------------------- */
.ygam-notice {
	background: var(--ygam-bg-muted);
	border: 1px solid var(--ygam-border);
	border-radius: var(--ygam-radius);
	padding: 16px;
	margin: 16px 0;
}

.ygam-notice-login {
	text-align: center;
}

/* ---------------------------------------------------------------
   Home template
--------------------------------------------------------------- */
.ygam-home-hero {
	text-align: center;
	padding: 32px 16px;
}

.ygam-home-title {
	font-size: 1.5rem;
	margin-bottom: 8px;
}

@media (min-width: 768px) {
	.ygam-home-title {
		font-size: 2rem;
	}
}

.ygam-home-subtitle {
	color: var(--ygam-text-muted);
	max-width: 620px;
	margin: 0 auto 20px;
}

.ygam-home-quicklinks {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

.ygam-subject-grid,
.ygam-notes-grid,
.ygam-certificate-grid,
.ygam-mocktest-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}

@media (min-width: 600px) {
	.ygam-subject-grid,
	.ygam-notes-grid,
	.ygam-certificate-grid,
	.ygam-mocktest-list {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 960px) {
	.ygam-subject-grid,
	.ygam-notes-grid,
	.ygam-certificate-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.ygam-subject-tile,
.ygam-note-card,
.ygam-certificate-card,
.ygam-mocktest-item {
	display: block;
	background: #fff;
	border: 1px solid var(--ygam-border);
	border-radius: var(--ygam-radius);
	padding: 16px;
	text-decoration: none;
	color: inherit;
}

.ygam-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 0.75rem;
	font-weight: 600;
}

.ygam-badge-success { background: #e6f4ea; color: var(--ygam-success); }
.ygam-badge-warning { background: #fff4e5; color: var(--ygam-warning); }
.ygam-badge-danger  { background: #fdeaea; color: var(--ygam-danger); }
.ygam-badge-info    { background: #e8f0fe; color: var(--ygam-primary); }

/* ---------------------------------------------------------------
   Dashboard
--------------------------------------------------------------- */
.ygam-dashboard-columns {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
	margin: 24px 0;
}

@media (min-width: 900px) {
	.ygam-dashboard-columns {
		grid-template-columns: 1fr 1fr;
	}
}

.ygam-badge-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* ---------------------------------------------------------------
   AI chat/doubt
--------------------------------------------------------------- */
.ygam-ai-chat-window {
	border: 1px solid var(--ygam-border);
	border-radius: var(--ygam-radius);
	overflow: hidden;
}

.ygam-ai-chat-log {
	max-height: 400px;
	overflow-y: auto;
	padding: 16px;
	background: var(--ygam-bg-muted);
}

.ygam-ai-chat-message {
	margin-bottom: 12px;
	padding: 10px 14px;
	border-radius: var(--ygam-radius);
	max-width: 85%;
}

.ygam-ai-chat-message.user {
	background: var(--ygam-primary);
	color: #fff;
	margin-left: auto;
}

.ygam-ai-chat-message.assistant {
	background: #fff;
	border: 1px solid var(--ygam-border);
}

.ygam-ai-chat-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--ygam-border);
}

.ygam-ai-chat-form textarea {
	flex: 1;
	min-height: 44px;
	border: 1px solid var(--ygam-border);
	border-radius: var(--ygam-radius);
	padding: 10px;
	resize: vertical;
}

.ygam-ai-unavailable {
	background: #fff4e5;
	color: var(--ygam-warning);
	padding: 14px;
	border-radius: var(--ygam-radius);
}
