/**
 * DIGIQAL BOX NOW — checkout / locker widget styles.
 * Design mirrors the ACS SmartPoint widget in BOX NOW green (#00da00).
 */

/* ── Classic checkout table-row wrapper ──────────────────────────────────── */

.digiqal-boxnow-row > td {
	border-top: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 8px;
}

.digiqal-boxnow-row .digiqal-boxnow-wrap {
	margin-top: 0;
}

/* ── Blocks checkout wrapper (appended after shipping rates list) ─────────── */

.wc-block-components-shipping-rates-control .digiqal-boxnow-wrap,
.wp-block-woocommerce-checkout-shipping-methods-block .digiqal-boxnow-wrap {
	margin-top: 16px;
}

/* ── Card container ──────────────────────────────────────────────────────── */

.digiqal-boxnow-container {
	position: relative;
	border-radius: 12px;
	padding: 20px;
	background: #fff;
	border: 1px solid #e5e7eb;
	box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	width: 100%;
	box-sizing: border-box;
	overflow: visible;
}

/* ── Header with left green bar ──────────────────────────────────────────── */

.dbnw-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
	font-size: 15px;
	font-weight: 600;
	color: #1f2937;
}

.dbnw-header::before {
	content: '';
	width: 4px;
	height: 20px;
	background: #00da00;
	border-radius: 2px;
	flex-shrink: 0;
}

/* ── Open-picker button (full-width) ─────────────────────────────────────── */

#digiqal-boxnow-button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100% !important;
	padding: 14px 24px;
	font-size: 14px;
	font-weight: 600;
	color: #fff !important;
	background: linear-gradient(135deg, #00da00 0%, #00b800 100%) !important;
	border: none !important;
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 218, 0, 0.35);
	cursor: pointer;
	letter-spacing: 0.2px;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	box-sizing: border-box;
}

#digiqal-boxnow-button:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 218, 0, 0.45) !important;
}

/* Location pin icon inside the button */
#digiqal-boxnow-button .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
	flex-shrink: 0;
	line-height: 1;
}

/* ── Description text ────────────────────────────────────────────────────── */

.dbnw-description {
	margin: 12px 0 0 !important;
	padding: 0 !important;
	font-size: 12px;
	color: #6b7280;
	text-align: center;
}

/* ── Selected locker card ────────────────────────────────────────────────── */

.digiqal-boxnow-selected {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0;
	background: #fff;
	border: none;
	border-radius: 12px;
}

/* Green icon square */
.dbnw-selected-icon {
	width: 56px;
	height: 56px;
	min-width: 56px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #00da00 0%, #00b800 100%);
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 218, 0, 0.3);
	overflow: hidden;
}

.dbnw-selected-logo {
	width: 36px;
	height: auto;
	filter: brightness(0) invert(1);
	display: block;
}

/* Locker name / address / ID */
.dbnw-selected-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.digiqal-boxnow-selected__name {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #111827;
	margin-bottom: 2px;
}

.digiqal-boxnow-selected__address {
	display: block;
	font-size: 13px;
	color: #6b7280;
}

.digiqal-boxnow-selected__id {
	display: block;
	font-size: 11px;
	color: #9ca3af;
}

/* Action buttons row */
.dbnw-selected-actions {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

/* Change button (green, filled) */
.digiqal-boxnow-btn-change {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	font-size: 13px;
	font-weight: 600;
	color: #fff !important;
	background: linear-gradient(135deg, #00da00 0%, #00b800 100%) !important;
	border: none !important;
	border-radius: 8px;
	cursor: pointer;
	white-space: nowrap;
	box-shadow: 0 2px 8px rgba(0, 218, 0, 0.3);
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.digiqal-boxnow-btn-change:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 218, 0, 0.4) !important;
}

/* Cancel button (neutral gray) */
.digiqal-boxnow-btn-cancel {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #374151 !important;
	background: #e5e7eb !important;
	border: none !important;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: none !important;
}

.digiqal-boxnow-btn-cancel:hover {
	background: #d1d5db !important;
	color: #1f2937 !important;
}

/* ── Inline validation error ─────────────────────────────────────────────── */

.digiqal-boxnow-error {
	margin-top: 12px;
	padding: 10px 14px;
	font-size: 13px;
	color: #991b1b;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
}

/* ── Widget overlay & iframe ─────────────────────────────────────────────── */

.digiqal-boxnow-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 2147483646; /* max-1 — above any theme/plugin element */
	touch-action: none;
}

.digiqal-boxnow-iframe {
	position: fixed;
	top: 50%;
	left: 50%;
	width: 80%;
	height: 80%;
	border: 0;
	border-radius: 16px;
	transform: translate(-50%, -50%);
	z-index: 2147483647; /* CSS max z-index */
	touch-action: auto;
	pointer-events: auto;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
	.digiqal-boxnow-container {
		padding: 12px;
	}

	#digiqal-boxnow-button {
		border-radius: 10px;
		padding: 16px 24px;
	}

	/* Stack selected card vertically on small screens */
	.digiqal-boxnow-selected {
		flex-direction: column !important;
		align-items: stretch !important;
		gap: 16px !important;
	}

	/* Hide icon square on mobile (matches ACS behaviour) */
	.dbnw-selected-icon {
		display: none !important;
	}

	.dbnw-selected-actions {
		flex-direction: row;
		gap: 12px;
	}

	.digiqal-boxnow-btn-change,
	.digiqal-boxnow-btn-cancel {
		flex: 1 !important;
		padding: 14px 20px !important;
		font-size: 14px !important;
		border-radius: 8px !important;
		text-align: center !important;
	}
}

@media (max-width: 768px) {
	.digiqal-boxnow-iframe {
		width: 95%;
		height: 95%;
	}
}
