/* BingoCR Car Rental – Frontend Widget */

.bingocr-widget {
	--bcr-primary:  #e63946;
	--bcr-bg:       #ffffff;
	--bcr-bg2:      #f8f9fa;
	--bcr-border:   #dee2e6;
	--bcr-text:     #212529;
	--bcr-muted:    #6c757d;
	--bcr-radius:   8px;
	--bcr-shadow:   0 2px 12px rgba(0,0,0,.08);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	color: var(--bcr-text);
	line-height: 1.5;
}

.bingocr-widget.bingocr-theme-dark {
	--bcr-bg:     #1a1a2e;
	--bcr-bg2:    #16213e;
	--bcr-border: #2d2d4a;
	--bcr-text:   #e0e0e0;
	--bcr-muted:  #9090b0;
}

/* ── Loading ──────────────────────────────────────────────────────────── */

.bingocr-loading {
	text-align: center;
	padding: 40px;
	color: var(--bcr-muted);
}

.bcr-loading-sm {
	text-align: center;
	padding: 16px;
	color: var(--bcr-muted);
	font-size: .88em;
}

/* ── Shared inputs / buttons ──────────────────────────────────────────── */

.bcr-input {
	width: 100%;
	box-sizing: border-box;
	padding: 9px 12px;
	border: 1px solid var(--bcr-border);
	border-radius: 5px;
	background: var(--bcr-bg2);
	color: var(--bcr-text);
	font-size: .95em;
	font-family: inherit;
}

.bcr-input:focus {
	outline: none;
	border-color: var(--bcr-primary);
	box-shadow: 0 0 0 3px rgba(230,57,70,.15);
}

.bcr-field {
	display: flex;
	flex-direction: column;
}

.bcr-field-label {
	display: block;
	font-size: .82em;
	font-weight: 600;
	margin-bottom: 5px;
	color: var(--bcr-muted);
	text-transform: uppercase;
	letter-spacing: .04em;
}

.bcr-btn {
	display: inline-block;
	padding: 10px 20px;
	border: 1px solid var(--bcr-border);
	border-radius: 5px;
	cursor: pointer;
	font-size: .95em;
	font-weight: 600;
	font-family: inherit;
	background: var(--bcr-bg2);
	color: var(--bcr-text);
	transition: background .15s, color .15s, filter .15s;
}

.bcr-btn-primary {
	background: var(--bcr-primary);
	border-color: var(--bcr-primary);
	color: #fff;
}

.bcr-btn-primary:hover { filter: brightness(1.08); }

.bcr-btn-outline {
	background: transparent;
	border-color: var(--bcr-primary);
	color: var(--bcr-primary);
}

.bcr-btn-outline:hover {
	background: var(--bcr-primary);
	color: #fff;
}

.bcr-btn-ghost {
	background: transparent;
	border-color: transparent;
	color: var(--bcr-muted);
	padding-left: 0;
}

.bcr-btn-ghost:hover { color: var(--bcr-text); }

/* ── Feedback ─────────────────────────────────────────────────────────── */

.bcr-error {
	color: #c0392b;
	font-size: .88em;
	margin-top: 6px;
}

.bcr-success {
	color: #27ae60;
	font-size: .88em;
	margin-top: 6px;
}

.bcr-empty {
	text-align: center;
	padding: 32px;
	color: var(--bcr-muted);
}

/* ── Search box ───────────────────────────────────────────────────────── */

.bcr-search-box {
	background: var(--bcr-bg);
	border: 1px solid var(--bcr-border);
	border-radius: var(--bcr-radius);
	padding: 28px;
	box-shadow: var(--bcr-shadow);
}

.bcr-search-title {
	margin: 0 0 20px;
	font-size: 1.35em;
	color: var(--bcr-primary);
}

.bcr-search-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 14px;
	margin-bottom: 20px;
}

.bcr-same-pickup-label {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 7px;
	font-size: .85em;
	color: var(--bcr-muted);
	cursor: pointer;
}

.bcr-same-pickup-label input { margin: 0; }

