/* ==========================================================================
   Trang đăng nhập – tinh chỉnh cho mobile
   Nạp sau style.css, chỉ dùng ở views/web/Auth/login.ejs
   ========================================================================== */

/* Trang này không dùng layout chung nên phải gỡ padding mặc định của app.css */
body {
	padding: 0 !important;
}

/* --- Bố cục nền ---------------------------------------------------------- */
.account {
	min-height: 100vh;
	min-height: 100dvh; /* 100vh bị thanh địa chỉ trình duyệt mobile cắt mất */
	padding: 24px 0 calc(24px + env(safe-area-inset-bottom));
}

/* Mobile: card trắng tràn hết chiều ngang, vuông góc.
   Từ 576px trở lên trả lại dạng thẻ có lề và bo góc 30px như thiết kế gốc.
   Safe-area chuyển vào trong card vì card đã chạm sát mép màn hình. */
.account-wrapper {
	width: 100%;
	max-width: 600px;
	margin: auto; /* margin auto thay vì align-items để nội dung dài không bị cắt mất phần trên */
	padding: 28px calc(20px + env(safe-area-inset-right)) 28px calc(20px + env(safe-area-inset-left));
	border-radius: 0;
}

.account-logo {
	text-align: center;
}

.account-logo img {
	width: auto;
	max-width: 100%;
	max-height: 72px;
	margin-left: auto; /* img là block nên text-align của cha không căn giữa được */
	margin-right: auto;
}

/* --- Form ---------------------------------------------------------------- */
.account-form {
	margin-top: 28px;
}

.account-form__label {
	display: block;
	padding: 0;
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #2d2d2d;
}

.account-form__group + .account-form__group {
	margin-top: 18px;
}

/* Ô nhập: bỏ bo góc, cao 52px để chạm thoải mái trên mobile */
.account-form__control {
	display: block;
	width: 100%;
	min-height: 52px;
	padding: 0 14px;
	border: 1px solid #c9d2e0;
	border-radius: 12px;
	background-color: #fff;
	color: #2d2d2d;
	font-size: 16px; /* dưới 16px sẽ khiến iOS tự phóng to trang khi focus */
	line-height: 1.4;
	box-shadow: none; /* ô tên đăng nhập có class .form-control nên vốn bị đổ bóng nhẹ, bỏ đi cho khớp ô mật khẩu */
}

.account-form__control:focus,
.account-form__control:focus-visible {
	border-color: #c9d2e0;
	box-shadow: none;
	outline: none;
}

.account-form ::placeholder {
	color: #6b7280; /* màu #b8b7d8 cũ chỉ đạt 1.8:1, dưới ngưỡng 4.5:1 */
	opacity: 1;
}

/* Bọc ô mật khẩu: viền nằm trên chính input, nhờ vậy dòng báo lỗi
   xuống được hàng dưới mà vẫn là con trực tiếp của wrapper */
.account-form__info {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	min-height: 0;
	padding: 0;
	border: 0;
	background-color: transparent;
}

.account-form__info > .account-form__input {
	flex: 1 1 100%;
	padding-right: 52px; /* chừa chỗ cho nút hiện/ẩn mật khẩu */
}

.account-form__info > .invalid-feedback {
	flex: 1 1 100%;
}

/* --- Nút hiện/ẩn mật khẩu ------------------------------------------------ */
.account-form__eye {
	position: absolute;
	top: 0;
	right: 0;
	transform: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 52px;
	padding: 0;
	border: 0;
	background-color: transparent;
	color: #6b7280;
	cursor: pointer;
	touch-action: manipulation;
}

.account-form__eye .eye-icon.hide {
	display: none;
}

/* --- Checkbox ------------------------------------------------------------ */
.account-form__check {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0;
	cursor: pointer;
	touch-action: manipulation;
}

/* Control gốc của trình duyệt luôn bo góc, nên vẽ lại ô vuông cho đồng bộ */
.account-form__check input[type='checkbox'] {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
	border: 1px solid #c9d2e0;
	border-radius: 4px;
	background-color: #fff;
}

.account-form__check input[type='checkbox']:checked {
	border-color: #154397;
	background-color: #154397;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.5 3.5L13 5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 14px 14px;
}

.account-form__check span {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color: #2d2d2d;
}

/* --- Nút đăng nhập ------------------------------------------------------- */
.account-form__btn {
	width: 100%;
	min-height: 52px;
	margin-top: 24px;
	padding: 14px 16px;
	border: 1px solid #103a83;
	border-radius: 10px;
	font-size: 16px;
	line-height: 1.25;
	box-shadow: 0 1px 2px rgba(16, 58, 131, 0.28);
	touch-action: manipulation;
	transition: filter 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.account-form__btn:hover {
	filter: brightness(1.07);
	box-shadow: 0 2px 6px rgba(16, 58, 131, 0.32);
}

/* Lún xuống khi nhấn để có phản hồi rõ trên cảm ứng */
.account-form__btn:active {
	filter: brightness(0.92);
	transform: translateY(1px);
	box-shadow: none;
}

/* --- Báo lỗi validate ---------------------------------------------------- */
.account-form .invalid-feedback {
	display: block;
	width: 100%;
	margin: 6px 0 0;
	font-size: 13px;
	line-height: 1.4;
	color: #b02a37;
}

/* Thẻ báo lỗi luôn có sẵn trong HTML, chỉ chiếm chỗ khi script đổ nội dung vào */
.account-form .invalid-feedback:empty {
	display: none;
}

.account-form__control.is-invalid {
	border-color: #dc3545;
}

/* --- Khối tải ứng dụng di động ------------------------------------------- */
.account-app {
	margin-top: 28px;
	padding-top: 20px;
	border-top: 1px solid #e3e9f1;
	text-align: center;
}

.account-app__text {
	margin: 0 0 12px;
	font-size: 14px;
	line-height: 1.5;
	color: #4b5563;
}

.account-app__link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 12px 16px;
	border: 1px solid #154397;
	border-radius: 10px;
	background-color: #fff;
	color: #154397;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	touch-action: manipulation;
	transition: background-color 0.18s ease;
}

.account-app__link:hover,
.account-app__link:active {
	background-color: #eef3fb;
	color: #154397;
}

.account-app__link svg {
	flex: 0 0 auto;
}

/* --- Focus nhìn thấy được ------------------------------------------------ */
.account-form__check input:focus-visible,
.account-form__eye:focus-visible,
.account-form__btn:focus-visible,
.account-app__link:focus-visible {
	outline: 2px solid #154397;
	outline-offset: 2px;
}

/* --- Từ tablet trở lên: trả lại dạng thẻ căn giữa (vẫn không bo góc) ------ */
@media only screen and (min-width: 576px) {
	.account {
		padding-left: 16px;
		padding-right: 16px;
	}

	.account-wrapper {
		padding: 40px;
		border-radius: 30px;
	}

	.account-logo img {
		max-height: 103px;
	}

	.account-form {
		margin-top: 40px;
	}

	.account-form__group + .account-form__group {
		margin-top: 26px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.account-form__btn,
	.account-app__link {
		transition: none;
	}

	.account-form__btn:active {
		transform: none;
	}
}
