/* ServisPin — frontend styles
   All selectors are namespaced with .pde- to avoid any conflict with
   Flatsome / WooCommerce / other theme or plugin CSS.

   NOTE: these .pde- class names are intentionally NOT renamed to
   .servispin- as part of the PDE->ServisPin prefix migration. CSS
   classes aren't PHP global identifiers and aren't scanned by
   WordPress.org's short-prefix compliance check; renaming them would
   only add risk (JS selector mismatches, breaking any site-specific
   custom CSS already written against these classes) for zero
   compliance benefit. */

:root {
	--pde-button-color: #2E1A47;
	--pde-button-text-color: #FFFFFF;
	--pde-border-radius: 8px;
	--pde-input-border-color: #E2DCEB;
	--pde-success-color: #1E7B34;
	--pde-error-color: #C0392B;
	--pde-text-color: #2B2536;
	--pde-muted-color: #7A7288;
	--pde-bg-color: #FFFFFF;
}

.pde-wrapper,
.pde-delivery-bar,
.pde-message-shell {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
}

.pde-wrapper *,
.pde-delivery-bar *,
.pde-message-shell * {
	box-sizing: border-box;
	font-family: inherit;
}

/* ---------- Widget card ---------- */
.pde-wrapper {
	background: var(--pde-bg-color);
	border: 1px solid #EFEAF5;
	border-radius: calc(var(--pde-border-radius) + 4px);
	box-shadow: 0 4px 20px rgba(46, 26, 71, 0.06);
	padding: 24px;
	max-width: 480px;
	color: var(--pde-text-color);
}

.pde-wrapper--compact {
	max-width: 100%;
	padding: 16px;
	margin-bottom: 20px !important;
	box-shadow: none;
	border: 1px solid var(--pde-input-border-color);
}

.pde-header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.pde-title {
	font-size: 18px;
	font-weight: 700;
	margin: 0;
	color: var(--pde-text-color);
}

.pde-compact-label {
	font-size: 14px;
	font-weight: 500;
	margin: 0 0 10px;
	color: var(--pde-text-color);
}

.pde-description {
	font-size: 13px;
	font-weight: 400;
	color: var(--pde-muted-color);
	margin: 0 0 18px;
	line-height: 1.5;
}

/* ---------- Form ---------- */
.pde-form {
	margin: 0;
}

.pde-field-group {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.pde-input {
	flex: 1 1 180px;
	min-width: 0;
	height: 50px;
	padding: 0 16px;
	font-size: 14px;
	font-weight: 400;
	border: 1.5px solid var(--pde-input-border-color);
	border-radius: var(--pde-border-radius);
	background: #FCFBFE;
	color: var(--pde-text-color);
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pde-input::placeholder {
	color: #ADA5BC;
	font-weight: 400;
}

.pde-input:focus {
	border-color: var(--pde-button-color);
	box-shadow: 0 0 0 3px rgba(46, 26, 71, 0.12);
	background: #FFFFFF;
}

.pde-input.pde-input-error {
	border-color: var(--pde-error-color);
}

.pde-button {
	flex: 0 0 auto;
	height: 50px;
	padding: 0 22px;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--pde-button-text-color);
	background: var(--pde-button-color);
	border: none;
	border-radius: var(--pde-border-radius);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: filter 0.15s ease, transform 0.1s ease;
	white-space: nowrap;
}

.pde-button:hover {
	filter: brightness(1.12);
}

.pde-button:active {
	transform: translateY(1px);
}

.pde-button:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.pde-spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #FFFFFF;
	border-radius: 50%;
	animation: pde-spin 0.6s linear infinite;
}

.pde-button.pde-loading .pde-spinner {
	display: inline-block;
}

.pde-button.pde-loading .pde-button-text {
	opacity: 0.85;
}

@keyframes pde-spin {
	to { transform: rotate(360deg); }
}

.pde-inline-error {
	font-size: 12px;
	color: var(--pde-error-color);
	margin: 8px 0 0;
	min-height: 0;
	font-weight: 500;
}

.pde-inline-error:empty {
	display: none;
}

/* ---------- Result states ---------- */
.pde-result {
	margin-top: 16px;
}

.pde-result:empty {
	margin-top: 0;
}

.pde-result-box {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 14px 16px;
	border-radius: var(--pde-border-radius);
	font-size: 13px;
	animation: pde-fade-in 0.2s ease;
}

@keyframes pde-fade-in {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: translateY(0); }
}

.pde-result-box.pde-error {
	background: #FBEEEC;
	border: 1px solid #F1D2CD;
}

.pde-result-icon {
	font-size: 16px;
	line-height: 1.2;
	flex-shrink: 0;
}

.pde-result-title {
	font-weight: 600;
	margin: 0 0 2px;
	font-size: 13px;
}

