.sd-download-wrapper {
	position: relative;
	margin: 15px 0;
	font-family: inherit;
}

html.sd-js .sd-download-noscript {
	display: none !important;
}

.sd-download-noscript {
	display: block;
	margin-top: 6px;
	color: #646970;
	font-size: 12px;
	line-height: 1.6;
}

.sd-download-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 20px;
	border: 0;
	border-radius: 10px;
	background: #2271b1;
	color: #fff !important;
	font-weight: 600;
	text-decoration: none !important;
	cursor: pointer;
	transition:
		transform 0.2s ease,
		box-shadow 0.2s ease,
		background 0.2s ease;
}

.sd-download-btn:hover,
.sd-download-btn:focus {
	background: #135e96;
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 8px 22px rgba(34, 113, 177, 0.28);
}

.sd-download-btn:focus-visible {
	outline: 3px solid rgba(34, 113, 177, 0.35);
	outline-offset: 3px;
}

.sd-download-btn__size {
	opacity: 0.82;
	font-size: 0.85em;
}

/* -------------------------------------------------------------------------
 * Text-link mode (toggled from Settings > General > link-button section).
 * Shows the file title as a normal inline link with size in parentheses.
 * ------------------------------------------------------------------------- */
.sd-download-link--text.sd-download-btn {
	display: inline;
	padding: 0;
	border-radius: 0;
	background: transparent;
	color: #2271b1 !important;
	font-weight: 600;
	text-decoration: underline !important;
	transform: none;
	box-shadow: none;
	gap: 4px;
}

.sd-download-link--text.sd-download-btn:hover,
.sd-download-link--text.sd-download-btn:focus {
	background: transparent;
	color: #135e96 !important;
	transform: none;
	box-shadow: none;
	text-decoration: underline !important;
}

.sd-download-link--text.sd-download-btn svg {
	display: none;
}

.sd-download-link__size {
	font-size: 0.9em;
	color: #646970;
	font-weight: 500;
	direction: ltr;
	unicode-bidi: plaintext;
}

.sd-download-wrapper--text {
	margin: 6px 0;
}

.sd-download-link__label {
	/* Inherits surrounding text color for text mode; button mode overrides. */
}

.sd-login-modal[hidden],
.sd-auth-form[hidden],
.sd-auth-message[hidden],
.sd-auth-loading[hidden] {
	display: none !important;
}

.sd-login-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.sd-login-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}

/*
 * Dialog matches the admin settings submenu design language: flat white
 * card, e0e4e9 border, 10px radius and the same header treatment as
 * .sd-settings-container / .sd-settings-header.
 */
.sd-login-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(100%, 440px);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 0;
	border: 1px solid #e0e4e9;
	border-radius: 14px;
	background: #ffffff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
	color: #1d2327;
	animation: sd-modal-in 0.22s ease-out;
}

.sd-login-modal__close {
	position: absolute;
	top: 12px;
	inset-inline-end: 12px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #ffffff;
	color: #29442c;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.sd-login-modal__close svg {
	display: block;
	width: 14px;
	height: 14px;
}

.sd-login-modal__close:hover {
	background: #eef5ef;
	color: #1b5e20;
}

.sd-login-modal__header {
	padding: 24px 20px 18px;
	text-align: center;
	background: linear-gradient(135deg, #e8f6ec 0%, #f3faf2 55%, #ecf4f9 100%);
	border-bottom: 1px solid #dcebd6;
	border-radius: 13px 13px 0 0;
}

.sd-login-modal__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	margin-bottom: 12px;
	border-radius: 50%;
	background: linear-gradient(135deg, #43a047, #1b5e20);
	color: #ffffff;
	box-shadow: 0 6px 16px rgba(46, 125, 50, 0.35);
}

.sd-login-modal__header h2 {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 700;
	color: #16301b;
}

.sd-login-modal__header p {
	margin: 0;
	color: #4d6150;
	font-size: 12.5px;
	line-height: 1.8;
}

.sd-login-tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	margin: 18px 20px 0;
	padding: 5px;
	border-radius: 10px;
	background: #eef2f4;
}

.sd-login-tab {
	border: 1px solid transparent !important;
	border-radius: 8px !important;
	background: transparent !important;
	padding: 9px 10px !important;
	color: #50575e !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
	box-sizing: border-box !important;
	line-height: 1.4 !important;
}

