/* CheckoutGuard payment method popup — shared look for classic and block checkout. */

/* Applied to <body> while the modal is open — see lockBodyScroll() in
   shapla-classic-payment-modal.js. `top` is set inline (the saved
   scroll offset) alongside this class. */
body.shapla-body-scroll-locked {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
	overflow: hidden;
}

.shapla-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;

	/* Hidden via opacity/visibility (not display:none) so opening/closing
	   can transition instead of snapping — the JS toggles the .is-open
	   class (see openModal()/closeModal()), not jQuery show()/hide(). */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.shapla-modal-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: opacity 0.2s ease;
}

.shapla-modal {
	background: #fff;
	border-radius: 12px;
	max-width: 640px;
	width: 100%;
	max-height: 88vh;
	padding: 0;
	position: relative;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);

	/* Header/tabs stay fixed; only .shapla-modal-body's own columns
	   scroll — keeps the close button anchored in normal flow instead of
	   floating over content that can scroll out from under it. */
	display: flex;
	flex-direction: column;
	overflow: hidden;

	transform: translateY(16px) scale(0.98);
	transition: transform 0.2s ease;
}

.shapla-modal-overlay.is-open .shapla-modal {
	transform: translateY(0) scale(1);
}

.shapla-modal-drag-handle {
	display: none;
}

.shapla-modal-header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid #eee;
}

.shapla-modal-header h2 {
	margin: 0;
	font-size: 18px;
}

.shapla-modal-close {
	/* Storefront (and most themes) style the bare `button` element with
	   their own padding (~11px/25px here) that otherwise wins over a
	   plain width/height and stretches this into a pill instead of a
	   circle (confirmed live 2026-07-19: rendered 50.9x30px instead of
	   30x30). !important + zeroed padding + box-sizing forces this
	   plugin's own fixed-size circle regardless of the active theme. */
	flex: 0 0 auto;
	display: flex !important;
	align-items: center;
	justify-content: center;
	background: #f2f2f2;
	border: none;
	border-radius: 50%;
	box-sizing: border-box;
	width: 32px !important;
	height: 32px !important;
	min-width: 32px !important;
	max-width: 32px !important;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	color: #555;
}

.shapla-modal-close:hover {
	background: #e5e5e5;
}

.shapla-modal-tabs {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	padding: 14px 20px 0;
}

.shapla-modal-tab {
	flex: 1;
	padding: 10px;
	border: 1px solid #ddd;
	background: #fafafa;
	border-radius: 8px;
	cursor: pointer;
	font-weight: 600;
	font-size: 13px;
	color: #555;
}

.shapla-modal-tab.is-active {
	border-color: #7f54b3;
	background: #f4effa;
	color: #7f54b3;
}

/* Body: 2-column layout — left is the method list, right is the
   instructions + Transaction ID/Amount fields for whichever method is
   active. Each column scrolls independently. */
.shapla-modal-body {
	flex: 1 1 auto;
	display: flex;
	min-height: 0;
	overflow: hidden;
	margin-top: 14px;
}

.shapla-modal-list {
	flex: 0 0 184px;
	overflow-y: auto;
	min-height: 0;
	padding: 6px 12px 16px;
	border-right: 1px solid #eee;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.shapla-modal-list-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 10px 10px;
	border: 1.5px solid transparent;
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
	text-align: left;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.shapla-modal-list-item:hover {
	background: #f7f5fb;
}

.shapla-modal-list-item.is-active {
	border-color: #7f54b3;
	background: #f4effa;
}

.shapla-modal-list-item.is-active .shapla-modal-list-label {
	color: #7f54b3;
}

/* A logo lives in a contained, evenly-bordered "chip" rather than
   floating bare next to the label — real payment pickers (Stripe's
   Payment Element, PayPal, etc.) never let an arbitrary-aspect-ratio
   brand logo sit unbounded beside text; a fixed-size bordered box with
   object-fit:contain keeps a wide wordmark (e.g. bKash's logo) looking
   as intentional as a square icon instead of "floating"/mismatched
   (the user's exact complaint 2026-07-20 after a real logo was uploaded). */
.shapla-modal-list-icon {
	width: 46px;
	height: 30px;
	border-radius: 6px;
	object-fit: contain;
	background: #fff;
	border: 1px solid #ece8f5;
	padding: 3px;
	box-sizing: border-box;
	flex: 0 0 auto;
}

.shapla-modal-list-avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: #7f54b3;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 13px;
	flex: 0 0 auto;
}

.shapla-modal-list-label {
	font-size: 13px;
	font-weight: 600;
	color: #333;
	line-height: 1.3;
}

.shapla-modal-detail {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.shapla-modal-detail-scroll {
	flex: 1 1 auto;
	overflow-y: auto;
	min-height: 0;
	padding: 4px 20px 8px;
}

.shapla-modal-detail-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid #f0f0f0;
}

.shapla-modal-detail-icon {
	width: 56px;
	height: 36px;
	border-radius: 8px;
	object-fit: contain;
	background: #fff;
	border: 1px solid #ece8f5;
	padding: 4px;
	box-sizing: border-box;
	flex: 0 0 auto;
}

.shapla-modal-detail-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #555;
}

.shapla-modal-detail-body {
	background: #f8f7fb;
	border-radius: 10px;
	padding: 16px;
	margin-bottom: 18px;
	line-height: 1.6;
	font-size: 14px;
}

