/* v2.7 — Student OTP Login + "My Attendance" report.
 *
 * Kept as its own file (enqueued only where it's needed — see
 * ssm_enqueue_student_assets() in school-attendance-system.php) rather
 * than appended to ssm-style.css, so none of the existing teacher-facing
 * rules there are touched. Depends on ssm-style.css for the shared
 * design tokens (--ssm-* custom properties) and the base .ssm-app /
 * .ssm-topbar / .ssm-tiles / .ssm-view / .ssm-field / .ssm-btn / .ssm-
 * filter-row / .ssm-error rules, which this file reuses as-is wherever a
 * new element's purpose already matches one of those.
 */

/* The student login forms share .ssm-form but, like #ssm-login-form,
   are just a couple of stacked fields — never meant to pick up
   .ssm-form's 2-column grid treatment at wider viewports. */
#ssm-student-email-form,
#ssm-student-otp-form {
	display: block;
}

/* ---------- Login tabs (templates/login-page.php) ---------- */
.ssm-login-tabs {
	display: flex;
	gap: 6px;
	background: var(--ssm-bg);
	border-radius: 999px;
	padding: 4px;
	margin: 4px 0 22px;
}
.ssm-login-tab {
	flex: 1 1 0;
	border: none;
	background: transparent;
	color: var(--ssm-text-muted);
	font-weight: 700;
	font-size: 14px;
	padding: 10px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.18s var(--ssm-ease), color 0.18s var(--ssm-ease), box-shadow 0.18s var(--ssm-ease);
}
.ssm-login-tab.is-active {
	background: var(--ssm-card);
	color: var(--ssm-primary-dark);
	box-shadow: var(--ssm-shadow-sm);
}
.ssm-login-panel .ssm-login-title { margin-top: 0; }

/* templates/student-dashboard.php's welcome subtitle (student's standard
   + class, not a date, so kept as its own class rather than reusing
   ssm-style.css's .ssm-welcome-date — same look, different meaning). */
.ssm-welcome-sub {
	font-size: 14px;
	color: var(--ssm-text-muted);
	margin: 0 0 4px;
}

/* ---------- Student OTP steps (templates/student-login-form.php) ---------- */
.ssm-student-otp-sentto {
	font-size: 13.5px;
	color: var(--ssm-text-muted);
	margin: 0 0 14px;
}
.ssm-student-otp-sentto strong { color: var(--ssm-text); }
#ssm-student-otp {
	letter-spacing: 8px;
	font-weight: 700;
	text-align: center;
}
.ssm-student-otp-actions {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 12px;
}
.ssm-student-otp-actions .ssm-btn { flex: 1 1 auto; }
.ssm-student-otp-actions .ssm-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Select-student step + topbar picker (shared markup/classes
   between templates/student-login-form.php and templates/student-
   dashboard.php's initial "pick a student" screen) ---------- */
.ssm-student-select-intro {
	font-size: 13.5px;
	color: var(--ssm-text-muted);
	margin: 0 0 14px;
}
.ssm-student-select-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	/* v2.7.7 — bounded scroll area so every card in the list stays
	   reachable even when the list (this same class is shared by both
	   the login flow's #ssm-student-select-step and the dashboard's
	   #ssm-student-picker) is taller than a short phone viewport, rather
	   than relying on the page/card around it to grow and scroll
	   normally — which isn't guaranteed across every ancestor this list
	   ends up inside. */
	max-height: min(48vh, 380px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}
.ssm-student-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 3px;
	width: 100%;
	text-align: left;
	background: var(--ssm-card);
	border: 1.5px solid var(--ssm-border);
	border-radius: var(--ssm-radius-sm);
	padding: 14px 16px;
	cursor: pointer;
	transition: border-color 0.16s var(--ssm-ease), box-shadow 0.16s var(--ssm-ease), transform 0.16s var(--ssm-ease);
	font: inherit;
	color: inherit;
}
.ssm-student-card:hover { border-color: var(--ssm-primary); box-shadow: var(--ssm-shadow-sm); transform: translateY(-1px); }
.ssm-student-card:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.ssm-student-card-name { font-weight: 700; font-size: 15px; }
.ssm-student-card-meta { font-size: 12.5px; color: var(--ssm-text-muted); }

#ssm-student-picker { max-width: 460px; margin: 32px auto 0; }

/* ---------- Topbar: student switcher + actions (templates/student-
   dashboard.php) ---------- */
.ssm-topbar-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}
.ssm-student-switcher {
	padding: 9px 12px;
	font-size: 13.5px;
	font-weight: 600;
	border: 1.5px solid var(--ssm-border);
	border-radius: 10px;
	background: var(--ssm-card);
	color: var(--ssm-text);
	max-width: 220px;
}
.ssm-student-switcher:disabled { opacity: 0.6; }

