/**
 * Student portal — phone, tablet and installed PWA layout.
 */

/* --- Installed app: drop marketing chrome --- */
@media (display-mode: standalone) {
	body.lh-page--student-account:has(.lh-student-portal) .lh-header,
	body.lh-page--student-account:has(.lh-student-portal) .lh-footer,
	body.lh-page--student-account:has(.lh-student-portal) .lh-floating-contact,
	body.lh-page--student-account:has(.lh-student-onboarding) .lh-header,
	body.lh-page--student-account:has(.lh-student-onboarding) .lh-footer,
	body.lh-page--student-account:has(.lh-student-onboarding) .lh-floating-contact {
		display: none !important;
	}

	body.lh-page--student-account:has(.lh-student-portal),
	body.lh-page--student-account:has(.lh-student-onboarding) {
		padding-bottom: env(safe-area-inset-bottom, 0);
	}
}

/* Phone / small tablet: leaner portal chrome in the browser too */
@media (max-width: 900px) {
	body.lh-page--student-account:has(.lh-student-portal) .lh-header,
	body.lh-page--student-account:has(.lh-student-portal) .lh-footer,
	body.lh-page--student-account:has(.lh-student-portal) .lh-floating-contact,
	body.lh-page--student-account:has(.lh-student-onboarding) .lh-header,
	body.lh-page--student-account:has(.lh-student-onboarding) .lh-footer,
	body.lh-page--student-account:has(.lh-student-onboarding) .lh-floating-contact,
	body.lh-student-app-body:has(.lh-student-portal) .lh-header,
	body.lh-student-app-body:has(.lh-student-portal) .lh-footer,
	body.lh-student-app-body:has(.lh-student-portal) .lh-floating-contact,
	body.lh-student-app-body:has(.lh-student-onboarding) .lh-header,
	body.lh-student-app-body:has(.lh-student-onboarding) .lh-footer,
	body.lh-student-app-body:has(.lh-student-onboarding) .lh-floating-contact {
		display: none;
	}

	body.lh-page--student-account:has(.lh-student-portal),
	body.lh-page--student-account:has(.lh-student-onboarding),
	body.lh-student-app-body:has(.lh-student-portal),
	body.lh-student-app-body:has(.lh-student-onboarding) {
		padding-bottom: env(safe-area-inset-bottom, 0);
	}

	.lh-page--student-account:has(.lh-student-portal),
	.lh-page--student-account:has(.lh-student-onboarding),
	body.lh-student-app-body:has(.lh-student-portal),
	body.lh-student-app-body:has(.lh-student-onboarding) {
		padding-block: 0.35rem;
	}

	.lh-student-account__header {
		display: none;
	}

	.lh-student-account__status {
		display: none;
	}

	.lh-student-portal__page {
		border: 0;
		border-radius: 0;
		box-shadow: none;
		padding: 0.65rem 0.85rem 1rem;
	}

	.lh-student-portal__nav {
		flex-wrap: nowrap;
		gap: 0;
		margin-bottom: 0.65rem;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.lh-student-portal__nav::-webkit-scrollbar {
		display: none;
	}

	.lh-student-portal__nav-link {
		flex-shrink: 0;
		font-size: 0.88rem;
		min-height: 44px;
		padding: 0.55rem 0.85rem;
	}

	.lh-student-portal__learner-head {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.35rem;
	}

	.lh-student-portal__next-cards {
		width: 100%;
	}

	.lh-student-portal__next-card {
		flex: 1 1 calc(50% - 0.25rem);
		min-width: 0;
	}
}

/* --- Tablet: book calendar without horizontal scroll --- */
@media (max-width: 900px) and (min-width: 641px) {
	.lh-bookings__stage--book .lh-week-calendar--student.lh-week-calendar--compact .lh-week-calendar__grid {
		grid-template-columns: 2rem repeat(7, minmax(0, 1fr));
		min-width: 0;
	}

	.lh-bookings__stage--book .lh-week-calendar__scroll {
		overflow-x: clip;
	}

	.lh-week-calendar__nav--arrows .lh-week-calendar__nav-arrow {
		min-height: 44px;
		min-width: 44px;
	}

	.lh-week-calendar__nav--arrows .lh-week-calendar__nav-today {
		height: 44px;
		min-height: 44px;
	}
}

/* --- Lessons calendar (month / list views) --- */
@media (max-width: 640px) {
	.lh-student-calendar__grid,
	.lh-student-calendar__month-grid {
		grid-template-columns: repeat(7, minmax(0, 1fr));
		overflow-x: clip;
	}

	.lh-student-calendar__month-day {
		min-width: 0;
		padding: 0.35rem 0.25rem;
	}

	.lh-student-calendar__month-head span {
		font-size: 0.72rem;
	}

	.lh-student-calendar__views a {
		min-height: 44px;
		padding: 0.45rem 0.85rem;
	}

	.lh-student-calendar__nav a {
		min-height: 44px;
		padding: 0.45rem 0.65rem;
	}
}

/* --- Book flow: fit week grid on narrow screens --- */
@media (max-width: 640px) {
	.lh-bookings__stage {
		padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0));
	}

	.lh-bookings__back {
		min-height: 44px;
		padding: 0.45rem 0;
	}

	.lh-bookings__choice {
		min-height: 44px;
	}

	.lh-bookings__stage--book .lh-week-calendar--student.lh-week-calendar--compact {
		--lh-week-hour-height: 34px;
	}

	.lh-bookings__stage--book .lh-week-calendar--student.lh-week-calendar--compact .lh-week-calendar__grid {
		grid-template-columns: 1.65rem repeat(7, minmax(0, 1fr));
		min-width: 0;
	}

	.lh-bookings__stage--book .lh-week-calendar--student.lh-week-calendar--compact .lh-week-calendar__day-headers,
	.lh-bookings__stage--book .lh-week-calendar--student.lh-week-calendar--compact .lh-week-calendar__days {
		grid-template-columns: repeat(7, minmax(0, 1fr));
	}

	.lh-bookings__stage--book .lh-week-calendar__scroll {
		overflow-x: clip;
	}

	.lh-bookings__stage--book .lh-week-calendar__day-name {
		font-size: 0.62rem;
	}

	.lh-bookings__stage--book .lh-week-calendar__day-date {
		font-size: 0.82rem;
	}

	.lh-bookings__stage--book .lh-week-calendar--student.lh-week-calendar--compact .lh-week-calendar__hour-label {
		font-size: 0.62rem;
	}

	.lh-week-calendar__nav--arrows .lh-week-calendar__nav-arrow {
		height: 2.75rem;
		min-height: 44px;
		min-width: 44px;
		width: 2.75rem;
	}

	.lh-week-calendar__nav--arrows .lh-week-calendar__nav-today {
		height: 2.75rem;
		min-height: 44px;
		padding: 0 0.85rem;
	}

	.lh-bookings__stage--book .lh-week-calendar__legend-help {
		height: 1.35rem;
		min-height: 44px;
		min-width: 44px;
		width: 1.35rem;
	}

	.lh-week-calendar--student .lh-week-calendar__event--available {
		min-height: 22px;
	}

	.lh-week-calendar--student .lh-week-calendar__event--available .lh-week-calendar__event-name {
		font-size: 0.64rem;
	}

	.lh-week-calendar__dialog {
		margin: max(1rem, env(safe-area-inset-top, 0)) auto max(1rem, env(safe-area-inset-bottom, 0));
		max-width: calc(100vw - 1.5rem - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
	}

	.lh-week-calendar__dialog-close {
		min-height: 44px;
		min-width: 44px;
	}

	.lh-week-calendar__booking-submit,
	.lh-week-calendar__booking-select {
		font-size: 1rem;
		min-height: 44px;
	}

	.lh-vacancy-alert__trigger,
	.lh-vacancy-alert__save.button,
	.lh-vacancy-alert__off,
	.lh-vacancy-alert__mode {
		min-height: 44px;
	}

	.lh-vacancy-alert__dates input {
		min-height: 44px;
	}

	.lh-holiday-days__list label {
		min-height: 44px;
	}

	.lh-help-tip__toggle {
		height: 44px;
		width: 44px;
	}
}