.bcr-search-footer {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.bcr-btn-search {
	padding: 11px 28px;
	font-size: 1em;
}

/* ── Cars step ────────────────────────────────────────────────────────── */

.bcr-cars-header {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.bcr-dates-badge {
	font-size: .9em;
	color: var(--bcr-muted);
}

/* ── Results filter bar ───────────────────────────────────────────────── */

.bcr-filter-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 18px;
	padding: 12px 14px;
	background: var(--bcr-bg2, #f8f9fa);
	border: 1px solid var(--bcr-border, #dee2e6);
	border-radius: var(--bcr-radius, 8px);
}

.bcr-f-text { flex: 1 1 200px; min-width: 160px; }

.bcr-f-select {
	flex: 0 1 auto;
	width: auto;
	min-width: 140px;
}

.bcr-cars-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
}

/* Single result: cap the card width and center it on the page */
.bcr-cars-grid:has(.bcr-car-card:only-child) {
	display: flex;
	justify-content: center;
}

.bcr-cars-grid .bcr-car-card:only-child {
	max-width: 320px;
	width: 100%;
}

.bcr-car-card {
	background: var(--bcr-bg);
	border: 1px solid var(--bcr-border);
	border-radius: var(--bcr-radius);
	overflow: hidden;
	box-shadow: var(--bcr-shadow);
	display: flex;
	flex-direction: column;
	transition: transform .15s, box-shadow .15s;
}

.bcr-car-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.bcr-car-img {
	width: 100%;
	height: 170px;
	object-fit: cover;
}

.bcr-car-no-img {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bcr-bg2);
	font-size: 2.5em;
}

.bcr-car-body {
	padding: 16px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.bcr-car-name {
	margin: 0 0 8px;
	font-size: 1.05em;
}

.bcr-car-specs {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-bottom: 12px;
}

.bcr-car-specs span {
	background: var(--bcr-bg2);
	border: 1px solid var(--bcr-border);
	border-radius: 4px;
	padding: 2px 7px;
	font-size: .78em;
	color: var(--bcr-muted);
}

.bcr-cat-badge {
	background: var(--bcr-primary) !important;
	border-color: var(--bcr-primary) !important;
	color: #fff !important;
	text-transform: capitalize;
}

.bcr-car-pricing {
	margin-bottom: 14px;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
}

.bcr-price-day {
	font-size: 1.3em;
	font-weight: 700;
	color: var(--bcr-primary);
}

.bcr-price-day small {
	font-size: .62em;
	font-weight: 400;
	color: var(--bcr-muted);
}

.bcr-price-total {
	font-size: .85em;
	color: var(--bcr-muted);
}

.bcr-book-btn {
	margin-top: auto;
	width: 100%;
	text-align: center;
}

/* ── Modal overlay ────────────────────────────────────────────────────── */

.bcr-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.55);
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	overflow: hidden;
}

.bcr-modal {
	position: relative;
	background: var(--bcr-bg, #fff);
	border-radius: var(--bcr-radius, 8px);
	width: 100%;
	max-width: 680px;
	box-shadow: 0 12px 48px rgba(0,0,0,.25);
	margin: auto;
	display: flex;
	flex-direction: column;
	/* Definite height lets flex:1 on the body actually allocate space */
	height: min(calc(100vh - 48px), 720px);
	max-height: calc(100vh - 48px);
}

/* ── Modal header (sticky) ───────────────────────────────────────────── */

.bcr-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	background: var(--bcr-bg2);
	border-bottom: 1px solid var(--bcr-border);
	border-radius: var(--bcr-radius) var(--bcr-radius) 0 0;
	flex-shrink: 0;
}