/* v2.7.7 — small-screen fix: .ssm-topbar (ssm-style.css, shared with the
   teacher dashboard) is a plain no-wrap flex row with no responsive
   breakpoint of its own. On the student dashboard that row also has to
   fit the switcher (above) plus the Log Out button, and on a narrow
   phone the three together were wider than the viewport — with nothing
   allowed to wrap or shrink, the row simply overflowed and the Log Out
   button ended up pushed off-screen, unreachable without horizontal
   scroll.
   Scoped under #ssm-student-app — the student dashboard's own app-shell
   id (the teacher dashboard's is the different id #ssm-app) — because
   this stylesheet loads on every front-end page, not just the student
   dashboard, and .ssm-topbar-title/.ssm-topbar-name/.ssm-topbar-user
   below are shared class names also used by the teacher dashboard's
   topbar; without this scoping these rules would leak onto that page
   too. */
@media (max-width: 480px) {
	#ssm-student-app .ssm-topbar {
		gap: 8px;
	}
	#ssm-student-app .ssm-topbar-title {
		min-width: 0;
		overflow: hidden;
	}
	#ssm-student-app .ssm-topbar-name,
	#ssm-student-app .ssm-topbar-user {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	#ssm-student-app .ssm-topbar-actions {
		flex-wrap: wrap;
		justify-content: flex-end;
		gap: 8px;
	}
	#ssm-student-app .ssm-student-switcher {
		max-width: 150px;
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

.ssm-student-empty-state {
	max-width: 420px;
	margin: 48px auto 0;
	text-align: center;
	color: var(--ssm-text-muted);
	background: var(--ssm-card);
	border: 1.5px solid var(--ssm-border);
	border-radius: var(--ssm-radius);
	padding: 28px 22px;
}

/* Button-reset for the one interactive tile in .ssm-student-tiles being a
   real <button> (for accessibility) rather than the teacher dashboard's
   plain <div> — .ssm-tile in ssm-style.css already resets every property
   that matters visually (background/border/padding/display/cursor); this
   just tidies up the couple of default UA button quirks that aren't. */
.ssm-tiles .ssm-tile {
	font: inherit;
	color: inherit;
	appearance: none;
	-webkit-appearance: none;
}

/* ---------- "My Attendance" filter bar ---------- */
.ssm-student-preset-btns {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.ssm-student-preset-btns .ssm-btn.is-active {
	background: var(--ssm-primary-light);
	color: var(--ssm-primary-dark);
	border-color: var(--ssm-primary);
}
.ssm-student-daterange {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.ssm-student-daterange input[type="date"] {
	padding: 9px 10px;
	font-size: 14px;
	border: 1.5px solid var(--ssm-border);
	border-radius: 10px;
	background: #fff;
	color: var(--ssm-text);
}
.ssm-student-daterange-sep { color: var(--ssm-text-muted); font-size: 13px; }

.ssm-student-loading { color: var(--ssm-text-muted); font-size: 14px; }
.ssm-student-empty-hint { color: var(--ssm-text-muted); font-size: 13.5px; }

/* ---------- Summary cards ---------- */
.ssm-student-summary-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	margin: 18px 0;
}
@media (min-width: 640px) {
	.ssm-student-summary-grid { grid-template-columns: repeat(5, 1fr); }
}
.ssm-student-summary-card {
	background: var(--ssm-card);
	border: 1px solid var(--ssm-border);
	border-radius: var(--ssm-radius-sm);
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	box-shadow: var(--ssm-shadow-sm);
}
.ssm-student-summary-value { font-size: 22px; font-weight: 800; color: var(--ssm-text); }
.ssm-student-summary-label { font-size: 12px; font-weight: 600; color: var(--ssm-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ssm-student-summary-card--success .ssm-student-summary-value { color: var(--ssm-success); }
.ssm-student-summary-card--danger .ssm-student-summary-value { color: var(--ssm-danger); }
.ssm-student-summary-card--primary .ssm-student-summary-value { color: var(--ssm-primary-dark); }
.ssm-student-summary-card--accent .ssm-student-summary-value { color: var(--ssm-accent-dark); }

/* ---------- Charts ---------- */
.ssm-student-charts-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin-bottom: 22px;
}
@media (min-width: 720px) {
	.ssm-student-charts-row { grid-template-columns: 1.4fr 1fr; }
}
.ssm-student-chart-card {
	background: var(--ssm-card);
	border: 1px solid var(--ssm-border);
	border-radius: var(--ssm-radius);
	padding: 16px;
	box-shadow: var(--ssm-shadow-sm);
}
.ssm-student-chart-card h3 { margin: 0 0 12px; font-size: 14px; color: var(--ssm-text-muted); }
.ssm-student-chart-canvas-wrap { position: relative; height: 220px; }
.ssm-student-chart-canvas-wrap canvas { max-width: 100%; }

/* ---------- Calendar ---------- */
.ssm-student-calendar { display: flex; flex-direction: column; gap: 22px; }
.ssm-cal-month-title { font-size: 14px; font-weight: 700; color: var(--ssm-text); margin: 0 0 8px; }
.ssm-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
}
.ssm-cal-dow {
	font-size: 11px;
	font-weight: 700;
	text-align: center;
	color: var(--ssm-text-muted);
	padding-bottom: 2px;
}
.ssm-cal-day {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--ssm-text);
	background: var(--ssm-bg);
	cursor: default;
}
.ssm-cal-day--blank { background: transparent; }
.ssm-cal-day--present { background: var(--ssm-success-light); color: var(--ssm-success); }
.ssm-cal-day--absent { background: var(--ssm-danger-light); color: var(--ssm-danger); }
.ssm-cal-day--holiday { background: var(--ssm-warning-light); color: var(--ssm-warning); }
.ssm-cal-day--unmarked { background: var(--ssm-bg); color: var(--ssm-text-muted); }
.ssm-cal-day--upcoming { background: transparent; color: var(--ssm-text-muted); border: 1px dashed var(--ssm-border); }