.sd-login-tab.is-active {
	background: #2e7d32 !important;
	border-color: #2e7d32 !important;
	color: #ffffff !important;
	box-shadow: 0 3px 8px rgba(46, 125, 50, 0.3) !important;
}

.sd-login-tab:hover:not(.is-active) {
	color: #1b5e20;
}

.sd-login-tab:focus-visible,
.sd-login-modal__close:focus-visible,
.sd-auth-submit:focus-visible {
	outline: 3px solid rgba(46, 125, 50, 0.45);
	outline-offset: 2px;
}

.sd-auth-form {
	padding: 16px 20px 20px;
}

.sd-auth-form label {
	display: block;
	margin-bottom: 7px;
}

/* Label text matches .sd-field-row__label from the settings submenu. */
.sd-auth-form label span {
	display: block;
	margin-bottom: 6px;
	color: #1d2327;
	font-size: 13px;
	font-weight: 600;
}

.sd-auth-form label .sd-required-marker {
	display: inline;
	margin: 0;
	color: #d63638;
	font-size: 0.9em;
	font-weight: 700;
	line-height: inherit;
}

.sd-auth-form .sd-auth-field {
	margin-bottom: 14px;
	min-width: 0;
}

.sd-auth-form .sd-field-help {
	display: block;
	margin-top: 5px;
	color: #646970;
	font-size: 12px;
	line-height: 1.6;
}

.sd-auth-form [data-sd-field-error] {
	display: block;
	min-height: 0;
	margin-top: 6px;
	color: #d63638;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.65;
	overflow-wrap: anywhere;
}

.sd-auth-form [data-sd-field-error][hidden] {
	display: none;
}

.sd-auth-form .sd-field-has-error input {
	border-color: #d63638;
}

/* Inputs mirror .sd-field-row__control input from the settings submenu. */
.sd-auth-form input {
	box-sizing: border-box;
	width: 100%;
	height: 40px;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	background: #ffffff;
	padding: 6px 10px;
	color: #1d2327;
	font: inherit;
}

.sd-auth-form input:focus {
	border-color: #2e7d32;
	box-shadow: 0 0 0 1px #2e7d32, 0 0 0 4px rgba(46, 125, 50, 0.14);
	outline: 2px solid transparent;
}

.sd-auth-form input[aria-invalid="true"] {
	border-color: #d63638;
}

/* Phone group: country dial-code select + national number input. */
.sd-phone-group {
	display: flex !important;
	align-items: stretch !important;
	gap: 8px !important;
	width: 100% !important;
	flex-direction: row-reverse !important; /* In RTL (Persian): country select on left, mobile on right */
}

.sd-phone-group__country {
	flex: 0 0 25% !important;
	box-sizing: border-box !important;
	width: 25% !important;
	max-width: 25% !important;
	min-width: 75px !important;
	height: 40px !important;
	border: 1px solid #c3c4c7 !important;
	border-radius: 6px !important;
	background: #ffffff !important;
	padding: 4px 2px !important;
	color: #1d2327 !important;
	font: inherit !important;
	font-size: 10px !important;
	text-align: center !important;
}

.sd-phone-group__country:focus {
	border-color: #2e7d32 !important;
	box-shadow: 0 0 0 1px #2e7d32, 0 0 0 4px rgba(46, 125, 50, 0.14) !important;
	outline: 2px solid transparent !important;
}

.sd-phone-group input[name="mobile"] {
	flex: 1 1 75% !important;
	width: 75% !important;
	min-width: 0 !important;
	direction: ltr !important;
	text-align: right !important;
}

[dir="ltr"] .sd-phone-group,
body:not(.rtl) .sd-phone-group {
	flex-direction: row !important;
}

[dir="ltr"] .sd-phone-group input[name="mobile"],
body:not(.rtl) .sd-phone-group input[name="mobile"] {
	text-align: left !important;
}

.sd-auth-form[data-sd-auth-form="register"] {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 12px;
}

.sd-auth-form[data-sd-auth-form="register"] > .sd-auth-field:nth-of-type(-n + 3),
.sd-auth-form[data-sd-auth-form="register"] > .sd-auth-submit {
	grid-column: 1 / -1;
}

