/**
 * S4 — Booking rules & listing (T&C 6.6, 7.2, 8.1, 8.2, 15.1).
 * Booking form times / airport / cross-border, checkout additional drivers,
 * host approvals card, "Gestionar tu reserva" panel, listing inventory.
 */

:root {
	--bv-s4-primary: var(--color-primary, #ED6A1A);
	--bv-s4-primary-dark: var(--color-primary-dark, #C4550F);
	--bv-s4-ink: #121820;
	--bv-s4-text: #374151;
	--bv-s4-muted: #6b7280;
	--bv-s4-border: #E5E5E5;
	--bv-s4-soft: #FFF8F2;
	--bv-s4-soft-border: #F0E6D9;
}

/* ---------- Buttons, badges, notices ---------- */

.bv-s4-btn {
	box-sizing: border-box;
	max-width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 40px;
	padding: 9px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--bv-s4-primary);
	color: #fff !important;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	cursor: pointer;
	white-space: nowrap;
	list-style: none;
}
.bv-s4-btn:hover,
.bv-s4-btn:focus-visible { background: var(--bv-s4-primary-dark); }
.bv-s4-btn:focus-visible { outline: 2px solid var(--bv-s4-primary-dark); outline-offset: 2px; }
.bv-s4-btn--ghost { background: #fff; color: var(--bv-s4-text) !important; border: 1px solid #d1d5db; }
.bv-s4-btn--ghost:hover,
.bv-s4-btn--ghost:focus-visible { background: #fff; border-color: var(--bv-s4-primary); color: var(--bv-s4-primary-dark) !important; }
.bv-s4-btn--danger { background: #fff; color: #b03a2e !important; border: 1px solid #f1b5ad; }
.bv-s4-btn--danger:hover,
.bv-s4-btn--danger:focus-visible { background: #FDECEB; border-color: #c0392b; }
summary.bv-s4-btn::-webkit-details-marker { display: none; }
summary.bv-s4-btn::marker { content: ''; }

.bv-s4-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 9999px;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
	vertical-align: middle;
}
.bv-s4-badge--pending { background: rgba(243, 156, 18, 0.14); color: #8a4b08; }
.bv-s4-badge--ok { background: rgba(39, 174, 96, 0.14); color: #1E6B3C; }
.bv-s4-badge--bad { background: rgba(231, 76, 60, 0.12); color: #9B2C21; }
.bv-s4-badge--muted { background: rgba(149, 165, 166, 0.2); color: #4B5859; }

.bv-s4-notice {
	margin: 0 0 12px;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.875rem;
	line-height: 1.45;
}
.bv-s4-notice--ok { background: #ECFDF5; border: 1px solid #10B981; color: #065F46; }
.bv-s4-notice--error { background: #FEF2F2; border: 1px solid #EF4444; color: #991B1B; }
.bv-s4-notice--warn { background: #FFF8F2; border: 1px solid #F5C08F; color: #7A3E0B; }
.bv-s4-notice p { margin: 8px 0 0; }

/* ---------- Lists / items (host card, panels) ---------- */

.bv-s4-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	margin-left: 6px;
	padding: 0 6px;
	border-radius: 9999px;
	background: var(--bv-s4-primary);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	vertical-align: middle;
}
.bv-s4-card { border-color: var(--bv-s4-primary); }
.bv-s4-card .bv-widget-header { flex-wrap: wrap; gap: 6px; }
.bv-s4-card__hint { font-size: 0.8125rem; color: #6b7280; }
.bv-s4-card__group { margin: 14px 0 8px; font-size: 0.9rem; font-weight: 600; color: var(--bv-s4-ink); }
.bv-s4-card__group:first-of-type { margin-top: 0; }

.bv-s4-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bv-s4-list--compact { gap: 8px; }
.bv-s4-item {
	padding: 12px 14px;
	border: 1px solid var(--bv-s4-soft-border);
	border-radius: 10px;
	background: var(--bv-s4-soft);
	min-width: 0;
}
.bv-s4-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--bv-s4-ink); }
.bv-s4-item__meta { margin-top: 4px; font-size: 0.85rem; line-height: 1.45; color: #4b5563; overflow-wrap: anywhere; }
.bv-s4-item__meta--muted { color: var(--bv-s4-muted); }
.bv-s4-item__meta a { color: var(--bv-s4-primary-dark); }
.bv-s4-item__actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 10px; }
.bv-s4-item__actions form { margin: 0; }
.bv-s4-deadline {
	display: inline-block;
	margin-top: 8px;
	padding: 3px 8px;
	border-radius: 6px;
	background: rgba(243, 156, 18, 0.12);
	color: #8a4b08;
	font-size: 0.8125rem;
	font-weight: 600;
}

.bv-s4-disclose { flex: 1 1 100%; }
.bv-s4-disclose > summary { display: inline-flex; }
.bv-s4-disclose[open] > summary { margin-bottom: 10px; }
.bv-s4-item__actions .bv-s4-disclose { flex: 0 1 auto; }
.bv-s4-item__actions .bv-s4-disclose[open] { flex: 1 1 100%; }

.bv-s4-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px;
	border: 1px solid var(--bv-s4-border);
	border-radius: 8px;
	background: #fff;
}
.bv-s4-form--danger { border-color: #f1b5ad; }
.bv-s4-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; color: #333; }
.bv-s4-form input[type="text"],
.bv-s4-form input[type="date"],
.bv-s4-form input[type="file"],
.bv-s4-form select,
.bv-s4-form textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font: inherit;
	font-weight: 400;
	background: #fff;
}
.bv-s4-form small { color: #555; font-weight: 400; line-height: 1.45; }
.bv-s4-form .bv-s4-btn { align-self: flex-start; }
.bv-s4-check { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 8px; font-weight: 500 !important; line-height: 1.4; }
.bv-s4-check input { margin-top: 3px; accent-color: var(--bv-s4-primary); flex-shrink: 0; }
.bv-s4-inline-form { margin: 8px 0 0; }

/* ---------- Panels (guest view-order, host order, checklist, admin) ---------- */

.bv-s4-panel {
	margin: 0 0 24px;
	padding: 20px;
	border: 1px solid var(--bv-s4-border);
	border-radius: 12px;
	background: #fff;
}
.dokan-panel.bv-s4-panel { padding: 0; }
.bv-s4-panel__title { margin: 0 0 12px; font-size: 1.05rem; font-weight: 600; color: var(--bv-s4-ink); }
.bv-s4-block + .bv-s4-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid #F0F0F0; }
.bv-s4-block__title { margin: 0 0 6px; font-size: 0.95rem; font-weight: 600; color: var(--bv-s4-ink); }
.bv-s4-block__text { margin: 0 0 8px; font-size: 0.9rem; line-height: 1.5; color: #333; }
.bv-s4-block__hint { margin: 0 0 8px; font-size: 0.8125rem; line-height: 1.45; color: var(--bv-s4-muted); }
.bv-s4-admin .bv-s4-item { background: #fafafa; border-color: #e5e5e5; }

.bv-s4-mod__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bv-s4-mod__preview:empty { display: none; }
.bv-s4-mod__preview { padding: 8px 10px; border-radius: 6px; background: #F8FAFC; border: 1px solid #E2E8F0; font-size: 0.875rem; color: #333; }
.bv-s4-mod__preview.is-ok { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.bv-s4-mod__preview.is-error { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.bv-s4-xb__options { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* ---------- Booking form (single product) ---------- */

.bv-s4-times { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bv-s4-times__field { min-width: 0; }
.bv-s4-select {
	box-sizing: border-box;
	width: 100%;
	padding: 7px 8px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #fff;
	color: var(--bv-s4-ink);
	font: inherit;
	font-size: 0.9rem;
}
.bv-s4-select:focus-visible { outline: 2px solid var(--bv-s4-primary); outline-offset: 1px; }
.bv-s4-times__legend { margin: 6px 0 0; font-size: 0.75rem; line-height: 1.4; color: var(--bv-s4-muted); }
.bv-s4-times__warn {
	margin: 6px 0 0;
	padding: 6px 8px;
	border-radius: 6px;
	background: rgba(237, 106, 26, 0.08);
	color: #9a3412;
	font-size: 0.8rem;
	line-height: 1.4;
}
.bv-s4-label-gap { margin-top: 0.6rem; }
/* Rejected "Reservar" (server notice) + same-day pickup guard. */
.bv-s4-notices { margin: 0 0 0.6rem; }
.bv-s4-notices p { margin: 0; }
.bv-s4-notices p + p { margin-top: 4px; }
.bv-s4-times__error { margin: 6px 0 0; font-size: 0.8rem; line-height: 1.4; }
.bv-s4-times__error[hidden] { display: none; }
.bv-delivery-dd__opt:focus-visible { outline: 2px solid var(--bv-s4-primary); outline-offset: -2px; }

.bv-s4-xb { margin-top: 0.6rem; border-top: 1px solid #e5e7eb; padding-top: 0.5rem; }
.bv-s4-xb > summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--bv-s4-ink); padding: 2px 0; }
.bv-s4-xb__body { padding-top: 6px; font-size: 0.85rem; }
.bv-s4-xb__body p { margin: 0 0 6px; }
.bv-s4-xb__body small { display: block; margin-top: 6px; color: var(--bv-s4-muted); line-height: 1.4; }

/* ---------- Listing: inventory ---------- */

.bv-s4-inventory__list {
	margin: 0;
	padding: 0;
	list-style: none;
	columns: 2;
	column-gap: 1.5rem;
}
.bv-s4-inventory__list li { break-inside: avoid; padding: 0.2rem 0; color: #333; }
.bv-s4-inventory__qty { display: inline-block; min-width: 2.2em; font-weight: 600; color: var(--bv-s4-primary-dark); }
.bv-s4-inventory__note { margin: 0.6rem 0 0; font-size: 0.85rem; color: #555; line-height: 1.45; }

/* ---------- Checkout: additional drivers ---------- */

.bv-s4-drivers__intro { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: var(--bv-s4-muted); }
.bv-s4-drivers { display: flex; flex-direction: column; gap: 10px; }
.bv-s4-driver { padding: 12px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
.bv-s4-driver__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bv-s4-driver__title { font-weight: 600; font-size: 14px; color: var(--bv-s4-ink); }
.bv-s4-driver__remove { background: none; border: 0; color: #b03a2e; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.bv-s4-driver__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bv-s4-driver__grid label { display: flex; flex-direction: column; justify-content: space-between; /* fields line up when one label wraps */ gap: 3px; font-size: 12px; font-weight: 600; color: #4b5563; min-width: 0; }
.bv-s4-driver__grid input,
.bv-s4-driver__grid select {
	box-sizing: border-box;
	width: 100%;
	padding: 8px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font: inherit;
	font-size: 14px;
	font-weight: 400;
	background: #fff;
}
.bv-s4-driver__doc { display: grid; grid-template-columns: 110px 1fr; gap: 6px; }
.bv-s4-driver__files { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.bv-s4-file {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px;
	border: 1px dashed #d1d5db;
	border-radius: 8px;
	font-size: 12px;
	color: #4b5563;
	min-width: 0;
}
.bv-s4-file__label { font-weight: 600; }
.bv-s4-file__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	padding: 6px 10px;
	border: 1px solid var(--bv-s4-primary);
	border-radius: 6px;
	color: var(--bv-s4-primary-dark);
	font-weight: 600;
	cursor: pointer;
	overflow: hidden;
}
.bv-s4-file__btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bv-s4-file__btn:focus-within { outline: 2px solid var(--bv-s4-primary); outline-offset: 2px; }
.bv-s4-file__status { overflow-wrap: anywhere; }
.bv-s4-file__status.is-ok { color: #1E6B3C; }
.bv-s4-file__status.is-error { color: #9B2C21; }
.bv-s4-driver__warn { margin: 6px 0 0; font-size: 12px; color: #9B2C21; }
.bv-s4-add-driver {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 12px;
	padding: 8px 14px;
	border: 1px dashed var(--bv-s4-primary);
	border-radius: 8px;
	background: transparent;
	color: var(--bv-s4-primary-dark);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.bv-s4-add-driver:hover,
.bv-s4-add-driver:focus-visible { background: var(--bv-s4-soft); }
.bv-s4-add-driver[hidden] { display: none; }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
	.bv-s4-panel { padding: 16px; }
	.bv-s4-mod__grid,
	.bv-s4-driver__grid,
	.bv-s4-driver__files { grid-template-columns: 1fr; }
	.bv-s4-inventory__list { columns: 1; }
	.bv-s4-item__actions > form,
	.bv-s4-item__actions > .bv-s4-disclose { flex: 1 1 100%; }
	.bv-s4-item__actions .bv-s4-btn,
	.bv-s4-disclose > summary.bv-s4-btn,
	.bv-s4-form .bv-s4-btn { width: 100%; }
	.bv-s4-btn { white-space: normal; text-align: center; }
}