/* ---------- Notifications: tile badge + in-view list (v2.8, rebuilt) ----------
   The Notifications tile itself lives in templates/student-dashboard.php
   next to the My Attendance tile — .ssm-tile already provides
   position:relative + overflow:hidden (see ssm-style.css), so the badge
   below only needs its own positioning, kept safely inside the tile's
   padding box (no negative offsets) so overflow:hidden never clips it.
   Everything else here styles content inside the tile's own full-screen
   view (.ssm-view-body), reusing .ssm-error/.ssm-student-loading/
   .ssm-student-empty-hint/.ssm-btn as-is, same as My Attendance does. */
.ssm-tile-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--ssm-danger);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.ssm-notif-actions-row {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 14px;
}

.ssm-notif-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.ssm-notif-item {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 14px 16px;
	border-radius: var(--ssm-radius-sm);
	background: var(--ssm-card);
	border: 1.5px solid var(--ssm-border);
	cursor: pointer;
	transition: border-color 0.16s var(--ssm-ease);
}
.ssm-notif-item--unread {
	border-color: var(--ssm-primary);
	background: var(--ssm-primary-light);
}
.ssm-notif-item-title {
	font-weight: 700;
	font-size: 14.5px;
	color: var(--ssm-text);
}
.ssm-notif-item-message {
	font-size: 13.5px;
	color: var(--ssm-text-muted);
}
.ssm-notif-item-time {
	font-size: 12px;
	color: var(--ssm-text-muted);
	margin-top: 2px;
}

/* ---------- v2.13 — Student Dashboard Banner (image carousel) ----------
   Sits between .ssm-welcome and #ssm-student-tiles in
   templates/student-dashboard.php, only ever rendered at all when there's
   at least one active banner. Uses the same --ssm-* tokens as the rest of
   this file for visual consistency with .ssm-welcome/.ssm-tile. Reduced-
   motion is already handled by ssm-style.css's blanket
   ".ssm-app, .ssm-app *" rule (both dashboards share the .ssm-app class),
   which caps these transitions/animations to near-zero under
   prefers-reduced-motion — the JS side (initStudentBannerCarousel() in
   ssm-student-app.js) additionally skips auto-rotation entirely in that
   case rather than relying on the CSS alone. */
.ssm-student-banner {
	position: relative;
	margin: 0 0 18px;
	border-radius: var(--ssm-radius);
	overflow: hidden;
	box-shadow: var(--ssm-shadow-sm);
	background: var(--ssm-card);
}
.ssm-banner-track {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 7;
}
.ssm-banner-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.45s var(--ssm-ease);
}
.ssm-banner-slide-active {
	opacity: 1;
	visibility: visible;
}
.ssm-banner-img,
.ssm-banner-link {
	display: block;
	width: 100%;
	height: 100%;
}
.ssm-banner-img {
	object-fit: cover;
	max-width: 100%;
}
.ssm-banner-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 10px;
	display: flex;
	justify-content: center;
	gap: 6px;
}
.ssm-banner-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	border: none;
	padding: 0;
	background: rgba(255, 255, 255, 0.55);
	cursor: pointer;
	transition: background 0.18s var(--ssm-ease), transform 0.18s var(--ssm-ease);
}
.ssm-banner-dot-active {
	background: #fff;
	transform: scale(1.25);
}
