/**
 * Widerrufsbutton styles — required by §312g BGB (effective 19.06.2026).
 *
 * Approach: passive inline placement.
 *  - Trigger button injected into the shop theme's footer5 menu column
 *    (Rechtliches). It is rendered as a normal menu item — no fixed
 *    positioning, no z-index, no overlap with mobile sticky elements,
 *    no fight with WooCommerce modals.
 *  - Modal opens via JS click handler; sane z-index (99999) keeps it
 *    above page content while coexisting with WC's own overlays.
 *  - Modal close mechanisms: ESC, backdrop click, × button.
 *
 * Reduced-motion users get instant transitions (no animation).
 *
 * @package Wagenthaler\Kai
 */

/* ============================================================
 *  Inline trigger button (lives inside the footer5 menu)
 *
 *  Per ITRK + §312g BGB guidance the Widerrufsbutton must be present
 *  on every shop page but should NOT be visually promoted above
 *  sibling legal links (Impressum, AGB, Widerrufsbelehrung, …).
 *  Therefore we strip every distinguishing property — no underline,
 *  no brand color, no bold, no orange hover, no orange focus ring.
 *  The button is visually indistinguishable from a normal footer
 *  link, which is the legally-defensive interpretation.
 * ============================================================ */

.wgt-widerruf-menu-item {
	display: block;
	margin: 0;
	padding: 0;
}

.wgt-widerruf-menu-item .wgt-widerruf-trigger,
.wgt-widerruf-menu-item noscript .wgt-widerruf-trigger {
	display: inline-block;
	width: auto;
	height: auto;
	padding: 0;
	margin: 0;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	color: inherit !important;
	font: inherit !important;
	font-weight: inherit !important;
	letter-spacing: inherit !important;
	text-transform: inherit !important;
	text-decoration: none !important;
	cursor: pointer;
	transition: color 0.15s ease;
}

/* Match the kai theme's `.footer-legal-links a:hover` rule:
   siblings change from #9a9a9a → #fff on hover. Stay identical. */

.wgt-widerruf-menu-item .wgt-widerruf-trigger:hover,
.wgt-widerruf-menu-item noscript .wgt-widerruf-trigger:hover {
	color: #fff !important;
	background: transparent !important;
	box-shadow: none !important;
	transform: none !important;
}

/* Use a neutral focus indicator (no brand color).
   WCAG 2.4.7 requires focus visibility — invert text + bg is enough. */

.wgt-widerruf-menu-item .wgt-widerruf-trigger:focus-visible,
.wgt-widerruf-menu-item noscript .wgt-widerruf-trigger:focus-visible {
	outline: none;
	color: #fff !important;
}

/* ============================================================
 *  Modal shell
 *  z-index 99999 — high enough to cover WC content + sticky bars,
 *  low enough to coexist with any future WC modals (which usually
 *  sit at z-index 100000+).
 * ============================================================ */

.wgt-widerruf-modal[hidden] {
	display: none !important;
}

.wgt-widerruf-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.78);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	overflow-y: auto;
}

.wgt-widerruf-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 32px);
	background: #161616;
	color: #fff;
	border: 1px solid rgba(255, 77, 36, 0.4);
	border-radius: 12px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.wgt-widerruf-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	background: #000;
}

.wgt-widerruf-modal__title {
	margin: 0 !important;
	font-family: 'Oxanium', sans-serif;
	font-weight: 700;
	font-size: 20px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #fff !important;
}