.bcr-modal-car-strip {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.bcr-modal-car-img {
	width: 80px;
	height: 56px;
	object-fit: cover;
	border-radius: 5px;
	flex-shrink: 0;
}

.bcr-modal-car-name {
	font-size: 1.05em;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bcr-modal-car-dates {
	font-size: .83em;
	color: var(--bcr-muted);
	margin-top: 2px;
}

.bcr-modal-close {
	background: transparent;
	border: none;
	font-size: 1.5em;
	line-height: 1;
	cursor: pointer;
	color: var(--bcr-muted);
	padding: 4px 8px;
	border-radius: 4px;
	flex-shrink: 0;
}

.bcr-modal-close:hover { color: var(--bcr-text); background: var(--bcr-border); }

/* ── Order Summary strip (always visible, not scrollable) ────────────── */

.bcr-modal-summary {
	flex-shrink: 0;
	background: var(--bcr-bg2, #f8f9fa);
	border-bottom: 2px solid var(--bcr-border, #dee2e6);
	padding: 14px 20px;
}

.bcr-summary-label {
	font-size: .72em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: var(--bcr-muted, #6c757d);
	margin-bottom: 10px;
}

/* ── Modal scrollable body ───────────────────────────────────────────── */

.bcr-modal-body {
	overflow-y: auto;
	flex: 1;
	min-height: 100px; /* guarantee at least some visible space */
	padding: 16px 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Children must keep their natural height — otherwise the cards (overflow:
   hidden ⇒ min-size 0) get flex-squeezed to nothing instead of the body
   scrolling. This is what made the extras card invisible. */
.bcr-modal-body > * {
	flex-shrink: 0;
}

/* ── Card sections inside modal ──────────────────────────────────────── */

.bcr-mcard {
	border: 1px solid var(--bcr-border, #dee2e6);
	border-radius: 6px;
	overflow: hidden;
}

.bcr-mcard-light { background: var(--bcr-bg2, #f8f9fa); }

.bcr-mcard-header {
	padding: 10px 16px;
	background: var(--bcr-bg2, #f8f9fa);
	border-bottom: 1px solid var(--bcr-border, #dee2e6);
	font-size: .82em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--bcr-muted, #6c757d);
}

.bcr-mcard-light .bcr-mcard-header {
	background: rgba(0,0,0,.03);
}

.bcr-mcard-body { padding: 14px 16px; }

/* ── Extras rows ─────────────────────────────────────────────────────── */

.bcr-extra-row {
	position: relative; /* anchors the visually-hidden checkbox input */
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 9px 0;
	border-bottom: 1px solid var(--bcr-border);
	cursor: pointer;
	transition: background .1s;
	/* Explicit — the row is a <label> and themes often force a dark label
	   color, which is invisible on the dark theme. */
	color: var(--bcr-text, #212529);
}

.bcr-extra-row:last-child { border-bottom: none; padding-bottom: 0; }
.bcr-extra-row:first-child { padding-top: 0; }

.bcr-extra-row.bcr-extra-selected .bcr-extra-name { color: var(--bcr-primary); }

/* The native checkbox is hidden on purpose; we draw our own indicator
   (.bcr-extra-box) so no theme styling can interfere with it. */
.bcr-extra-row input[type="checkbox"] {
	position: absolute !important;
	opacity: 0 !important;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	pointer-events: none;
}

.bcr-extra-box {
	display: inline-block;
	width: 20px;
	height: 20px;
	min-width: 20px;
	box-sizing: border-box;
	border: 2px solid var(--bcr-muted, #6c757d);
	border-radius: 4px;
	background: var(--bcr-bg, #fff);
	margin-top: 1px;
	flex-shrink: 0;
	position: relative;
	transition: background .12s, border-color .12s;
}

.bcr-extra-check:checked + .bcr-extra-box {
	background: var(--bcr-primary, #e63946);
	border-color: var(--bcr-primary, #e63946);
}

.bcr-extra-check:checked + .bcr-extra-box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.bcr-extra-row.bcr-extra-selected {
	background: rgba(230, 57, 70, .05);
}

.bcr-extra-info { flex: 1; min-width: 0; }

.bcr-extra-name {
	display: block;
	font-weight: 600;
	font-size: .92em;
	color: var(--bcr-text, #212529);
}

.bcr-extra-desc {
	display: block;
	font-size: .8em;
	color: var(--bcr-muted);
	margin-top: 1px;
}

.bcr-extra-badge {
	display: inline-block;
	background: var(--bcr-primary);
	color: #fff;
	font-size: .78em;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 20px;
	white-space: nowrap;
	flex-shrink: 0;
}

/* ── Payment method ──────────────────────────────────────────────────── */

.bcr-pay-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 0;
	border-bottom: 1px solid var(--bcr-border, #dee2e6);
	cursor: pointer;
	color: var(--bcr-text, #212529);
}

.bcr-pay-row:last-child  { border-bottom: none; padding-bottom: 0; }
.bcr-pay-row:first-child { padding-top: 0; }

.bcr-pay-row input[type="radio"] {
	-webkit-appearance: radio !important;
	appearance: radio !important;
	opacity: 1 !important;
	width: 16px !important;
	height: 16px !important;
	margin: 0 !important;
	accent-color: var(--bcr-primary, #e63946);
	flex-shrink: 0;
	cursor: pointer;
}

.bcr-pay-name { font-size: .92em; font-weight: 600; }

.bcr-payment-instructions {
	margin-top: 12px;
	padding: 10px 12px;
	background: var(--bcr-bg2, #f8f9fa);
	border: 1px solid var(--bcr-border, #dee2e6);
	border-radius: 6px;
	font-size: .85em;
	color: var(--bcr-muted, #6c757d);
	line-height: 1.5;
}

.bcr-payment-instructions p { margin: 0 0 6px; }
.bcr-payment-instructions p:last-child { margin-bottom: 0; }

/* PayPal buttons sit at the bottom of the scrollable body so the expanding
   inline card form stays inside the scrollable zone and all fields are reachable */
.bcr-paypal-buttons {
	width: 100%;
}

/* ── Discount ────────────────────────────────────────────────────────── */

.bcr-discount-wrap {
	display: flex;
	gap: 8px;
}

.bcr-discount-wrap .bcr-input { flex: 1; }

.bcr-discount-msg {
	font-size: .85em;
	margin-top: 6px;
	min-height: 18px;
}

/* ── Price breakdown ─────────────────────────────────────────────────── */

.bcr-bd { display: flex; flex-direction: column; gap: 7px; }

.bcr-bd-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: .88em;
	color: var(--bcr-muted, #6c757d);
}

.bcr-bd-rule      { color: #2980b9; }
.bcr-bd-surcharge { color: #c0392b; }
.bcr-bd-saving    { color: #27ae60; }
.bcr-bd-extra     { color: var(--bcr-text, #212529); }
.bcr-bd-deposit   { color: var(--bcr-muted, #6c757d); font-style: italic; }

/* Total row — replaces the old hr + .bcr-bd-total combo */
.bcr-bd-total-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-weight: 700;
	font-size: 1.05em;
	color: var(--bcr-text, #212529);
	border-top: 1px solid var(--bcr-border, #dee2e6);
	padding-top: 8px;
	margin-top: 4px;
}

/* Keep .bcr-bd-total as alias for any remaining references */
.bcr-bd-total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-weight: 700;
	font-size: 1em;
	color: var(--bcr-text, #212529);
}

.bcr-total-amt {
	font-size: 1.2em;
	color: var(--bcr-primary);
}

/* ── Customer form ───────────────────────────────────────────────────── */

.bcr-form-section-title {
	margin: 4px 0 14px;
	font-size: .95em;
	font-weight: 700;
	color: var(--bcr-text);
}

.bcr-form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 14px;
}

.bcr-field-full { grid-column: 1 / -1; }

.bcr-terms-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: .88em;
	color: var(--bcr-muted);
	cursor: pointer;
	margin-top: 4px;
}

.bcr-terms-link {
	color: var(--bcr-primary, #e63946);
	text-decoration: underline;
	cursor: pointer;
}

.bcr-terms-link:hover { color: var(--bcr-text, #212529); }

/* Terms viewer sits above the booking modal */
.bcr-terms-overlay { z-index: 1000000; }

.bcr-terms-modal { max-width: 560px; }

.bcr-terms-body {
	font-size: .92em;
	line-height: 1.6;
	color: var(--bcr-text, #212529);
}

.bcr-terms-body p { margin: 0 0 10px; }
.bcr-terms-body h3, .bcr-terms-body h4 { margin: 14px 0 6px; }
.bcr-terms-body ul, .bcr-terms-body ol { margin: 0 0 10px 20px; }

.bcr-terms-label input[type="checkbox"] {
	-webkit-appearance: checkbox !important;
	appearance: checkbox !important;
	opacity: 1 !important;
	visibility: visible !important;
	position: static !important;
	display: inline-block !important;
	width: 16px !important;
	height: 16px !important;
	margin: 2px 0 0 !important;
	accent-color: var(--bcr-primary, #e63946);
	flex-shrink: 0;
	cursor: pointer;
}

/* ── Modal footer (sticky) ───────────────────────────────────────────── */

.bcr-modal-footer {
	padding: 14px 20px;
	border-top: 1px solid var(--bcr-border);
	background: var(--bcr-bg);
	border-radius: 0 0 var(--bcr-radius) var(--bcr-radius);
	flex-shrink: 0;
}

.bcr-modal-footer-btns {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}

.bcr-btn-confirm { padding: 11px 28px; font-size: 1em; }

/* ── Confirmation ─────────────────────────────────────────────────────── */

.bcr-confirmation {
	text-align: center;
	padding: 48px 20px;
}

.bcr-confirm-icon {
	width: 64px;
	height: 64px;
	background: #27ae60;
	color: #fff;
	font-size: 1.8em;
	line-height: 64px;
	border-radius: 50%;
	margin: 0 auto 20px;
}

.bcr-ref-box {
	display: inline-block;
	background: var(--bcr-bg2);
	border: 2px solid var(--bcr-primary);
	border-radius: 6px;
	padding: 12px 28px;
	font-size: 1.2em;
	margin: 16px 0;
}

/* ── Attribution ──────────────────────────────────────────────────────── */

.bingocr-attribution {
	text-align: center;
	font-size: .78em;
	color: var(--bcr-muted);
	margin-top: 8px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 680px) {
	.bcr-form-grid   { grid-template-columns: 1fr; }
	.bcr-search-grid { grid-template-columns: 1fr 1fr; }

	.bcr-overlay {
		padding: 0;
		align-items: flex-start;
	}
	.bcr-modal {
		max-width: 100%;
		height: 100dvh;
		height: 100vh; /* fallback */
		max-height: 100dvh;
		max-height: 100vh; /* fallback */
		border-radius: 0;
	}
	.bcr-modal-summary { padding: 12px 16px; }
	.bcr-cars-grid .bcr-car-card:only-child { max-width: 100%; }
}

@media (max-width: 420px) {
	.bcr-search-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
	.bcr-search-grid { grid-template-columns: 1fr; }
}