.shapla-modal-detail-body p {
	margin: 0 0 8px;
}

.shapla-modal-detail-body img {
	display: block;
	margin-top: 12px;
	border-radius: 6px;
}

/* Transaction ID / Amount Sent fields — rendered by
   Shapla_Payment::render_classic_fields() directly inside the detail
   panel, right under the instructions, so the customer pays and pastes
   the transaction ID in the same place. */
#shapla-payment-fields .form-row {
	padding: 0;
	margin: 0 0 12px;
}

#shapla-payment-fields label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 4px;
	color: #333;
}

#shapla-payment-fields .required {
	color: #e2401c;
	text-decoration: none;
	border: 0;
}

#shapla-payment-fields input.input-text {
	width: 100%;
	box-sizing: border-box;
	padding: 9px 10px;
	border: 1px solid #ddd;
	border-radius: 6px;
}

#shapla-payment-fields input.input-text.shapla-field-error {
	border-color: #e2401c;
}

.shapla-modal-confirm {
	display: block;
	flex: 0 0 auto;
	margin: 4px 20px 20px;
	padding: 14px !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	border-radius: 8px !important;
	text-align: center;
}

/* Visible highlight when keyboard Next/Go moves focus here (see the
   #shapla_amount keydown handler in shapla-classic-payment-modal.js) —
   the customer should clearly see this button is now the selected
   target awaiting their own explicit tap, not something that already
   happened on its own. */
/* .is-focused (not :focus/:focus-visible) — confirmed live 2026-07-20
   that this browser doesn't render any outline on this <button> when
   focus arrives via .focus()/jQuery .trigger('focus'), only via real
   Tab-key navigation, so a CSS pseudo-class alone isn't reliable here.
   The class is toggled by the focus/blur handlers above, guaranteeing
   the highlight shows regardless of how focus arrived — which matters
   since the Next/Go handler below focuses this button via JS. */
#shapla-payment-widget .shapla-modal-confirm.is-focused {
	outline: 3px solid #7f54b3 !important;
	outline-offset: 2px !important;
}

#shapla-selected-summary {
	font-weight: 600;
	color: #333;
}

/* Custom look, not the theme's own default .button — !important because
   themes generally style .button with their own colors/shape and would
   otherwise override this (same issue as .shapla-modal-close above). */
#shapla-open-modal.shapla-choose-btn {
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
	padding: 11px 20px !important;
	background: #7f54b3 !important;
	border: none !important;
	border-radius: 8px !important;
	color: #fff !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(127, 84, 179, 0.28);
	transition: background 0.15s ease;
}

#shapla-open-modal.shapla-choose-btn:hover {
	background: #6d4699 !important;
}

/* Below this width: the 2 columns don't have room side-by-side (list
   moves to a horizontally-scrollable row on top, detail below), AND the
   modal itself becomes a bottom sheet — anchored to the bottom edge,
   full-width, rounded top corners only, sliding up on open — rather
   than a small centered dialog. This is the standard mobile pattern for
   exactly this kind of picker (confirmed via 2026 UX research: NN/g and
   others document bottom sheets as the expected container for anything
   short of a full-screen takeover on mobile, and Stripe/Google/Apple's
   own payment pickers all use it), which matters here specifically
   since 89%+ of this store's traffic is mobile. Touch targets
   throughout this block are bumped to Apple/Google's ~44px minimum. */
@media (max-width: 560px) {
	.shapla-modal-overlay {
		align-items: flex-end;
		padding: 0;
	}

	.shapla-modal {
		max-width: 100%;
		max-height: 92vh;
		border-radius: 16px 16px 0 0;
		transform: translateY(100%);
	}

	.shapla-modal-overlay.is-open .shapla-modal {
		transform: translateY(0);
	}

	.shapla-modal-drag-handle {
		display: block;
		flex: 0 0 auto;
		width: 36px;
		height: 4px;
		margin: 10px auto 0;
		border-radius: 999px;
		background: #ddd;
	}

	.shapla-modal-header {
		padding: 10px 16px 14px;
	}

	.shapla-modal-close {
		width: 44px !important;
		height: 44px !important;
		min-width: 44px !important;
		max-width: 44px !important;
	}

	.shapla-modal-tabs {
		padding: 0 16px;
	}

	.shapla-modal-tab {
		padding: 13px 10px;
	}

	.shapla-modal-body {
		flex-direction: column;
	}

	.shapla-modal-list {
		flex: 0 0 auto;
		flex-direction: row;
		overflow-x: auto;
		overflow-y: hidden;
		border-right: none;
		border-bottom: 1px solid #eee;
		padding: 10px 16px;
	}

	.shapla-modal-list-item {
		flex: 0 0 auto;
		flex-direction: column;
		width: 78px;
		min-height: 44px;
		text-align: center;
		gap: 6px;
	}

	.shapla-modal-list-label {
		font-size: 11px;
	}

	.shapla-modal-detail-scroll {
		padding: 4px 16px 8px;
	}

	.shapla-modal-confirm {
		margin: 4px 16px 16px;
		padding: 15px !important;
	}

	#shapla-payment-fields input.input-text {
		padding: 12px 10px;
		font-size: 16px; /* iOS Safari auto-zooms on focus below 16px */
	}
}