/* --- Settings: stack notification matrix on small screens --- */
@media (max-width: 639px) {
	.lh-notification-prefs__table,
	.lh-notification-prefs__table thead,
	.lh-notification-prefs__table tbody,
	.lh-notification-prefs__table tr,
	.lh-notification-prefs__table th,
	.lh-notification-prefs__table td {
		display: block;
		width: 100%;
	}

	.lh-notification-prefs__table thead {
		display: none;
	}

	.lh-notification-prefs__table tr {
		border: 1px solid #e8e2da;
		border-radius: 10px;
		margin-bottom: 0.65rem;
		padding: 0.55rem 0.65rem;
	}

	.lh-notification-prefs__table tbody th {
		border-bottom: 1px solid #ece8e2;
		margin-bottom: 0.35rem;
		padding-bottom: 0.35rem;
	}

	.lh-notification-prefs__table td {
		border: 0;
		display: flex;
		gap: 0.65rem;
		justify-content: space-between;
		padding: 0.35rem 0;
	}

	.lh-notification-prefs__table td::before {
		color: #6b625c;
		content: attr(data-label);
		font-size: 0.82rem;
		font-weight: 600;
	}

	.lh-notification-prefs__table td.lh-notification-prefs__push-col {
		justify-content: center;
	}

	.lh-notification-prefs__table td.lh-notification-prefs__push-col::before {
		display: none;
	}

	.lh-notification-prefs__check input {
		height: 1.35rem;
		width: 1.35rem;
	}
}

/* Legacy install banner padding — no longer used */
body.lh-pwa-banner-visible {
	padding-bottom: 0;
}
