/* DartHost — EU Withdrawal Button
   Responsive, accessible modal + button styling.
   www.darthost.eu */

:root {
	--dheu-btn: #2e7d32;
	--dheu-btn-hover: #245a27;
	--dheu-accent: #2e7d32;
	--dheu-accent-hover: #245a27;
	--dheu-text: #1f2937;
	--dheu-muted: #6b7280;
	--dheu-border: #e5e7eb;
	--dheu-bg: #ffffff;
	--dheu-radius: 14px;
}

/* Trigger button (order view) */
.dheu-order-view-cta {
	margin: 28px 0 12px;
	clear: both;
}
.dheu-trigger.dheu-btn-block,
.dheu-cta-link.dheu-btn-block {
	display: inline-block;
}

/* Make every trigger use the (admin-configurable) button colour */
.dheu-trigger,
.dheu-cta-link,
.dheu-lookup-trigger,
.woocommerce-orders-table__cell-order-actions .dheu_withdraw,
a.dheu_withdraw {
	background: var(--dheu-btn) !important;
	border-color: var(--dheu-btn) !important;
	color: #fff !important;
	margin: 4px 0 !important; /* keep it from sticking to neighbouring actions */
}
.dheu-trigger:hover,
.dheu-cta-link:hover,
.dheu-lookup-trigger:hover,
.woocommerce-orders-table__cell-order-actions .dheu_withdraw:hover,
a.dheu_withdraw:hover {
	background: var(--dheu-btn-hover) !important;
	border-color: var(--dheu-btn-hover) !important;
	color: #fff !important;
}

/* Overlay */
.dheu-overlay {
	position: fixed;
	inset: 0;
	background: rgba(17, 24, 39, 0.55);
	backdrop-filter: blur(2px);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 16px;
	box-sizing: border-box;
}
.dheu-overlay.is-open {
	display: flex;
	animation: dheu-fade 0.18s ease;
}
@keyframes dheu-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* Modal card */
.dheu-modal {
	background: var(--dheu-bg);
	color: var(--dheu-text);
	width: 100%;
	max-width: 520px;
	max-height: 92vh;
	overflow-y: auto;
	border-radius: var(--dheu-radius);
	padding: 28px 26px 20px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
	position: relative;
	box-sizing: border-box;
	-webkit-overflow-scrolling: touch;
	animation: dheu-pop 0.2s ease;
	line-height: 1.5;
}
@keyframes dheu-pop {
	from { transform: translateY(12px) scale(0.98); opacity: 0; }
	to { transform: translateY(0) scale(1); opacity: 1; }
}

.dheu-close {
	position: absolute;
	top: 12px;
	right: 14px;
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	color: var(--dheu-muted);
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
}
.dheu-close:hover { background: #f3f4f6; color: var(--dheu-text); }

.dheu-modal-title {
	margin: 0 26px 8px 0;
	font-size: 1.35rem;
	font-weight: 700;
}
.dheu-modal-intro {
	color: var(--dheu-muted);
	font-size: 0.92rem;
	margin: 0 0 16px;
}
.dheu-declaration {
	background: #f8fafc;
	border-left: 3px solid var(--dheu-accent);
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.9rem;
	margin: 0 0 16px;
}

.dheu-field { margin-bottom: 14px; }
.dheu-field label {
	display: block;
	font-weight: 600;
	font-size: 0.88rem;
	margin-bottom: 5px;
}
.dheu-field input[type="text"],
.dheu-field input[type="email"],
.dheu-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 11px 12px;
	border: 1px solid var(--dheu-border);
	border-radius: 10px;
	font-size: 1rem;
	font-family: inherit;
	background: #fff;
	color: var(--dheu-text);
}
.dheu-field input:focus,
.dheu-field textarea:focus {
	outline: none;
	border-color: var(--dheu-accent);
	box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}
