/**
 * Smart Product Checkout — Public Styles (v1.1 with 2-col grid & dynamic commune)
 */

:root {
	--sc-primary-color: #2563eb;
	--sc-secondary-color: #1e40af;
	--sc-button-color: #16a34a;
	--sc-button-text-color: #ffffff;
	--sc-border-radius: 10px;
	--sc-font-size: 15px;
	--sc-bg-card: #ffffff;
	--sc-text-main: #1f2937;
	--sc-text-muted: #6b7280;
	--sc-border-color: #e5e7eb;
}

/* ── Base Container ── */
.smart-checkout-container {
	margin: 25px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
	font-size: var(--sc-font-size);
	color: var(--sc-text-main);
	line-height: 1.5;
	box-sizing: border-box;
}
.smart-checkout-container * { box-sizing: border-box; }

/* ── Promotional Banner ── */
.smart-checkout-banner {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
	padding: 12px 16px;
	border-radius: var(--sc-border-radius);
	margin-bottom: 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	font-size: 14px;
}
.smart-checkout-banner-icon { font-size: 18px; }

/* ── Card Shell ── */
.smart-checkout-card {
	background: var(--sc-bg-card);
	border: 1px solid var(--sc-border-color);
	border-radius: var(--sc-border-radius);
	padding: 20px;
	box-shadow: 0 4px 20px rgba(0,0,0,.05);
}
.smart-checkout-title {
	margin: 0 0 16px;
	font-size: 18px;
	font-weight: 700;
	color: var(--sc-primary-color);
	border-bottom: 2px solid #f3f4f6;
	padding-bottom: 8px;
}

/* ── Product Summary Box (image + info + quantity in ONE row) ── */
.sc-product-summary-box {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	background: #f8fafc;
	border: 1px solid #f1f5f9;
	border-radius: var(--sc-border-radius);
	padding: 12px;
	margin-bottom: 18px;
}
.sc-product-thumb {
	width: 72px;
	height: 72px;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	border: 1px solid #e2e8f0;
	flex-shrink: 0;
}
.sc-product-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.sc-product-info { flex-grow: 1; }
.sc-product-name {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}
.sc-product-price-display {
	font-size: 16px;
	font-weight: 700;
	color: var(--sc-primary-color);
	margin-bottom: 10px;
}

/* ── Quantity Controls (inside summary box — only one instance) ── */
.sc-quantity-controls {
	display: inline-flex;
	align-items: center;
	border: 1.5px solid var(--sc-border-color);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}
.sc-qty-btn {
	width: 38px;
	height: 38px;
	background: #f3f4f6;
	border: none;
	font-size: 20px;
	font-weight: 700;
	color: #374151;
	cursor: pointer;
	transition: background .15s;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}
.sc-qty-btn:hover { background: #e5e7eb; }
.sc-qty-input {
	width: 46px;
	height: 38px;
	border: none;
	text-align: center;
	font-size: 16px;
	font-weight: 700;
	color: #111827;
	-moz-appearance: textfield;
}
.sc-qty-input::-webkit-outer-spin-button,
.sc-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── 2-Column Grid for Form Fields ── */
.sc-fields-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;   /* desktop: 2 columns */
	gap: 14px;
	margin-bottom: 16px;
}
/* Full-width fields (delivery_type, address, notes) span both columns */
.sc-field-full {
	grid-column: 1 / -1;
}

