/* System portal — כניסה מרכזית */

body.hm-portal-page {
	background: #0a1628;
	color: #e2e8f0;
}

body.hm-portal-page .hm-portal__hero-title,
body.hm-portal-page .hm-portal__intro-title {
	color: #f8fafc;
}

body.hm-portal-page .hm-portal__tagline,
body.hm-portal-page .hm-portal__intro-sub,
body.hm-portal-page .hm-portal__user-name {
	color: #cbd5e1;
}

body.admin-bar.hm-portal-page .hm-portal {
	min-height: calc(100vh - 32px);
}

.hm-portal {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem 1.25rem 2.5rem;
	overflow-x: clip;
	background:
		linear-gradient(180deg, rgb(10 22 40 / 55%) 0%, rgb(10 22 40 / 82%) 100%),
		var(--hm-portal-bg, none) center center / cover no-repeat fixed;
}

.hm-portal__shell {
	width: 100%;
	max-width: 1060px;
	margin: 0 auto;
	overflow-x: clip;
}

.hm-portal__hero {
	width: 100%;
	max-width: 100%;
}

/* ── Top bar: שלוש עמודות מאוזנות ── */
.hm-portal__top {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 0.75rem 1rem;
	margin-bottom: 2rem;
}

.hm-portal__top-slot--start {
	justify-self: start;
}

.hm-portal__top-slot--end {
	justify-self: end;
}

.hm-portal__brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	grid-column: 2;
}

/* ── Hero: לוגו + אווטר "שם יד" על AI ── */
.hm-portal__hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.45rem;
}

.hm-portal__hero-logo {
	position: relative;
	display: inline-block;
	direction: rtl;
	padding-top: clamp(4.5rem, 12vw, 6.25rem);
}

.hm-portal__hero-title {
	font-family: var(--hm-font-display);
	font-size: clamp(2.65rem, 7.2vw, 3.65rem);
	font-weight: 900;
	margin: 0;
	line-height: 0.92;
	display: inline-flex;
	align-items: flex-end;
	flex-wrap: nowrap;
	white-space: nowrap;
	gap: 0.3rem;
	direction: rtl;
	letter-spacing: -0.02em;
	text-shadow: 0 2px 18px rgb(0 0 0 / 28%);
	position: relative;
	z-index: 1;
}

.hm-portal__hero-word {
	display: inline;
	white-space: nowrap;
	color: #f8fafc;
}

.hm-portal__hero-he {
	position: relative;
	display: inline-block;
}

.hm-portal__hero-ai {
	background: linear-gradient(135deg, #38bdf8 0%, #818cf8 45%, #c084fc 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-size: 1.1em;
	font-weight: 900;
	padding-inline-end: 0.15rem;
}

.hm-portal__hero-mascot {
	--hm-hero-foot-x: 45.79%;
	--hm-hero-foot-y: 87.81%;
	position: absolute;
	left: 100%;
	top: 100%;
	transform: translate(calc(-1 * var(--hm-hero-foot-x)), calc(-1 * var(--hm-hero-foot-y))) translateY(-5px);
	z-index: 2;
	line-height: 0;
	pointer-events: none;
	filter: drop-shadow(0 8px 18px rgb(0 0 0 / 28%));
}

.hm-portal__hero-mascot-img,
.hm-portal__hero-mascot .hm-mascot-img {
	width: auto;
	height: clamp(156px, 22vw, 210px);
	display: block;
}

.hm-portal__tagline {
	margin: 0;
	color: #cbd5e1;
	font-size: 0.95rem;
	max-width: 28rem;
	line-height: 1.45;
	text-align: center;
}

/* ניהול מערכת — קישור קטן, לא כפתור ענק */
.hm-portal__admin-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.4rem 0.75rem;
	border-radius: 8px;
	font-size: 0.8rem;
	font-weight: 600;
	color: #475569;
	text-decoration: none;
	border: 1px solid #cbd5e1;
	background: rgb(255 255 255 / 70%);
	white-space: nowrap;
	transition: background 0.15s, border-color 0.15s;
}

.hm-portal__admin-link:hover {
	color: #1e293b;
	background: #fff;
	border-color: #94a3b8;
}

.hm-portal__admin-link .hm-portal__admin-icon,
.hm-portal__admin-link .hm-icon {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
	opacity: 0.85;
}

.hm-portal__user {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.15rem;
	font-size: 0.8rem;
}

.hm-portal__user-name {
	font-weight: 600;
	color: var(--hm-text);
}

.hm-portal__logout {
	color: var(--hm-muted);
	text-decoration: none;
	font-size: 0.75rem;
}

.hm-portal__logout:hover {
	color: var(--hm-primary);
	text-decoration: underline;
}

/* ── Intro ── */
.hm-portal__intro {
	text-align: center;
	margin-bottom: 1.5rem;
}

.hm-portal__intro-title {
	font-family: var(--hm-font-display);
	font-size: 1.35rem;
	font-weight: 700;
	margin: 0 0 0.35rem;
	color: var(--hm-text);
}