/* Submit buttons use the plugin brand green (same hue as the success toast). */
.sd-auth-submit {
	width: 100% !important;
	margin-top: 6px !important;
	border: 1px solid #2e7d32 !important;
	border-radius: 8px !important;
	background: #2e7d32 !important;
	background-image: linear-gradient(180deg, #3d9944, #2e7d32) !important;
	padding: 11px 16px !important;
	color: #ffffff !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	line-height: 1.6 !important;
	cursor: pointer !important;
	box-shadow: 0 4px 10px rgba(46, 125, 50, 0.28) !important;
	transition: transform 0.15s ease, box-shadow 0.15s ease !important;
	box-sizing: border-box !important;
}

.sd-auth-submit:hover {
	background: #1b5e20 !important;
	background-image: linear-gradient(180deg, #2e7d32, #1b5e20) !important;
	border-color: #1b5e20 !important;
	transform: translateY(-1px) !important;
	box-shadow: 0 6px 14px rgba(46, 125, 50, 0.32) !important;
}

.sd-auth-submit:active {
	transform: translateY(0) !important;
	box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3) !important;
}

.sd-auth-submit:disabled {
	opacity: 0.6 !important;
	cursor: wait !important;
}

/* Feedback boxes mirror .sd-settings-notice from the settings submenu. */
.sd-auth-message {
	margin: 0 20px 20px;
	border: 1px solid #d63638;
	border-radius: 6px;
	background: #fcf0f1;
	padding: 10px 12px;
	color: #721c24;
	font-size: 13px;
	line-height: 1.7;
}

.sd-auth-message.is-success {
	background: #edfaef;
	border-color: #00a32a;
	color: #155724;
}

.sd-auth-loading {
	margin: 0 20px 20px;
	color: #2271b1;
	text-align: center;
	font-size: 13px;
}

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

@keyframes sd-modal-in {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (max-width: 480px) {
	.sd-login-modal {
		padding: 12px;
	}

	.sd-login-modal__header {
		padding: 16px 14px 12px;
	}

	.sd-login-tabs {
		margin: 12px 14px 0;
	}

	.sd-auth-form {
		padding: 14px 14px 14px;
	}

	.sd-auth-message,
	.sd-auth-loading {
		margin: 0 14px 14px;
	}
}

@media (max-width: 640px) {
	.sd-auth-form[data-sd-auth-form="register"] {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sd-login-modal__dialog,
	.sd-download-btn {
		animation: none;
		transition: none;
	}
}

/* ==========================================================================
 * Download notification toasts
 * ========================================================================== */

.sd-toast-region {
	position: fixed;
	top: 24px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 100002;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: max-content;
	max-width: min(520px, calc(100vw - 32px));
	pointer-events: none;
}

.sd-toast {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 18px;
	border-radius: 10px;
	color: #ffffff;
	font-size: 14px;
	line-height: 1.8;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
	pointer-events: auto;
}

.sd-toast--error {
	background-color: #c62828;
}

.sd-toast--success {
	background-color: #2e7d32;
}

.sd-toast__message {
	flex: 1 1 auto;
}

.sd-toast__close {
	flex: 0 0 24px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 24px !important;
	height: 24px !important;
	min-width: 24px !important;
	min-height: 24px !important;
	max-width: 24px !important;
	max-height: 24px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	border-radius: 50% !important;
	background: #ffffff !important;
	color: #1d2327 !important;
	cursor: pointer !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
	line-height: 1 !important;
	box-sizing: border-box !important;
	vertical-align: middle !important;
}

.sd-toast__close svg {
	display: block !important;
	width: 12px !important;
	height: 12px !important;
	margin: auto !important;
}

/* The X picks up the toast accent colour for instant context. */
.sd-toast--error .sd-toast__close {
	color: #c62828;
}

.sd-toast--success .sd-toast__close {
	color: #2e7d32;
}

.sd-toast__close:hover,
.sd-toast__close:focus-visible {
	background: #f0f0f1;
	outline: 2px solid rgba(255, 255, 255, 0.65);
	outline-offset: 1px;
}

.sd-download-frame {
	display: none;
}

@media (max-width: 640px) {
	.sd-toast-region {
		top: 12px;
	}

	.sd-toast {
		padding: 10px 14px;
	}
}
