
/* ── DONATE MODAL ────────────────────────────────────────── */
.ha-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .6);
	z-index: 500;
	/* Scrollable container — the canonical fix for tall modals on mobile */
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	/* Flex layout to center short modals, but allow tall ones to scroll */
	display: flex;
	align-items: flex-start;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--transition-base);
	padding: var(--space-4);
}

.ha-modal-overlay.open {
	opacity: 1;
	pointer-events: all;
}

/* Locks the background page from scrolling when modal is open,
   but does NOT affect the overlay's own scroll capability */
body.ha-modal-open {
	overflow: hidden;
}

.ha-modal {
	background: var(--white);
	border-radius: var(--radius-xl);
	padding: var(--space-6) var(--space-5) var(--space-5);
	max-width: 430px;
	width: 100%;
	position: relative;
	transform: translateY(20px) scale(.97);
	transition: transform .35s ease;
	/* margin:auto centers the modal when there's extra space in the overlay */
	margin: auto;
}

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

.ha-modal-close {
	position: absolute;
	top: var(--space-4);
	right: var(--space-4);
	width: 34px;
	height: 34px;
	border-radius: var(--radius-md);
	border: 1.5px solid var(--border);
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	color: var(--text-muted);
	transition: background var(--transition-fast), color var(--transition-fast);
	padding: 0;
	line-height: 1;
}

.ha-modal-close:hover {
	background: var(--bg);
	color: var(--text);
}

button.ha-modal-close:hover, button.ha-modal-close:focus, button.ha-modal-close:focus-visible {
	background: var(--bg);
	color: var(--text);
	border-color: var(--border);
	text-decoration: none;
}

.ha-modal h1 {
	font-family: "Fields Display", "DM Serif Display", Georgia, serif;
	text-align: center;
	font-size: 26px;
	font-weight: 500;
	color: var(--text);
	margin-bottom: var(--space-6);
	padding-right: 0;
}

/* ── Fields and labels ───────────────────────────────────── */
.ha-modal-field {
	margin-bottom: var(--space-4);
	position: relative;
}

.ha-modal-field label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: var(--green-dark);
	margin-bottom: var(--space-2);
	letter-spacing: .05em;
	text-transform: uppercase;
}

/* ── Custom Select ───────────────────────────────────────── */
.ha-select-wrap {
	position: relative;
}

.ha-custom-select {
	width: 100%;
	padding: var(--space-3) 40px var(--space-3) var(--space-4);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border-light);
	background: var(--bg);
	font-size: 15px;
	color: var(--text);
	cursor: pointer;
	outline: none;
	transition: border-color var(--transition-fast), background var(--transition-fast);
	display: flex;
	align-items: center;
	gap: var(--space-2);
	user-select: none;
	min-height: 46px;
}

.ha-custom-select:hover {
	border-color: var(--border);
}

.ha-custom-select.open {
	border-color: var(--green-dark);
	background: var(--white);
}

.ha-custom-select:focus, .ha-custom-select:focus-visible {
	border-color: var(--green-dark);
	outline: 2px solid var(--green);
	outline-offset: 2px;
}

.ha-select-arrow {
	position: absolute;
	right: 13px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	color: var(--text-muted);
	font-size: 11px;
	transition: transform var(--transition-base);
}

.ha-select-text {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Scoped to modal selects — do not use bare .ha-dropdown (header nav uses the same class). */
.ha-select-wrap .ha-dropdown {
	position: absolute;
	top: calc(100% + 5px);
	left: 0;
	right: 0;
	width: auto;
	min-width: 0;
	padding: 0;
	transform: none;
	list-style: none;
	background: var(--white);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-md);
	z-index: 100;
	overflow: hidden;
	display: none;
	max-height: 260px;
	overflow-y: auto;
}

.ha-select-wrap .ha-dropdown.open {
	display: block;
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.ha-select-wrap:focus-within .ha-custom-select {
	border-color: var(--green-dark);
	background: var(--white);
}

.ha-dropdown-item {
	padding: 11px var(--space-4);
	cursor: pointer;
	font-size: 14px;
	color: var(--text);
	display: flex;
	align-items: center;
	gap: var(--space-2);
	transition: background var(--transition-fast);
}

.ha-dropdown-item:hover {
	background: var(--green-faint);
}

.ha-dropdown-item.selected {
	background: var(--green-light);
	color: var(--green);
	font-weight: 600;
}

.ha-dropdown-divider {
	height: 1px;
	background: var(--border-light);
	margin: var(--space-1) 0;
}

.ha-modal-search {
	padding: 8px 12px 4px;
}

.ha-modal-search-input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--border-light);
	border-radius: var(--radius-sm);
	font-family: inherit;
	font-size: 14px;
	outline: none;
	box-sizing: border-box;
}

.ha-modal-search-input:focus {
	border-color: var(--green);
}

/* ── Amount grid ─────────────────────────────────────────── */
.ha-amount-section label {
	margin-bottom: 14px;
}

.ha-modal .ha-modal-amount-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-bottom: 12px;
}

.ha-modal .ha-amount-btn {
	min-height: 52px;
	padding: 0 var(--space-2);
	border-radius: var(--radius-sm);
	border: 2px solid #e7e7e7;
	background: #f7f7f7;
	box-sizing: border-box;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .015);
	font-size: 15px;
	font-weight: 700;
	color: var(--text);
	cursor: pointer;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.ha-modal .ha-amount-btn:hover {
	border-color: #d81473;
	color: #d81473;
	background: var(--white);
}

.ha-modal .ha-amount-btn.active {
	border: 3px solid #d81473;
	background: var(--white);
	color: #d81473;
}