.wgt-widerruf-modal__close {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #fff;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.wgt-widerruf-modal__close:hover,
.wgt-widerruf-modal__close:focus-visible {
	background: #ff4d24;
	border-color: #ff4d24;
	color: #000;
}

.wgt-widerruf-modal__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.wgt-widerruf-modal__body {
	padding: 24px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.wgt-widerruf-modal__intro {
	color: #9a9a9a;
	margin: 0 0 20px;
	line-height: 1.55;
}

/* ============================================================
 *  Germanized form re-skin (matches brand)
 * ============================================================ */

.wgt-widerruf-modal__body form[name="revocation"] .form-row,
.wgt-widerruf-modal__body .form-row {
	margin-bottom: 16px;
	display: block;
}

.wgt-widerruf-modal__body form[name="revocation"] label,
.wgt-widerruf-modal__body .form-row label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	color: #fff;
	font-size: 14px;
}

.wgt-widerruf-modal__body form[name="revocation"] input[type="text"],
.wgt-widerruf-modal__body form[name="revocation"] input[type="email"],
.wgt-widerruf-modal__body form[name="revocation"] textarea,
.wgt-widerruf-modal__body input[type="text"],
.wgt-widerruf-modal__body input[type="email"],
.wgt-widerruf-modal__body textarea {
	width: 100%;
	background: #000;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 6px;
	color: #fff;
	padding: 10px 12px;
	font: inherit;
	font-size: 15px;
}

.wgt-widerruf-modal__body textarea {
	min-height: 110px;
	resize: vertical;
}

.wgt-widerruf-modal__body input:focus,
.wgt-widerruf-modal__body textarea:focus {
	outline: 2px solid #ff4d24;
	outline-offset: 1px;
	border-color: #ff4d24;
}

.wgt-widerruf-modal__body input[type="submit"],
.wgt-widerruf-modal__body button[type="submit"],
.wgt-widerruf-modal__body input[name="woocommerce_gzd_revocation_submit"],
.wgt-widerruf-modal__body #submit_revocation {
	background: #ff4d24 !important;
	color: #000 !important;
	border: none !important;
	border-radius: 8px !important;
	padding: 14px 28px !important;
	font-family: 'Oxanium', sans-serif !important;
	font-weight: 700 !important;
	text-transform: uppercase !important;
	letter-spacing: 0.06em;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.wgt-widerruf-modal__body input[type="submit"]:hover,
.wgt-widerruf-modal__body button[type="submit"]:hover {
	background: #ff6742 !important;
	transform: translateY(-1px);
}

.wgt-widerruf-modal__body input[type="submit"]:focus-visible,
.wgt-widerruf-modal__body button[type="submit"]:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.wgt-widerruf-modal__body input[type="checkbox"],
.wgt-widerruf-modal__body input[type="radio"] {
	width: auto;
	height: auto;
	margin-right: 8px;
	accent-color: #ff4d24;
}

.wgt-widerruf-modal__body .woocommerce-privacy-policy-text,
.wgt-widerruf-modal__body .privacy-policy-text {
	color: #9a9a9a;
	font-size: 13px;
	line-height: 1.5;
}

.wgt-widerruf-modal__body .woocommerce-message,
.wgt-widerruf-modal__body .woocommerce-info,
.wgt-widerruf-modal__body .wc-gzd-revocation-success,
.wgt-widerruf-modal__body .gzd-revocation-success {
	background: rgba(40, 167, 69, 0.15);
	border-left: 3px solid #28a745;
	color: #d4f5d4;
	padding: 14px 16px;
	border-radius: 6px;
	margin: 0 0 16px;
}

.wgt-widerruf-modal__body .woocommerce-error,
.wgt-widerruf-modal__body .gzd-revocation-error {
	background: rgba(220, 53, 69, 0.15);
	border-left: 3px solid #dc3545;
	color: #f8d7da;
	padding: 14px 16px;
	border-radius: 6px;
	margin: 0 0 16px;
}

/* ============================================================
 *  Body lock when modal is open
 * ============================================================ */

body.wgt-modal-open {
	overflow: hidden;
}

/* ============================================================
 *  Reduced motion
 * ============================================================ */

@media (prefers-reduced-motion: reduce) {
	.wgt-widerruf-menu-item .wgt-widerruf-trigger,
	.wgt-widerruf-modal__close,
	.wgt-widerruf-modal__body input[type="submit"] {
		transition: none !important;
	}
}

/* ============================================================
 *  Small viewports — modal fills more of the screen
 * ============================================================ */

@media (max-width: 480px) {
	.wgt-widerruf-modal__dialog {
		max-height: calc(100vh - 24px);
	}
	.wgt-widerruf-modal__body {
		padding: 18px;
	}
}