.hm-portal__intro-sub {
	margin: 0;
	color: var(--hm-muted);
	font-size: 0.95rem;
}

/* ── Cards ── */
.hm-portal__cards {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
}

.hm-portal-card {
	position: relative;
	display: block;
	padding: 0.85rem 1rem 0.85rem 0.65rem;
	border-radius: 16px;
	background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
	border: 1px solid var(--hm-border);
	box-shadow: 0 4px 20px rgb(15 23 42 / 6%);
	text-decoration: none;
	color: inherit;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
	min-height: 14.25rem;
	overflow: visible;
	direction: ltr;
}

.hm-portal-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 32px rgb(15 23 42 / 10%);
	color: inherit;
}

.hm-portal-card--student:hover {
	border-color: rgb(6 182 212 / 40%);
}

.hm-portal-card--institution:hover {
	border-color: rgb(37 99 235 / 35%);
}

.hm-portal-card--teacher:hover {
	border-color: rgb(124 58 237 / 35%);
}

.hm-portal-card__mascot-col {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 11.5rem;
	display: flex;
	align-items: flex-end;
	justify-content: flex-start;
	padding-bottom: 0.1rem;
	pointer-events: none;
	z-index: 1;
}

.hm-portal-card__body {
	display: flex;
	flex-direction: column;
	direction: rtl;
	text-align: right;
	min-width: 0;
	min-height: 14.25rem;
	margin-left: 6.75rem;
	position: relative;
	z-index: 2;
}

.hm-portal-card__badge {
	align-self: flex-start;
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 0.25rem 0.55rem;
	border-radius: 999px;
	margin-bottom: 0.4rem;
}

.hm-portal-card__badge--student {
	background: rgb(6 182 212 / 12%);
	color: #0e7490;
}

.hm-portal-card__badge--inst {
	background: rgb(37 99 235 / 10%);
	color: #1d4ed8;
}

.hm-portal-card__badge--teacher {
	background: rgb(124 58 237 / 10%);
	color: #6d28d9;
}

.hm-portal-card__mascot {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	line-height: 0;
}

.hm-portal-card__mascot-img {
	width: auto;
	height: 200px;
	max-width: none;
	object-fit: contain;
	object-position: bottom left;
	filter: drop-shadow(0 6px 14px rgb(15 23 42 / 12%));
	transition: transform 0.22s ease, filter 0.22s ease;
	margin-left: -0.75rem;
}

.hm-portal-card--institution .hm-portal-card__mascot-img {
	height: 206px;
}

.hm-portal-card:hover .hm-portal-card__mascot-img {
	transform: translateY(-4px) scale(1.04);
	filter: drop-shadow(0 10px 18px rgb(15 23 42 / 16%));
}

.hm-portal-card__title {
	font-size: 1.12rem;
	font-weight: 700;
	margin: 0 0 0.35rem;
	color: var(--hm-text);
	line-height: 1.25;
}

.hm-portal-card__desc {
	margin: 0 0 0.35rem;
	color: var(--hm-text);
	font-size: 0.84rem;
	line-height: 1.5;
	font-weight: 500;
}

.hm-portal-card__meta {
	margin: auto 0 0.4rem;
	color: var(--hm-muted);
	font-size: 0.76rem;
	line-height: 1.4;
}

.hm-portal-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.86rem;
	font-weight: 700;
	margin-top: 0;
	align-self: flex-start;
}

.hm-portal-card--student .hm-portal-card__cta {
	color: #0891b2;
}

.hm-portal-card--institution .hm-portal-card__cta {
	color: #2563eb;
}

.hm-portal-card--teacher .hm-portal-card__cta {
	color: #7c3aed;
}

.hm-portal-card__arrow {
	font-size: 1rem;
	transition: transform 0.15s ease;
}

.hm-portal-card:hover .hm-portal-card__arrow {
	transform: translateX(-3px);
}

.hm-portal__hint {
	text-align: center;
	margin: 1.25rem 0 0;
	font-size: 0.85rem;
	color: var(--hm-muted);
}

/* ── Responsive ── */

@media (max-width: 900px) {
	.hm-portal {
		padding: 1.25rem 1rem 2rem;
		background-attachment: scroll;
	}

	.hm-portal__top {
		margin-bottom: 1.5rem;
	}

	.hm-portal__hero-mascot-img,
	.hm-portal__hero-mascot .hm-mascot-img {
		height: clamp(112px, 15vw, 142px);
	}

	.hm-portal-card {
		min-height: 12.5rem;
	}

	.hm-portal-card__body {
		min-height: 12.5rem;
		margin-left: 6.5rem;
	}

	.hm-portal-card__mascot-col {
		width: 9.5rem;
	}

	.hm-portal-card__mascot-img {
		height: 148px;
	}

	.hm-portal-card--institution .hm-portal-card__mascot-img {
		height: 154px;
	}
}

@media (max-width: 900px) and (min-width: 601px) {
	.hm-portal__cards {
		grid-template-columns: 1fr 1fr;
		gap: 0.85rem;
	}

	.hm-portal-card--institution {
		grid-column: 1 / -1;
	}

}