/* ── Custom amount input ─────────────────────────────────── */
.ha-modal .ha-modal-custom-wrap {
	position: relative;
	margin-bottom: var(--space-5);
}

.ha-modal .ha-modal-currency {
	position: absolute;
	left: 17px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 15px;
	color: #767676;
	pointer-events: none;
}

.ha-modal input.ha-modal-custom-input {
	width: 100%;
	min-height: 50px;
	padding: 0 var(--space-4) 0 40px;
	border-radius: var(--radius-sm);
	border: 2px solid #e7e7e7;
	background: #f7f7f7;
	font-size: 15px;
	font-weight: 400;
	color: var(--text);
	font-family: inherit;
	outline: none;
	transition: border-color var(--transition-fast), background var(--transition-fast);
}

.ha-modal input.ha-modal-custom-input::placeholder {
	color: #a8a8a8;
	font-size: 15px;
	font-weight: 400;
	opacity: 1;
}

.ha-modal input.ha-modal-custom-input:focus {
	border-color: #d81473;
	background: var(--white);
}

.ha-modal input.ha-modal-custom-input::-webkit-inner-spin-button, .ha-modal input.ha-modal-custom-input::-webkit-outer-spin-button {
	appearance: none;
}

/* ── Amount / Qty toggling ───────────────────────────────── */
.ha-amount-section.hidden {
	display: none;
}

.ha-qty-section {
	display: none;
}

.ha-qty-section.visible {
	display: block;
}

/* ── Qty stepper ─────────────────────────────────────────── */
.ha-qty-label {
	font-size: 13px;
	color: var(--text-muted);
	text-align: center;
	margin-bottom: var(--space-2);
}

.ha-qty-label strong {
	color: var(--text);
}

.ha-stepper {
	display: grid;
	grid-template-columns: 48px 1fr 48px;
	border: 1.5px solid var(--border-light);
	border-radius: var(--radius-sm);
	overflow: hidden;
	margin-bottom: var(--space-2);
}

.ha-stepper-btn {
	background: var(--bg);
	border: none;
	cursor: pointer;
	font-size: 22px;
	font-weight: 300;
	color: var(--text);
	font-family: inherit;
	transition: background var(--transition-fast), color var(--transition-fast);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-3) 0;
	line-height: 1;
}

.ha-stepper-btn:hover:not(:disabled) {
	background: var(--green-light);
	color: var(--green);
}

button.ha-stepper-btn:hover:not(:disabled), button.ha-stepper-btn:focus:not(:disabled), button.ha-stepper-btn:focus-visible:not(:disabled) {
	background: var(--green-light);
	color: var(--green);
	border-color: transparent;
	text-decoration: none;
}

.ha-stepper-btn:disabled {
	opacity: .3;
	cursor: not-allowed;
}

.ha-stepper-display {
	border-left: 1.5px solid var(--border-light);
	border-right: 1.5px solid var(--border-light);
	text-align: center;
	font-size: 17px;
	font-weight: 700;
	color: var(--text);
	display: flex;
	align-items: center;
	justify-content: center;
}

.ha-qty-total {
	text-align: center;
	font-size: 23px;
	font-weight: 700;
	color: var(--pink);
	margin-bottom: var(--space-2);
	letter-spacing: -.5px;
}

/* ── Secure badge ────────────────────────────────────────── */
.ha-secure-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	margin: var(--space-4) 0;
}

.ha-secure-badge svg {
	color: var(--green);
	flex-shrink: 0;
}

.ha-secure-badge span {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	color: var(--green);
	text-transform: uppercase;
}

/* ── Error message ───────────────────────────────────────── */
.ha-modal-error {
	display: none;
	font-size: 13px;
	color: var(--pink);
	font-weight: 600;
	text-align: center;
	margin-bottom: var(--space-3);
	padding: var(--space-2) var(--space-3);
	background: rgba(216, 20, 115, .06);
	border-radius: var(--radius-sm);
}

/* ── Submit button ───────────────────────────────────────── */
.ha-modal .ha-modal-submit {
	width: 100%;
	padding: 14px var(--space-6);
	border-radius: var(--radius-sm);
	border: none;
	background: var(--pink);
	color: var(--white);
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	transition: all var(--transition-base);
}

.ha-modal .ha-modal-submit:hover {
	transform: scale(1.05);
	box-shadow: 0 0 20px rgba(216, 20, 115, .5);
}

button.ha-modal-submit:hover, button.ha-modal-submit:focus, button.ha-modal-submit:focus-visible {
	background: var(--pink);
	color: var(--white);
	text-decoration: none;
}

button.ha-modal-submit:disabled:hover, button.ha-modal-submit:disabled:focus, button.ha-modal-submit:disabled:focus-visible {
	background: var(--border);
	color: var(--text-muted);
	text-decoration: none;
}

.ha-modal .ha-modal-submit:disabled {
	background: var(--border);
	color: var(--text-muted);
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
	.ha-modal-overlay {
		padding: var(--space-3);
		align-items: center;
	}
	
	.ha-modal {
		padding: var(--space-5) var(--space-4);
		max-width: 360px;
	}
	
	.ha-modal h1 {
		font-size: 22px;
		margin-bottom: var(--space-4);
	}
	
	.ha-modal .ha-modal-amount-grid {
		gap: 8px;
	}
	
	.ha-modal .ha-amount-btn {
		min-height: 48px;
		border-radius: var(--radius-sm);
		font-size: 15px;
	}
	
	.ha-modal input.ha-modal-custom-input {
		min-height: 46px;
		font-size: 15px;
	}
}
