/*
Theme Name: Times Schools Portal
Theme URI: https://timesschools.edu.vn/
Author: Times Schools
Description: Trang cổng (landing) Hệ thống Giáo dục Times Schools — nền đỏ/xanh, 4 thẻ dẫn tới 4 trường. Tùy chỉnh ảnh, tên trường, đường link tại Giao diện → Tùy biến → Times Schools Portal.
Version: 1.2.1
Requires at least: 5.8
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: timesschools-portal
*/

:root {
	--ts-red: #d0202a;
	--ts-red-dark: #a3161f;
	--ts-navy: #0f2c5c;
	--ts-white: #ffffff;
	--ts-radius: 22px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.ts-portal {
	min-height: 100vh;
	font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--ts-white);
	background: var(--ts-navy);
	-webkit-font-smoothing: antialiased;
}

.ts-stage {
	position: relative;
	min-height: 100vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background:
		radial-gradient(120% 90% at 0% 0%, #e0262f 0%, rgba(224, 38, 47, 0) 60%),
		linear-gradient(115deg, var(--ts-red) 0%, var(--ts-red) 38%, #8e1c3a 62%, #3a2856 76%, var(--ts-navy) 92%);
}

/* Flowing wave lines */
.ts-waves {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	opacity: .55;
	mix-blend-mode: screen;
}

/* Top bar */
.ts-top {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 22px clamp(16px, 4vw, 48px);
}

.ts-badge {
	display: inline-flex;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	padding: 3px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.ts-badge img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }

.ts-cta {
	display: inline-block;
	padding: 8px 18px;
	border: 1.5px solid rgba(255, 255, 255, .85);
	border-radius: 999px;
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .2px;
	transition: background .25s, color .25s;
}
.ts-cta:hover, .ts-cta:focus-visible { background: #fff; color: var(--ts-red); }

/* Main */
.ts-main {
	position: relative;
	z-index: 2;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0 clamp(16px, 4vw, 48px) 24px;
	text-align: center;
}

/* Default: crop the shield out of the site's white horizontal logo (logoww.png) */
.ts-logo {
	--s: clamp(96px, 9vw, 130px);
	width: var(--s);
	aspect-ratio: 1 / 1;
	background-repeat: no-repeat;
	background-size: auto 165%;
	background-position: calc(var(--s) * -0.31) 42%;
	-webkit-mask-image: radial-gradient(circle closest-side, #000 97%, transparent 100%);
	mask-image: radial-gradient(circle closest-side, #000 97%, transparent 100%);
	margin: 0 auto 14px;
}
.ts-logo--img { background: none; -webkit-mask-image: none; mask-image: none; }
.ts-logo--img img { width: 100%; height: 100%; object-fit: contain; }

.ts-title {
	margin: 0 0 clamp(24px, 4vh, 44px);
	font-size: clamp(20px, 2.4vw, 32px);
	font-weight: 700;
	letter-spacing: .5px;
	text-transform: uppercase;
	text-shadow: 0 2px 12px rgba(0, 0, 0, .2);
}

.ts-cards {
	list-style: none;
	margin: 0 auto;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(14px, 1.8vw, 28px);
	width: 100%;
	max-width: 1180px;
}

.ts-card {
	position: relative;
	display: block;
	aspect-ratio: 3 / 4;
	border-radius: var(--ts-radius);
	overflow: hidden;
	color: #fff;
	text-decoration: none;
	text-align: left;
	background: #222;
	box-shadow: 0 14px 34px rgba(0, 0, 0, .3);
	transform: translateY(0);
	transition: transform .35s ease, box-shadow .35s ease;
	isolation: isolate;
}
.ts-card img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .6s ease;
	z-index: -2;
}
.ts-card::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(180deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .72) 100%);
}
.ts-card:hover, .ts-card:focus-visible {
	transform: translateY(-8px);
	box-shadow: 0 22px 44px rgba(0, 0, 0, .4);
	outline: none;
}
.ts-card:hover img, .ts-card:focus-visible img { transform: scale(1.07); }
.ts-card:focus-visible { box-shadow: 0 0 0 3px #fff, 0 22px 44px rgba(0, 0, 0, .4); }

.ts-card__text {
	position: absolute;
	left: clamp(12px, 1.4vw, 20px);
	right: clamp(12px, 1.4vw, 20px);
	bottom: clamp(14px, 1.6vw, 22px);
}
.ts-card__sub {
	display: block;
	font-size: clamp(12px, 1.05vw, 15px);
	font-weight: 600;
	line-height: 1.3;
	opacity: .95;
}
.ts-card__name {
	display: block;
	margin-top: 4px;
	font-size: clamp(18px, 1.9vw, 27px);
	font-weight: 700;
	line-height: 1.1;
	text-transform: uppercase;
	letter-spacing: .3px;
}

.ts-slogan {
	margin: clamp(22px, 4vh, 40px) 0 0;
	font-size: clamp(15px, 1.5vw, 20px);
	font-weight: 500;
}

.ts-foot {
	position: relative;
	z-index: 2;
	padding: 14px 16px 22px;
	text-align: center;
	font-size: 12px;
	opacity: .8;
}

/* Tablet: 2 x 2 */
@media (max-width: 900px) {
	.ts-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; }
	.ts-card { aspect-ratio: 4 / 4.2; }
}

/* Phone */
@media (max-width: 480px) {
	.ts-top { padding: 16px; }
	.ts-cta { font-size: 13px; padding: 7px 14px; }
	.ts-cards { gap: 12px; }
	.ts-card { aspect-ratio: 3 / 3.6; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.ts-card, .ts-card img { transition: none; }
}

/* ===== Popup "Đăng ký tư vấn" ===== */
html.ts-lock { overflow: hidden; }
.ts-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 52px 16px 16px;
	overflow-y: auto;
	opacity: 0;
	transition: opacity .2s ease;
}
.ts-modal[hidden] { display: none; }
.ts-modal.is-open { opacity: 1; }
.ts-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(10, 18, 40, .6);
	backdrop-filter: blur(3px);
}
.ts-modal__box {
	position: relative;
	width: 100%;
	max-width: 440px;
	margin: auto;
	padding: 54px 26px 26px;
	border-radius: 18px;
	background: #fff;
	color: #1d2433;
	text-align: center;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
	transform: translateY(14px) scale(.98);
	transition: transform .25s ease;
}
.ts-modal.is-open .ts-modal__box { transform: none; }
.ts-modal__logo {
	position: absolute;
	top: 0;
	left: 50%;
	width: 76px;
	height: 76px;
	margin: -38px 0 0 -38px;
	border-radius: 50%;
	background: #fff;
	padding: 3px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.ts-modal__x {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #6b7280;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}
.ts-modal__x:hover { background: #f3f4f6; color: #111; }
.ts-modal__title {
	margin: 0;
	color: var(--ts-red);
	font-size: 22px;
	font-weight: 700;
}
.ts-modal__sub {
	margin: 4px 0 18px;
	font-size: 13.5px;
	font-weight: 600;
	color: #374151;
}
.ts-form { text-align: left; }
.ts-field { margin-bottom: 10px; }
.ts-form input,
.ts-form select,
.ts-form textarea {
	width: 100%;
	padding: 11px 14px;
	border: 1.5px solid #e6a3a7;
	border-radius: 8px;
	background: #fff;
	color: #1d2433;
	font: 600 14px/1.35 "Quicksand", system-ui, sans-serif;
	transition: border-color .2s, box-shadow .2s;
}
.ts-form select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23d0202a' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 36px; }
.ts-form textarea { resize: vertical; min-height: 64px; }
.ts-form input::placeholder, .ts-form textarea::placeholder { color: #6b7280; }
.ts-form input:focus, .ts-form select:focus, .ts-form textarea:focus {
	outline: none;
	border-color: var(--ts-red);
	box-shadow: 0 0 0 3px rgba(208, 32, 42, .15);
}
.ts-form .is-invalid { border-color: #dc2626; background-color: #fff5f5; }
.ts-err { display: block; min-height: 0; margin-top: 3px; color: #dc2626; font-size: 12.5px; font-weight: 600; }
.ts-err:empty { display: none; }
.ts-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ts-submit {
	width: 100%;
	margin-top: 6px;
	padding: 13px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--ts-red);
	color: #fff;
	font: 700 15px "Quicksand", system-ui, sans-serif;
	text-transform: uppercase;
	letter-spacing: .4px;
	cursor: pointer;
	transition: background .2s;
}
.ts-submit:hover { background: #b0161f; }
.ts-submit:disabled { opacity: .7; cursor: wait; }
.ts-msg { margin: 10px 0 0; font-size: 14px; font-weight: 600; text-align: center; }
.ts-msg:empty { display: none; }
.ts-msg.is-ok { color: #15803d; font-size: 15px; }
.ts-msg.is-bad { color: #dc2626; }
.ts-form.is-done .ts-field, .ts-form.is-done .ts-submit { display: none; }
.ts-form.is-done .ts-msg { margin: 8px 0 4px; }
@media (max-width: 480px) {
	.ts-modal__box { padding: 50px 18px 20px; }
	.ts-modal__title { font-size: 20px; }
}