.pde-result-box.pde-error .pde-result-title {
	color: var(--pde-error-color);
}

/* ---------- Delivery timeline (success result) ---------- */
.pde-timeline {
	display: flex;
	flex-direction: column;
}

.pde-timeline-item {
	display: flex;
	gap: 14px;
	animation: pde-fade-in 0.25s ease;
}

.pde-timeline-marker-col {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 0 0 auto;
}

.pde-timeline-marker {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	background: #FFFFFF;
	border: 1.5px solid var(--pde-input-border-color);
	color: var(--pde-muted-color);
	/* Secondary markers pick up a tint of the admin's configured button
	   color (not a hardcoded brand color); color-mix() overrides the plain
	   fallback above, and browsers without support simply keep the fallback. */
	border-color: color-mix(in srgb, var(--pde-button-color) 30%, #FFFFFF);
	color: color-mix(in srgb, var(--pde-button-color) 55%, #FFFFFF);
}

.pde-timeline-marker svg {
	width: 15px;
	height: 15px;
}

.pde-timeline-marker--active {
	background: var(--pde-button-color);
	border-color: var(--pde-button-color);
	color: var(--pde-button-text-color);
}

.pde-timeline-line {
	width: 2px;
	flex: 1 1 auto;
	min-height: 18px;
	background: var(--pde-input-border-color);
	margin: 2px 0;
}

.pde-timeline-item:last-child .pde-timeline-line {
	display: none;
}

.pde-timeline-content {
	flex: 1 1 auto;
	min-width: 0;
	padding-bottom: 18px;
}

.pde-timeline-item:last-child .pde-timeline-content {
	padding-bottom: 0;
}

.pde-timeline-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--pde-muted-color);
	margin: 6px 0 2px;
}

.pde-timeline-days {
	font-size: 20px;
	font-weight: 700;
	color: var(--pde-text-color);
	margin: 0 0 4px;
	line-height: 1.25;
}

.pde-timeline-date {
	font-size: 13px;
	color: var(--pde-text-color);
	margin: 0 0 4px;
}

.pde-timeline-date strong {
	color: var(--pde-button-color);
}

.pde-timeline-location {
	font-size: 12px;
	color: var(--pde-muted-color);
	margin: 0;
	word-break: break-word;
}

.pde-timeline-service {
	font-size: 13px;
	font-weight: 600;
	color: var(--pde-text-color);
	margin: 6px 0;
	word-break: break-word;
}

