/**
 * Smart Drive — Frontend styles
 * Everything is scoped under .sd-scope so it never leaks into the theme.
 */

.sd-scope {
	--sd-primary: #2457f5;
	--sd-primary-dark: #1a44d1;
	--sd-ink: #1a1d21;
	--sd-muted: #6b7280;
	--sd-border: #e5e7eb;
	--sd-bg: #ffffff;
	--sd-bg-soft: #f9fafb;
	--sd-success-bg: #ecfdf3;
	--sd-success-text: #036b26;
	--sd-error-bg: #fef2f2;
	--sd-error-text: #b91c1c;
	--sd-radius: 10px;
	--sd-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--sd-ink);
	box-sizing: border-box;
}

.sd-scope *,
.sd-scope *::before,
.sd-scope *::after {
	box-sizing: inherit;
}

.sd-scope .hidden {
	display: none !important;
}

.sd-scope .tk-required {
	color: var(--sd-primary);
}

/* -----------------------------------------------------------------------
 * Booking form (tk-*)
 * -------------------------------------------------------------------- */

.tk-card {
	width: 100%;
	background: var(--sd-bg);
	border: 1px solid var(--sd-border);
	border-radius: var(--sd-radius);
	box-shadow: var(--sd-shadow);
	padding: 1.75rem;
}

.tk-alert {
	display: none;
	padding: 0.75rem 1rem;
	border-radius: 8px;
	font-size: 0.9rem;
	margin-bottom: 1rem;
	line-height: 1.4;
}

.tk-alert-visible {
	display: block;
}

.tk-alert-success {
	background: var(--sd-success-bg);
	color: var(--sd-success-text);
	border: 1px solid #a7f0c4;
}

.tk-alert-error {
	background: var(--sd-error-bg);
	color: var(--sd-error-text);
	border: 1px solid #fecaca;
}

.tk-trip-toggle {
	display: inline-flex;
	background: var(--sd-bg-soft);
	border: 1px solid var(--sd-border);
	border-radius: 999px;
	padding: 4px;
	margin-bottom: 1.5rem;
}

.tk-trip-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: none;
	background: transparent;
	color: var(--sd-muted);
	font-size: 0.85rem;
	font-weight: 600;
	padding: 0.5rem 1rem;
	border-radius: 999px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.tk-trip-btn.active {
	background: var(--sd-primary);
	color: #fff;
}

.tk-trip-btn svg {
	flex: none;
}

.tk-section-title {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--sd-muted);
	margin: 1.5rem 0 1rem;
}

.tk-section-title:first-of-type {
	margin-top: 0;
}

/* -----------------------------------------------------------------------
 * Form grid — 3 cols on desktop, 1 col on mobile.
 * Any field can span all columns with .tk-span-2 (kept name for
 * backwards compatibility — it always spans full width via 1 / -1).
 * -------------------------------------------------------------------- */

.tk-form-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1rem 1.25rem;
	margin-bottom: 0.5rem;
}

.tk-span-2 {
	grid-column: 1 / -1;
}

/* The pickup/swap/drop-off row always spans full width and lays its
   own two fields + swap button out with flex. */
.tk-locations-row {
	grid-column: 1 / -1;
	display: flex;
	align-items: flex-end;
	gap: 0.75rem;
}

.tk-locations-row .tk-field {
	flex: 1;
	min-width: 0;
}

.tk-swap-btn {
	flex: none;
	width: 34px;
	height: 34px;
	margin-bottom: 2px;
	border-radius: 50%;
	border: 1px solid var(--sd-border);
	background: var(--sd-bg);
	color: var(--sd-primary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.tk-swap-btn:hover {
	background: var(--sd-bg-soft);
	border-color: var(--sd-primary);
}

.tk-field {
	margin-bottom: 0;
}

.tk-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--sd-ink);
	margin-bottom: 0.4rem;
}

.tk-label svg {
	color: var(--sd-muted);
	flex: none;
}

.tk-optional {
	font-weight: 400;
	color: var(--sd-muted);
	font-size: 0.78rem;
}

.tk-input-wrap {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	border: 1px solid var(--sd-border);
	border-radius: 8px;
	padding: 0 0.75rem;
	background: var(--sd-bg);
	transition: border-color .15s ease;
}

.tk-input-wrap:focus-within {
	border-color: var(--sd-primary);
}

.tk-icon,
.tk-icon-textarea {
	color: var(--sd-muted);
	flex: none;
}

.tk-icon-textarea {
	margin-top: 0.85rem;
}

.tk-input {
	flex: 1;
	border: none;
	outline: none;
	background: transparent;
	font-size: 0.92rem;
	color: var(--sd-ink);
	padding: 0.65rem 0;
	width: 100%;
	font-family: inherit;
}

.tk-input::placeholder {
	color: #9ca3af;
}

.tk-select {
	appearance: none;
	cursor: pointer;
}

.tk-textarea {
	resize: vertical;
	min-height: 70px;
	padding-top: 0.7rem;
	line-height: 1.4;
}

.tk-submit {
	width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--sd-primary);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0.9rem 1rem;
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
	margin-top: 0.5rem;
	transition: background .15s ease;
}

.tk-submit:hover {
	background: var(--sd-primary-dark);
}

.tk-submit:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.tk-perks {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
	margin-top: 1.25rem;
	padding-top: 1.1rem;
	border-top: 1px solid var(--sd-border);
}

.tk-perk {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.78rem;
	color: var(--sd-muted);
}

.tk-perk svg {
	color: var(--sd-primary);
	flex: none;
}

/* -----------------------------------------------------------------------
 * Mobile — collapse the 3-column grid (and the locations row) to 1 column.
 * -------------------------------------------------------------------- */

@media (max-width: 768px) {
	.tk-form-grid {
		grid-template-columns: 1fr;
	}

	.tk-locations-row {
		flex-direction: column;
		align-items: stretch;
	}

	.tk-locations-row .tk-swap-btn {
		align-self: center;
		margin: 0.1rem 0;
	}
}

/* -----------------------------------------------------------------------
 * Fleet grid ([smart_drive_fleet])
 * -------------------------------------------------------------------- */

.sd-fleet-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.25rem;
}

.sd-fleet-card {
	border: 1px solid var(--sd-border);
	border-radius: var(--sd-radius);
	overflow: hidden;
	background: var(--sd-bg);
	box-shadow: var(--sd-shadow);
}

.sd-fleet-media {
	position: relative;
	aspect-ratio: 16 / 10;
	background: var(--sd-bg-soft);
}

.sd-fleet-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.sd-fleet-media-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.sd-fleet-tag {
	position: absolute;
	top: 10px;
	left: 10px;
	background: rgba(0, 0, 0, .65);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 999px;
	z-index: 1;
}

.sd-fleet-body {
	padding: 1rem 1.1rem 1.1rem;
}

.sd-fleet-body h3 {
	margin: 0 0 0.5rem;
	font-size: 1.05rem;
}

.sd-fleet-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.85rem;
	font-size: 0.8rem;
	color: var(--sd-muted);
	margin-bottom: 1rem;
}

.sd-fleet-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--sd-border);
}

.sd-fleet-note {
	font-size: 0.8rem;
	color: var(--sd-muted);
}

.sd-reserve-link {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--sd-primary);
	text-decoration: none;
}

.sd-reserve-link:hover {
	color: var(--sd-primary-dark);
}

.sd-empty {
	color: var(--sd-muted);
	text-align: center;
	padding: 2rem 0;
}