@media (max-width: 600px) {
	body.admin-bar.hm-portal-page .hm-portal {
		min-height: calc(100dvh - 46px);
	}

	.hm-portal {
		align-items: flex-start;
		padding: 0.65rem 0.75rem 1.5rem;
	}

	.hm-portal__top {
		grid-template-columns: 1fr 1fr;
		grid-template-rows: auto auto;
		align-items: start;
		margin-bottom: 0.65rem;
		gap: 0.3rem 0.6rem;
	}

	.hm-portal__top-slot--start {
		justify-self: start;
		grid-column: 1;
		grid-row: 1;
	}

	.hm-portal__top-slot--end {
		justify-self: end;
		grid-column: 2;
		grid-row: 1;
	}

	.hm-portal__brand {
		grid-column: 1 / -1;
		grid-row: 2;
		margin-top: 0.25rem;
	}

	.hm-portal__admin-link {
		padding: 0.22rem 0.42rem;
		font-size: 0.64rem;
		gap: 0.22rem;
		border-radius: 6px;
	}

	.hm-portal__admin-link .hm-portal__admin-icon,
	.hm-portal__admin-link .hm-icon {
		width: 11px;
		height: 11px;
	}

	.hm-portal__user {
		align-items: flex-end;
		font-size: 0.64rem;
		gap: 0.05rem;
	}

	.hm-portal__user-name {
		font-size: 0.67rem;
		max-width: 8.5rem;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.hm-portal__logout {
		font-size: 0.6rem;
	}

	.hm-portal__intro {
		margin-bottom: 0.75rem;
	}

	.hm-portal__intro-title {
		font-size: 1.08rem;
	}

	.hm-portal__intro-sub {
		font-size: 0.84rem;
	}

	.hm-portal__hero-title {
		font-size: clamp(2.35rem, 12vw, 3.1rem);
	}

	.hm-portal__hero-logo {
		padding-top: clamp(5.1rem, 26vw, 6.6rem);
	}

	.hm-portal__hero-mascot-img,
	.hm-portal__hero-mascot .hm-mascot-img {
		height: clamp(138px, 32vw, 176px);
	}

	.hm-portal__tagline {
		font-size: 0.8rem;
		padding: 0 0.25rem;
		line-height: 1.4;
	}

	.hm-portal__cards {
		grid-template-columns: 1fr;
		gap: 0.55rem;
	}

	.hm-portal-card {
		min-height: 0;
		padding: 0.48rem 0.65rem 0.48rem 0.28rem;
	}

	.hm-portal-card__body {
		min-height: 0;
		margin-left: 5.85rem;
	}

	.hm-portal-card__mascot-col {
		width: 6.1rem;
	}

	.hm-portal-card__mascot-img {
		height: 98px;
		margin-left: -0.45rem;
	}

	.hm-portal-card--institution .hm-portal-card__mascot-img {
		height: 102px;
	}

	.hm-portal-card__badge {
		margin-bottom: 0.18rem;
		font-size: 0.6rem;
		padding: 0.16rem 0.42rem;
	}

	.hm-portal-card__title {
		font-size: 0.94rem;
		margin-bottom: 0.18rem;
		line-height: 1.2;
	}

	.hm-portal-card__desc {
		font-size: 0.74rem;
		line-height: 1.32;
		margin-bottom: 0.15rem;
	}

	.hm-portal-card__meta {
		margin: 0.12rem 0 0.08rem;
		font-size: 0.66rem;
	}

	.hm-portal-card__cta {
		font-size: 0.76rem;
	}
}

@media (max-width: 380px) {
	.hm-portal__hero-title {
		font-size: clamp(2.05rem, 11.5vw, 2.55rem);
	}

	.hm-portal__hero-logo {
		padding-top: clamp(4.5rem, 24vw, 5.75rem);
	}

	.hm-portal__hero-mascot-img,
	.hm-portal__hero-mascot .hm-mascot-img {
		height: clamp(118px, 30vw, 148px);
	}

	.hm-portal-card__body {
		margin-left: 5.35rem;
	}

	.hm-portal-card__mascot-col {
		width: 5.6rem;
	}

	.hm-portal-card__mascot-img {
		height: 88px;
	}

	.hm-portal-card--institution .hm-portal-card__mascot-img {
		height: 92px;
	}

	.hm-portal-card__desc,
	.hm-portal-card__meta {
		font-size: 0.7rem;
	}
}

/* Teacher topbar — שם המורה בולט */
.hm-topbar--teacher .hm-topbar__title {
	font-size: 1.65rem;
}

.hm-topbar__teacher-greet {
	display: block;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--hm-muted);
	margin-bottom: 0.15rem;
}

.hm-teacher-unlinked {
	padding: 2rem;
	text-align: center;
	color: var(--hm-muted);
}

.hm-app--teacher .hm-teacher-main {
	padding: 1.25rem;
}

.hm-teacher-chat-wrap {
	max-width: 480px;
	margin: 0 auto;
}

.hm-teacher-panel[hidden] {
	display: none !important;
}

.hm-mirror__phone--teacher {
	max-width: 100%;
}
