/* Mobile bottom-nav login sheet (include/login_sheet.php, assets_web/js/app/login-sheet.js).
   Colours and controls follow the /login page (signup.php). */

.login-sheet-overlay {
	position: fixed;
	inset: 0;
	z-index: 10040;
	background: rgba(15, 23, 42, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.login-sheet-overlay.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.3s ease, visibility 0s;
}

/* Above the bottom nav and chat buttons, below the "Welcome back" toast (.ma-toast) */
.login-sheet {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10045;
	display: flex;
	flex-direction: column;
	max-width: 480px;
	max-height: 90vh;
	max-height: 90dvh;
	margin: 0 auto;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	background: #fff;
	border-radius: 20px 20px 0 0;
	box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
	overscroll-behavior: contain;
	transform: translateY(100%);
	visibility: hidden;
	transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.32s;
}

.login-sheet.is-open {
	transform: translateY(0);
	visibility: visible;
	transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s;
}

/* Follows the finger while it is dragged down */
.login-sheet.is-dragging {
	transition: none;
}

.login-sheet-grab {
	flex-shrink: 0;
	padding: 8px 16px 0;
	touch-action: none;
}

.login-sheet-handle {
	width: 40px;
	height: 5px;
	margin: 0 auto 6px;
	border-radius: 3px;
	background: #d1d5db;
}

.login-sheet-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.login-sheet-title {
	margin: 0;
	color: #1f2937;
	font-size: 1.25rem;
	font-weight: 700;
}

.login-sheet-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	color: #333;
	background: #f1f5f1;
	border: 0;
	border-radius: 50%;
	font-size: 16px;
}

.login-sheet-close:focus-visible,
.login-sheet-tab:focus-visible,
.login-sheet-submit:focus-visible {
	outline: 2px solid #2E8B57;
	outline-offset: 2px;
}

.login-sheet-body {
	flex: 1 1 auto;
	padding: 14px 16px 20px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.login-sheet-tabs {
	display: flex;
	gap: 10px;
	margin-bottom: 18px;
}

.login-sheet-tab {
	flex: 1;
	min-height: 44px;
	padding: 8px 12px;
	color: #2E8B57;
	background: #fff;
	border: 2px solid #2E8B57;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 600;
	transition: background-color 0.2s, color 0.2s;
}

.login-sheet-tab.active {
	color: #fff;
	background: #2E8B57;
}

/* Quick fade-in when switching Login / Create Account starts the form over */
#loginSheetAuth.is-refreshing {
	animation: login-sheet-refresh 0.25s ease-out;
}

@keyframes login-sheet-refresh {
	from {
		opacity: 0;
		transform: translateY(6px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.login-sheet-step-title {
	margin: 0 0 14px;
	color: #2E8B57;
	font-size: 1.2rem;
	font-weight: 700;
}

.login-sheet-group {
	margin-bottom: 18px;
}

.login-sheet-phone {
	display: flex;
	align-items: center;
	gap: 10px;
}

.login-sheet-country {
	padding: 12px 6px;
	color: #666;
	border-bottom: 2px solid #e0e0e0;
	font-size: 1.15rem;
	font-weight: 600;
}

/* 1.15rem keeps the text above 16px, so iPhones don't zoom in on focus */
.login-sheet-input {
	width: 100%;
	min-width: 0;
	padding: 12px 4px;
	color: #212529;
	background: transparent;
	border: 0;
	border-bottom: 2px solid #e0e0e0;
	border-radius: 0;
	font-size: 1.15rem;
	font-weight: 600;
	transition: border-color 0.2s;
}

.login-sheet-input:focus {
	outline: none;
	border-bottom-color: #2E8B57;
}

.login-sheet-input::placeholder {
	color: #999;
	font-weight: 500;
}

.login-sheet-otp {
	color: #2E8B57;
	text-align: center;
	letter-spacing: 8px;
}

.login-sheet-otp::placeholder {
	letter-spacing: normal;
}

.login-sheet-error {
	margin-top: 6px;
	color: #d32f2f;
	font-size: 0.95rem;
	font-weight: 600;
}

.login-sheet-error:empty {
	display: none;
}

.login-sheet-sent-to {
	margin-bottom: 8px;
	font-size: 1rem;
}

.login-sheet-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	padding: 12px 20px;
	color: #fff;
	background: #2E8B57;
	border: 0;
	border-radius: 8px;
	font-size: 1.1rem;
	font-weight: 700;
	transition: background-color 0.2s;
}

.login-sheet-submit:hover:not(:disabled) {
	background: #228B22;
}

.login-sheet-submit:disabled {
	background: #9e9e9e;
	cursor: not-allowed;
}

.login-sheet-resend {
	margin-top: 6px;
	text-align: center;
}

/* The page behind the open sheet stays put */
html.login-sheet-locked,
html.login-sheet-locked body {
	overflow: hidden;
}

/* The Krishi Salahkar chat widget (crop-master widget.js) sits at the top z-index
   and would cover the sheet's buttons; it comes back when the sheet closes */
html.login-sheet-locked #crop-master-widget {
	visibility: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
	.login-sheet,
	.login-sheet.is-open,
	.login-sheet-overlay,
	.login-sheet-overlay.is-open {
		transition: none;
	}

	#loginSheetAuth.is-refreshing {
		animation: none;
	}
}