.dheu-field input[readonly] { background: #f3f4f6; color: var(--dheu-muted); }
.dheu-req { color: #dc2626; }
.dheu-hint { color: var(--dheu-muted); font-size: 0.8rem; }

/* Concise exceptions note */
.dheu-note {
	font-size: 0.78rem;
	color: var(--dheu-muted);
	background: #f8fafc;
	border: 1px dashed var(--dheu-border);
	border-radius: 8px;
	padding: 8px 10px;
	margin: 4px 0 0;
}

/* Honeypot — visually hidden but present for bots */
.dheu-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.dheu-recaptcha { margin-top: 4px; }

/* Self-hosted captcha widget */
.dheu-captcha-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.dheu-captcha-image {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 150px;
	min-height: 52px;
	background: #f3f4f6;
	border: 1px solid var(--dheu-border);
	border-radius: 8px;
	overflow: hidden;
}
.dheu-captcha-image svg { display: block; }
.dheu-cap-loading { font-size: 0.8rem; color: var(--dheu-muted); padding: 0 10px; }
.dheu-captcha-refresh {
	background: #f3f4f6;
	border: 1px solid var(--dheu-border);
	border-radius: 8px;
	width: 40px;
	height: 40px;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	color: var(--dheu-text);
	flex: 0 0 auto;
}
.dheu-captcha-refresh:hover { background: #e5e7eb; }
.dheu-captcha-field input[name="captcha_answer"] {
	flex: 1 1 90px;
	min-width: 90px;
	max-width: 140px;
}

.dheu-actions {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 18px;
	flex-wrap: wrap;
}
.dheu-actions .button { margin: 0; }
.dheu-submit {
	background: var(--dheu-accent) !important;
	border-color: var(--dheu-accent) !important;
	color: #fff !important;
}
.dheu-submit:hover { background: var(--dheu-accent-hover) !important; }
.dheu-submit[disabled] { opacity: 0.6; cursor: not-allowed; }
.dheu-cancel {
	background: #f3f4f6 !important;
	color: var(--dheu-text) !important;
	border-color: var(--dheu-border) !important;
}

.dheu-message {
	margin: 14px 0 0;
	padding: 0;
	font-size: 0.92rem;
	min-height: 1px;
}
.dheu-message.is-error { color: #b91c1c; }
.dheu-message.is-success {
	color: #065f46;
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	padding: 12px 14px;
	border-radius: 10px;
}

.dheu-credit {
	margin: 18px 0 0;
	text-align: center;
	font-size: 0.75rem;
	color: var(--dheu-muted);
}
.dheu-credit a { color: var(--dheu-muted); text-decoration: underline; }

/* State: after success we hide the form fields */
.dheu-form.is-done .dheu-field,
.dheu-form.is-done .dheu-declaration,
.dheu-form.is-done .dheu-note,
.dheu-form.is-done .dheu-actions,
.dheu-form.is-done .dheu-captcha-field,
.dheu-form.is-done .dheu-recaptcha { display: none; }

/* Mobile — bottom sheet */
@media (max-width: 600px) {
	.dheu-overlay {
		align-items: flex-end;
		padding: 0;
	}
	.dheu-modal {
		padding: 20px 16px 16px;
		max-width: 100%;
		max-height: 92vh;
		border-radius: 18px 18px 0 0;
		align-self: flex-end;
	}
	.dheu-modal-title { font-size: 1.2rem; }
	/* 16px inputs prevent iOS auto-zoom on focus */
	.dheu-field input[type="text"],
	.dheu-field input[type="email"],
	.dheu-field textarea {
		font-size: 16px;
	}
	.dheu-captcha-row { gap: 8px; }
	.dheu-captcha-field input[name="captcha_answer"] {
		flex: 1 1 100%;
		max-width: 100%;
	}
	.dheu-actions {
		flex-direction: column-reverse;
	}
	.dheu-actions .button {
		width: 100%;
		text-align: center;
	}
	.dheu-order-view-cta .dheu-trigger.dheu-btn-block,
	.dheu-order-view-cta .dheu-cta-link.dheu-btn-block {
		display: block;
		width: 100%;
		text-align: center;
	}
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	.dheu-overlay.is-open,
	.dheu-modal { animation: none; }
}

/* Inline shortcode form (public withdrawal page) */
.dheu-inline {
	max-width: 520px;
	margin: 0 auto;
	background: var(--dheu-bg);
	border: 1px solid var(--dheu-border);
	border-radius: var(--dheu-radius);
	padding: 22px 22px 14px;
	color: var(--dheu-text);
	line-height: 1.5;
}
.dheu-inline .dheu-actions { justify-content: flex-start; }
.dheu-inline .dheu-submit { min-width: 220px; }
@media (max-width: 600px) {
	.dheu-inline { padding: 18px 16px 12px; }
	.dheu-inline .dheu-submit { width: 100%; }
}