.pde-cutoff-box {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 4px;
	padding: 12px 14px;
	border-radius: var(--pde-border-radius);
	background: #F5F3FA;
	background: color-mix(in srgb, var(--pde-button-color) 6%, #FFFFFF);
	border: 1px solid #EAE5F2;
	border: 1px solid color-mix(in srgb, var(--pde-button-color) 16%, #FFFFFF);
}

.pde-cutoff-icon {
	flex-shrink: 0;
	color: var(--pde-button-color);
	display: flex;
	align-items: center;
	margin-top: 1px;
}

.pde-cutoff-icon svg {
	width: 15px;
	height: 15px;
}

.pde-cutoff-text {
	font-size: 12.5px;
	font-weight: 500;
	color: var(--pde-text-color);
	line-height: 1.45;
}

/* ---------- Design 2 (alternate widget design) ----------
   Entirely separate class namespace (.pde-d2-*) from Design 1's
   (.pde-timeline-*, .pde-cutoff-*) above, so selecting either design in
   Settings never affects the other's markup or styling. Colors are pulled
   from the exact same admin-configured CSS variables as Design 1. */
.pde-wrapper--design-2 {
	position: relative;
}

.pde-wrapper--design-2::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 5px;
	background: var(--pde-button-color);
	border-radius: calc(var(--pde-border-radius) + 4px) 0 0 calc(var(--pde-border-radius) + 4px);
}

.pde-d2-panel {
	background: #F5F3FA;
	background: color-mix(in srgb, var(--pde-button-color) 6%, #FFFFFF);
	border-radius: var(--pde-border-radius);
	overflow: hidden;
}

.pde-d2-row {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid #EAE5F2;
	border-bottom-color: color-mix(in srgb, var(--pde-button-color) 12%, #FFFFFF);
	animation: pde-fade-in 0.25s ease;
}

.pde-d2-row:last-child {
	border-bottom: none;
}

.pde-d2-icon {
	flex-shrink: 0;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #FFFFFF;
	border: 1.5px solid var(--pde-input-border-color);
	color: var(--pde-muted-color);
	margin-top: 1px;
	border-color: color-mix(in srgb, var(--pde-button-color) 35%, #FFFFFF);
	color: var(--pde-button-color);
}

.pde-d2-icon svg {
	width: 14px;
	height: 14px;
}

.pde-d2-content {
	flex: 1 1 auto;
	min-width: 0;
}

.pde-d2-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--pde-muted-color);
	margin: 3px 0 2px;
}

.pde-d2-days {
	font-size: 19px;
	font-weight: 700;
	color: var(--pde-text-color);
	margin: 0 0 4px;
	line-height: 1.25;
}

.pde-d2-date {
	font-size: 13px;
	color: var(--pde-text-color);
	margin: 0 0 4px;
}

.pde-d2-date strong {
	color: var(--pde-button-color);
}

.pde-d2-location {
	font-size: 12px;
	color: var(--pde-muted-color);
	margin: 0;
	word-break: break-word;
}

.pde-d2-service {
	font-size: 13px;
	font-weight: 600;
	color: var(--pde-text-color);
	margin: 4px 0;
	word-break: break-word;
}

.pde-d2-cutoff {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 14px;
	padding: 12px 14px;
	border-radius: var(--pde-border-radius);
	background: #FFFFFF;
	border: 1px solid var(--pde-input-border-color);
}

.pde-d2-cutoff-icon {
	flex-shrink: 0;
	color: var(--pde-button-color);
	display: flex;
	align-items: center;
	margin-top: 1px;
}

.pde-d2-cutoff-icon svg {
	width: 15px;
	height: 15px;
}

.pde-d2-cutoff-text {
	font-size: 12.5px;
	font-weight: 500;
	color: var(--pde-text-color);
	line-height: 1.45;
}

.pde-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Top delivery bar ---------- */
.pde-delivery-bar {
	width: 100%;
	background: var(--pde-button-color);
	color: #FFFFFF;
	font-size: 13px;
	font-weight: 500;
	padding: 9px 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	flex-wrap: wrap;
	text-align: center;
	position: relative;
	z-index: 9999;
}

.pde-bar-top {
	position: relative;
}

.pde-bar-below-header {
	position: relative;
}

.pde-bar-text {
	line-height: 1.4;
}

.pde-bar-change {
	background: rgba(255, 255, 255, 0.16);
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: #FFFFFF;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	padding: 5px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease;
}

.pde-bar-change:hover {
	background: rgba(255, 255, 255, 0.28);
}

/* ---------- [pincode_delivery_message] shortcode ---------- */
.pde-message-shell {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 13px;
	color: var(--pde-text-color);
}

.pde-message-prompt,
.pde-message-text {
	font-weight: 400;
}

.pde-message-link {
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	color: var(--pde-button-color);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.pde-message-link:hover {
	filter: brightness(1.2);
}

/* ---------- Check-delivery popup modal ---------- */
.pde-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 12, 32, 0.55);
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.pde-modal-overlay.pde-modal-open {
	display: flex;
}

.pde-modal {
	position: relative;
	background: var(--pde-bg-color);
	border-radius: calc(var(--pde-border-radius) + 4px);
	padding: 28px 24px 24px;
	max-width: 420px;
	width: 100%;
	box-shadow: 0 20px 60px rgba(20, 12, 32, 0.3);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	animation: pde-modal-in 0.18s ease;
}

@keyframes pde-modal-in {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.pde-modal-close {
	position: absolute;
	top: 12px;
	right: 14px;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	color: var(--pde-muted-color);
	cursor: pointer;
	padding: 4px;
}

.pde-modal-close:hover {
	color: var(--pde-text-color);
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
	.pde-wrapper {
		padding: 18px;
		border-radius: var(--pde-border-radius);
	}

	.pde-field-group {
		flex-direction: column;
	}

	.pde-input,
	.pde-button {
		width: 100%;
		flex: 1 1 auto;
	}

	.pde-delivery-bar {
		font-size: 12px;
		padding: 8px 12px;
	}

	.pde-modal {
		padding: 24px 18px 20px;
	}

	.pde-timeline-marker {
		width: 30px;
		height: 30px;
	}

	.pde-timeline-marker svg {
		width: 13px;
		height: 13px;
	}

	.pde-timeline-days {
		font-size: 18px;
	}

	.pde-cutoff-box {
		padding: 10px 12px;
	}

	.pde-d2-icon {
		width: 26px;
		height: 26px;
	}

	.pde-d2-icon svg {
		width: 12px;
		height: 12px;
	}

	.pde-d2-days {
		font-size: 17px;
	}

	.pde-d2-cutoff {
		padding: 10px 12px;
	}
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.pde-result-box,
	.pde-timeline-item,
	.pde-d2-row,
	.pde-modal {
		animation: none !important;
	}
}

/* ---------- Focus visibility for accessibility ---------- */
.pde-button:focus-visible,
.pde-input:focus-visible,
.pde-bar-change:focus-visible {
	outline: 2px solid var(--pde-button-color);
	outline-offset: 2px;
}