/* ── Field Group ── */
.sc-field-group { display: flex; flex-direction: column; gap: 4px; }
.sc-label {
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 2px;
}
.sc-required { color: #dc2626; margin-left: 2px; }

/* ── Inputs / Selects / Textareas ── */
.sc-input,
.sc-select,
.sc-textarea {
	width: 100%;
	padding: 11px 13px;
	font-size: 16px;          /* 16px prevents iOS zoom */
	color: #1f2937;
	background: #fff;
	border: 1.5px solid var(--sc-border-color);
	border-radius: var(--sc-border-radius);
	transition: border-color .2s, box-shadow .2s;
	outline: none;
}
.sc-input:focus,
.sc-select:focus,
.sc-textarea:focus {
	border-color: var(--sc-primary-color);
	box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.sc-textarea { resize: vertical; min-height: 72px; }
.sc-field-desc {
	font-size: 11px;
	color: var(--sc-text-muted);
	margin-top: 2px;
}

/* ── Variation Checkbox Cards (Exact Match to Image 1) ── */
.sc-variations-block {
	margin-bottom: 20px;
}
.sc-variations-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.sc-variation-card {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	border: 1.5px solid #e2e8f0 !important;
	border-radius: 12px !important;
	padding: 14px 18px !important;
	cursor: pointer !important;
	transition: all .2s ease !important;
	background: #f8fafc !important;
	position: relative !important;
	user-select: none !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	width: 100% !important;
}
.sc-variation-card:hover {
	border-color: #cbd5e1 !important;
	background: #f1f5f9 !important;
}
.sc-variation-card.sc-variation-active {
	border-color: var(--sc-primary-color, #2563eb) !important;
	background: #ffffff !important;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}
.sc-variation-card.sc-variation-out-of-stock {
	opacity: 0.55 !important;
	cursor: not-allowed !important;
	background: #f1f5f9 !important;
}
.sc-variation-checkbox {
	position: absolute !important;
	opacity: 0 !important;
	pointer-events: none !important;
	width: 0 !important;
	height: 0 !important;
	margin: 0 !important;
}
.sc-variation-left {
	display: flex !important;
	align-items: center !important;
	gap: 12px !important;
	flex: 1 !important;
}
.sc-variation-circle {
	width: 20px !important;
	height: 20px !important;
	border-radius: 50% !important;
	border: 2px solid #cbd5e1 !important;
	background: #ffffff !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0 !important;
	transition: border-color .2s, background .2s !important;
	box-sizing: border-box !important;
}
.sc-variation-card.sc-variation-active .sc-variation-circle {
	border-color: var(--sc-primary-color, #2563eb) !important;
}
.sc-variation-card.sc-variation-active .sc-variation-circle::after {
	content: '' !important;
	width: 10px !important;
	height: 10px !important;
	border-radius: 50% !important;
	background: var(--sc-primary-color, #2563eb) !important;
	display: block !important;
}
.sc-variation-name {
	font-size: 15px !important;
	font-weight: 600 !important;
	color: #1e293b !important;
	line-height: 1.3 !important;
}
.sc-variation-stock-badge {
	font-size: 11px !important;
	color: #dc2626 !important;
	font-weight: 600 !important;
	margin-left: 6px !important;
}
.sc-variation-right {
	display: flex !important;
	align-items: center !important;
	justify-content: flex-end !important;
	gap: 12px !important;
	padding-left: 10px !important;
}
.sc-var-qty-controls {
	display: inline-flex;
	align-items: center;
	border: 1.5px solid #d1d5db;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}
.sc-var-qty-btn {
	width: 28px;
	height: 28px;
	background: #f3f4f6;
	border: none;
	font-size: 14px;
	font-weight: 700;
	color: #374151;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
}
.sc-var-qty-btn:hover { background: #e5e7eb; }
.sc-var-qty-input {
	width: 32px;
	height: 28px;
	border: none;
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	color: #111827;
	-moz-appearance: textfield;
}
.sc-var-qty-input::-webkit-outer-spin-button,
.sc-var-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sc-variation-price {
	font-size: 16px !important;
	font-weight: 800 !important;
	color: #0f172a !important;
	white-space: nowrap !important;
}

/* ── Delivery Option Cards ── */
.sc-delivery-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 4px;
}
.sc-delivery-card {
	position: relative;
	border: 2px solid var(--sc-border-color);
	border-radius: var(--sc-border-radius);
	padding: 12px;
	cursor: pointer;
	transition: all .2s ease;
	background: #fff;
}
.sc-delivery-card input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.sc-delivery-card-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 4px;
}
.sc-delivery-icon  { font-size: 22px; }
.sc-delivery-title { font-size: 13px; font-weight: 600; color: #374151; }
.sc-delivery-price { font-size: 14px; font-weight: 700; color: var(--sc-primary-color); }
.sc-delivery-card.active {
	border-color: var(--sc-primary-color);
	background: #eff6ff;
	box-shadow: 0 2px 8px rgba(37,99,235,.12);
}

/* ── Order Summary ── */
.sc-order-summary {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: var(--sc-border-radius);
	padding: 14px 16px;
	margin: 18px 0;
}
.sc-summary-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 14px;
	margin-bottom: 8px;
	color: #4b5563;
}
.sc-summary-row:last-child { margin-bottom: 0; }
.sc-total-row {
	border-top: 1px dashed #cbd5e1;
	padding-top: 10px;
	margin-top: 8px;
	font-size: 16px;
	font-weight: 700;
	color: #111827;
}
.sc-total-price { font-size: 18px; color: var(--sc-button-color); }

/* ── Notice Box ── */
.sc-notice-box {
	padding: 12px 14px;
	border-radius: var(--sc-border-radius);
	margin-bottom: 16px;
	font-size: 14px;
	font-weight: 600;
}
.sc-notice-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #dc2626;
}

/* ── Submit Button ── */
.sc-submit-btn {
	width: 100%;
	min-height: 52px;
	background: var(--sc-button-color);
	color: var(--sc-button-text-color);
	border: none;
	border-radius: var(--sc-border-radius);
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	transition: filter .2s, transform .1s;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	box-shadow: 0 4px 14px rgba(22,163,74,.3);
}
.sc-submit-btn:hover { filter: brightness(1.07); }
.sc-submit-btn:active { transform: scale(.98); }

.sc-btn-spinner {
	width: 22px;
	height: 22px;
	border: 3px solid rgba(255,255,255,.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: sc-spin .8s linear infinite;
}
@keyframes sc-spin { to { transform: rotate(360deg); } }

.sc-security-badge {
	text-align: center;
	font-size: 12px;
	color: var(--sc-text-muted);
	margin-top: 12px;
}

/* ── Success View ── */
.sc-success-view { text-align: center; padding: 30px 15px; }
.sc-success-icon {
	width: 64px;
	height: 64px;
	background: #dcfce7;
	color: #16a34a;
	border-radius: 50%;
	font-size: 32px;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 16px;
}
.sc-success-title { font-size: 22px; font-weight: 800; color: #15803d; margin: 0 0 10px; }
.sc-success-msg   { font-size: 15px; color: #374151; margin-bottom: 20px; }
.sc-success-details {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: var(--sc-border-radius);
	padding: 16px;
	display: inline-block;
	text-align: left;
	width: 100%;
	max-width: 380px;
}
.sc-success-detail-item {
	display: flex;
	justify-content: space-between;
	margin-bottom: 8px;
	font-size: 14px;
}
.sc-success-detail-item:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════
   OFFERS BLOCK (Modern Minimalist Cards)
   ══════════════════════════════════════ */
.sc-offers-block {
	margin-bottom: 20px;
}
.sc-offers-label {
	font-size: 16px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 12px;
	line-height: 1.3;
}
.sc-offers-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.sc-offer-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border: 1.5px solid #e2e8f0;
	border-radius: 12px;
	padding: 14px 18px;
	cursor: pointer;
	transition: all .2s ease;
	background: #f8fafc;
	position: relative;
	user-select: none;
}
.sc-offer-card:hover {
	border-color: #cbd5e1;
	background: #f1f5f9;
}
.sc-offer-card.sc-offer-active {
	border-color: var(--sc-primary-color, #2563eb);
	background: #ffffff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.sc-offer-radio {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.sc-offer-left {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
}
.sc-offer-radio-circle {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid #cbd5e1;
	background: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: border-color .2s, background .2s;
}
.sc-offer-card.sc-offer-active .sc-offer-radio-circle {
	border-color: var(--sc-primary-color, #2563eb);
}
.sc-offer-card.sc-offer-active .sc-offer-radio-circle::after {
	content: '';
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--sc-primary-color, #2563eb);
	display: block;
}
.sc-offer-title {
	font-size: 15px;
	font-weight: 600;
	color: #1e293b;
	line-height: 1.3;
}
.sc-offer-badge {
	background: #dcfce7;
	color: #166534;
	border-radius: 20px;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
}
.sc-offer-right {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding-left: 10px;
}
.sc-offer-price {
	font-size: 16px;
	font-weight: 800;
	color: #0f172a;
	white-space: nowrap;
}

/* ── Loading state for commune select ── */
.sc-select.sc-loading {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='%23cbd5e1' stroke-width='2'/%3E%3Cpath d='M12 2a10 10 0 0 1 10 10' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='0.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

/* ═══════════════════════════════════════
   RESPONSIVE — Mobile (≤ 640px)
   ═══════════════════════════════════════ */
@media (max-width: 640px) {
	.smart-checkout-card { padding: 14px; }

	/* 1 column on mobile */
	.sc-fields-grid {
		grid-template-columns: 1fr;
	}
	.sc-field-full { grid-column: auto; } /* reset — already 1 col */

	.sc-delivery-options { grid-template-columns: 1fr; }

	.sc-product-summary-box { flex-direction: row; align-items: flex-start; }
	.sc-product-thumb { width: 60px; height: 60px; }
}
