/**
 * Tobalt Routes Frontend Styles
 *
 * Professional transit schedule interface with WCAG 2.1 AA compliance
 *
 * @package Tobalt_Routes
 * @author Tobalt — https://tobalt.lt
 */

/* ==========================================================================
   CSS Custom Properties & Reset
   ========================================================================== */

.tobalt-routes-container {
	/* Color System - Light Green Theme */
	--tobalt-primary: #059669;
	--tobalt-primary-dark: #047857;
	--tobalt-primary-light: #d1fae5;
	--tobalt-primary-hover: #10b981;
	--tobalt-accent: #34d399;
	--tobalt-success: #059669;
	--tobalt-success-light: #d1fae5;
	--tobalt-warning: #d97706;
	--tobalt-error: #dc2626;

	/* Neutrals */
	--tobalt-white: #ffffff;
	--tobalt-gray-50: #f8fafc;
	--tobalt-gray-100: #f1f5f9;
	--tobalt-gray-200: #e2e8f0;
	--tobalt-gray-300: #cbd5e1;
	--tobalt-gray-400: #94a3b8;
	--tobalt-gray-500: #64748b;
	--tobalt-gray-600: #475569;
	--tobalt-gray-700: #334155;
	--tobalt-gray-800: #1e293b;
	--tobalt-gray-900: #0f172a;

	/* Typography */
	--tobalt-font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
	--tobalt-font-mono: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;

	/* Spacing */
	--tobalt-space-xs: 0.25rem;
	--tobalt-space-sm: 0.5rem;
	--tobalt-space-md: 1rem;
	--tobalt-space-lg: 1.5rem;
	--tobalt-space-xl: 2rem;
	--tobalt-space-2xl: 3rem;

	/* Borders & Shadows */
	--tobalt-radius-sm: 6px;
	--tobalt-radius-md: 10px;
	--tobalt-radius-lg: 14px;
	--tobalt-radius-full: 9999px;
	--tobalt-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
	--tobalt-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
	--tobalt-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.1);
	--tobalt-shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);

	/* Focus ring for accessibility */
	--tobalt-focus-ring: 0 0 0 3px rgba(5, 150, 105, 0.4);

	/* Transitions */
	--tobalt-transition-fast: 150ms ease;
	--tobalt-transition-normal: 250ms ease;
}

/* CSS Isolation - Reset inherited styles */
.tobalt-routes-container,
.tobalt-routes-container *,
.tobalt-routes-container *::before,
.tobalt-routes-container *::after {
	box-sizing: border-box;
}

.tobalt-routes-container {
	/* Isolation without all:initial to preserve CSS variables */
	display: block;
	font-family: var(--tobalt-font-sans);
	font-size: 16px;
	line-height: 1.5;
	color: var(--tobalt-gray-800);
	background: var(--tobalt-white);
	max-width: 920px;
	margin: 0 auto;
	padding: var(--tobalt-space-lg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Reset text styles that might be inherited */
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	word-spacing: normal;
}

/* Alpine.js cloak - hide elements until Alpine initializes */
[x-cloak] {
	display: none !important;
}

/* ==========================================================================
   Skip Link for Screen Readers
   ========================================================================== */

.tobalt-skip-link {
	position: absolute;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.tobalt-skip-link:focus {
	position: fixed;
	top: var(--tobalt-space-md);
	left: var(--tobalt-space-md);
	width: auto;
	height: auto;
	padding: var(--tobalt-space-sm) var(--tobalt-space-md);
	background: var(--tobalt-primary);
	color: var(--tobalt-white);
	border-radius: var(--tobalt-radius-sm);
	z-index: 100000;
	font-weight: 600;
	text-decoration: none;
}

/* ==========================================================================
   Direction Toggle
   ========================================================================== */

.tobalt-direction-toggle {
	display: flex;
	justify-content: center;
	gap: 4px;
	margin-bottom: 2rem;
	padding: 4px;
	background: #f1f5f9;
	border-radius: 9999px;
	width: fit-content;
	margin-left: auto;
	margin-right: auto;
}

.tobalt-direction-toggle [role="tablist"] {
	display: flex;
	gap: var(--tobalt-space-xs);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.tobalt-btn,
.tobalt-routes-container .tobalt-btn,
.tobalt-routes-container button.tobalt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 18px;
	font-family: var(--tobalt-font-sans);
	font-size: 13px !important;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	border: 1.5px solid var(--tobalt-gray-300) !important;
	border-radius: 8px !important;
	cursor: pointer;
	transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
	white-space: nowrap;
	background: #ffffff !important;
	background-color: #ffffff !important;
	color: var(--tobalt-gray-700) !important;
	min-height: 42px;
}

.tobalt-btn:hover,
.tobalt-routes-container .tobalt-btn:hover {
	background: #d1fae5 !important;
	background-color: #d1fae5 !important;
	border-color: var(--tobalt-primary) !important;
	color: var(--tobalt-primary-dark) !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

.tobalt-btn:focus-visible {
	outline: none;
	box-shadow: var(--tobalt-focus-ring);
}

.tobalt-btn.active,
.tobalt-btn[aria-selected="true"],
.tobalt-routes-container .tobalt-btn.active {
	background: #059669 !important;
	background-color: #059669 !important;
	color: #ffffff !important;
	border-color: #059669 !important;
}

.tobalt-btn-primary,
.tobalt-routes-container .tobalt-btn-primary {
	background: #059669 !important;
	background-color: #059669 !important;
	color: #ffffff !important;
	border-color: #059669 !important;
	padding: 10px 18px;
	font-size: 13px !important;
	border-radius: 8px !important;
	min-height: 42px;
}

.tobalt-btn-primary:hover,
.tobalt-routes-container .tobalt-btn-primary:hover {
	background: #047857 !important;
	background-color: #047857 !important;
	border-color: #047857 !important;
	color: #ffffff !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.tobalt-btn-primary:focus-visible {
	background: var(--tobalt-primary-dark);
}

.tobalt-btn-primary:active {
	transform: translateY(0);
}

.tobalt-btn-sm,
.tobalt-routes-container .tobalt-btn-sm {
	padding: 8px 16px;
	font-size: 13px !important;
	border-radius: var(--tobalt-radius-sm) !important;
	border: 1px solid var(--tobalt-gray-300) !important;
	color: var(--tobalt-gray-700) !important;
	background: #ffffff !important;
	background-color: #ffffff !important;
}

.tobalt-btn-sm:hover,
.tobalt-routes-container .tobalt-btn-sm:hover {
	background: #f8fafc !important;
	background-color: #f8fafc !important;
	border-color: var(--tobalt-primary) !important;
	color: var(--tobalt-primary) !important;
}

.tobalt-btn-outline,
.tobalt-routes-container .tobalt-btn-outline {
	background: #ffffff !important;
	background-color: #ffffff !important;
	border: 1px solid var(--tobalt-gray-300) !important;
	color: var(--tobalt-gray-600) !important;
}

.tobalt-btn-outline:hover,
.tobalt-routes-container .tobalt-btn-outline:hover {
	background: #f8fafc !important;
	background-color: #f8fafc !important;
	border-color: var(--tobalt-primary) !important;
	color: var(--tobalt-primary) !important;
}

.tobalt-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* Icon in buttons */
.tobalt-btn svg,
.tobalt-btn-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

/* ==========================================================================
   Search Form - Card Layout with Steps
   ========================================================================== */

.tobalt-search-form {
	background: var(--tobalt-white);
	border: 1px solid var(--tobalt-gray-200);
	border-radius: var(--tobalt-radius-lg);
	padding: var(--tobalt-space-xl);
	margin-bottom: var(--tobalt-space-xl);
	box-shadow: var(--tobalt-shadow-md);
}

.tobalt-form-row {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--tobalt-space-lg);
	margin-bottom: var(--tobalt-space-lg);
}

.tobalt-form-row-single {
	grid-template-columns: 1fr;
}

.tobalt-form-row:last-child {
	margin-bottom: 0;
}

.tobalt-form-group {
	display: flex;
	flex-direction: column;
	position: relative;
}

.tobalt-form-group label {
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-sm);
	font-size: 13px;
	font-weight: 600;
	color: var(--tobalt-gray-700);
	margin-bottom: var(--tobalt-space-sm);
	letter-spacing: 0.01em;
}

.tobalt-form-group label .tobalt-step-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	background: var(--tobalt-primary);
	color: var(--tobalt-white);
	font-size: 12px;
	font-weight: 700;
	border-radius: var(--tobalt-radius-full);
	flex-shrink: 0;
}

/* Form icon wrapper */
.tobalt-input-wrapper {
	position: relative;
}

.tobalt-input-wrapper .tobalt-input-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	color: var(--tobalt-gray-400);
	pointer-events: none;
}

.tobalt-input-wrapper .tobalt-select,
.tobalt-input-wrapper .tobalt-input {
	padding-left: 44px;
}

/* ==========================================================================
   Form Inputs
   ========================================================================== */

.tobalt-select,
.tobalt-input {
	width: 100%;
	padding: 14px 16px;
	font-family: var(--tobalt-font-sans);
	font-size: 15px;
	line-height: 1.4;
	color: var(--tobalt-gray-800);
	background: var(--tobalt-white);
	border: 2px solid var(--tobalt-gray-200);
	border-radius: var(--tobalt-radius-md);
	transition: all var(--tobalt-transition-fast);
	appearance: none;
	-webkit-appearance: none;
}

.tobalt-select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 20px;
	padding-right: 44px;
	cursor: pointer;
}

.tobalt-select:hover,
.tobalt-input:hover {
	border-color: var(--tobalt-gray-300);
}

.tobalt-select:focus,
.tobalt-input:focus {
	outline: none;
	border-color: var(--tobalt-primary);
	box-shadow: var(--tobalt-focus-ring);
}

.tobalt-select:focus-visible,
.tobalt-input:focus-visible {
	outline: none;
	border-color: var(--tobalt-primary);
	box-shadow: var(--tobalt-focus-ring);
}

/* Placeholder styling */
.tobalt-select option[value=""] {
	color: var(--tobalt-gray-400);
}

.tobalt-input::placeholder {
	color: var(--tobalt-gray-400);
}

/* Error state */
.tobalt-form-group.has-error .tobalt-select,
.tobalt-form-group.has-error .tobalt-input {
	border-color: var(--tobalt-error);
}

.tobalt-form-group.has-error .tobalt-select:focus,
.tobalt-form-group.has-error .tobalt-input:focus {
	box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.tobalt-error-message {
	font-size: 13px;
	color: var(--tobalt-error);
	margin-top: var(--tobalt-space-xs);
}

/* Autocomplete dropdown */
.tobalt-autocomplete {
	position: relative;
}

.tobalt-autocomplete-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 100;
	background: #ffffff !important;
	background-color: #ffffff !important;
	border: 1px solid var(--tobalt-gray-200);
	border-top: none;
	border-radius: 0 0 var(--tobalt-radius-md) var(--tobalt-radius-md);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	max-height: 240px;
	overflow-y: auto;
}

.tobalt-autocomplete-item,
.tobalt-autocomplete-dropdown button,
.tobalt-routes-container .tobalt-autocomplete-item {
	display: block;
	width: 100%;
	padding: 10px 14px;
	text-align: left;
	background: #ffffff !important;
	background-color: #ffffff !important;
	border: none;
	border-bottom: 1px solid var(--tobalt-gray-100);
	font-size: 14px !important;
	color: var(--tobalt-gray-700) !important;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.tobalt-autocomplete-item:last-child {
	border-bottom: none;
}

.tobalt-autocomplete-item:hover,
.tobalt-autocomplete-item:focus,
.tobalt-autocomplete-dropdown button:hover,
.tobalt-autocomplete-dropdown button:focus {
	background: var(--tobalt-primary-light) !important;
	background-color: #d1fae5 !important;
	color: var(--tobalt-primary-dark) !important;
	outline: none;
}

.tobalt-autocomplete .tobalt-input {
	border-radius: var(--tobalt-radius-md);
}

.tobalt-autocomplete .tobalt-input:focus {
	border-radius: var(--tobalt-radius-md) var(--tobalt-radius-md) 0 0;
}

.tobalt-autocomplete-empty {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 100;
	background: #ffffff !important;
	background-color: #ffffff !important;
	border: 1px solid var(--tobalt-gray-200);
	border-top: none;
	border-radius: 0 0 var(--tobalt-radius-md) var(--tobalt-radius-md);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	padding: 12px 14px;
	font-size: 14px !important;
	color: var(--tobalt-gray-500) !important;
	font-style: italic;
}

/* Search action row */
.tobalt-form-actions {
	display: flex;
	justify-content: center;
	padding-top: var(--tobalt-space-lg);
	border-top: 1px solid var(--tobalt-gray-100);
	margin-top: var(--tobalt-space-sm);
}

.tobalt-form-actions .tobalt-btn-primary {
	min-width: 200px;
}

/* ==========================================================================
   Results Section
   ========================================================================== */

.tobalt-results {
	margin-top: var(--tobalt-space-xl);
}

.tobalt-results-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--tobalt-space-lg);
	padding-bottom: var(--tobalt-space-md);
	border-bottom: 2px solid var(--tobalt-gray-100);
}

.tobalt-results-title {
	font-size: 18px;
	font-weight: 700;
	color: var(--tobalt-gray-900);
}

.tobalt-results-count {
	font-size: 14px;
	color: var(--tobalt-gray-500);
	background: var(--tobalt-gray-100);
	padding: 6px 14px;
	border-radius: var(--tobalt-radius-full);
}

/* No Results */
.tobalt-no-results {
	text-align: center;
	padding: var(--tobalt-space-2xl);
	background: var(--tobalt-gray-50);
	border: 2px dashed var(--tobalt-gray-200);
	border-radius: var(--tobalt-radius-lg);
}

.tobalt-no-results-icon {
	width: 64px;
	height: 64px;
	margin: 0 auto var(--tobalt-space-md);
	color: var(--tobalt-gray-300);
}

.tobalt-no-results p {
	font-size: 16px;
	color: var(--tobalt-gray-500);
	margin: 0;
}

.tobalt-next-available {
	margin-top: var(--tobalt-space-lg);
	padding-top: var(--tobalt-space-lg);
	border-top: 1px solid var(--tobalt-gray-200);
}

.tobalt-next-info {
	font-size: 14px;
	line-height: 1.8;
	color: var(--tobalt-gray-600);
	margin: 0;
}

.tobalt-next-info strong {
	color: var(--tobalt-primary);
}

.tobalt-next-route {
	color: var(--tobalt-gray-500);
	font-size: 13px;
}

/* Alternative pickup suggestion */
.tobalt-alternative-pickup {
	background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
	border: 1px solid #a7f3d0;
	border-left: 4px solid var(--tobalt-primary);
	border-radius: var(--tobalt-radius-md);
	padding: var(--tobalt-space-md);
	margin-top: var(--tobalt-space-lg);
}

.tobalt-alternative-info {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	color: #047857;
	line-height: 1.8;
}

.tobalt-alternative-info svg {
	color: var(--tobalt-primary);
	flex-shrink: 0;
}

.tobalt-alternative-info strong {
	color: #065f46;
	font-weight: 600;
}

.tobalt-alternative-duration {
	color: #059669;
	font-size: 13px;
	margin-left: 4px;
}

/* ==========================================================================
   Result Card
   ========================================================================== */

.tobalt-result-card {
	background: var(--tobalt-white);
	border: 1px solid var(--tobalt-gray-200);
	border-radius: var(--tobalt-radius-lg);
	margin-bottom: var(--tobalt-space-md);
	overflow: hidden;
	transition: all var(--tobalt-transition-normal);
}

.tobalt-result-card:hover {
	border-color: var(--tobalt-gray-300);
	box-shadow: var(--tobalt-shadow-lg);
	transform: translateY(-2px);
}

.tobalt-result-card:focus-within {
	border-color: var(--tobalt-primary);
	box-shadow: var(--tobalt-focus-ring);
}

.tobalt-result-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--tobalt-space-md) var(--tobalt-space-lg);
	background: linear-gradient(to right, var(--tobalt-primary-light), var(--tobalt-gray-50));
	border-bottom: 1px solid var(--tobalt-gray-200);
}

.tobalt-route-name,
.tobalt-routes-container .tobalt-route-name {
	font-size: 13px !important;
	font-weight: 600 !important;
	color: var(--tobalt-gray-900) !important;
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-sm);
	line-height: 1.4 !important;
	margin: 0 !important;
	padding: 0 !important;
}

.tobalt-route-name::before {
	content: '';
	display: inline-block;
	width: 3px;
	height: 14px;
	background: var(--tobalt-primary);
	border-radius: 2px;
}

.tobalt-route-type {
	font-size: 12px;
	font-weight: 600;
	color: var(--tobalt-gray-600);
	background: var(--tobalt-white);
	padding: 5px 12px;
	border-radius: var(--tobalt-radius-full);
	border: 1px solid var(--tobalt-gray-200);
}

.tobalt-result-body {
	padding: var(--tobalt-space-lg);
}

/* Time Info Grid */
.tobalt-time-info {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: var(--tobalt-space-lg);
	align-items: center;
	margin-bottom: var(--tobalt-space-lg);
}

.tobalt-departure,
.tobalt-arrival {
	display: flex;
	flex-direction: column;
}

.tobalt-arrival {
	text-align: right;
}

.tobalt-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--tobalt-gray-500);
	margin-bottom: 4px;
}

.tobalt-time {
	font-family: var(--tobalt-font-mono);
	font-size: 28px;
	font-weight: 700;
	color: var(--tobalt-gray-900);
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.tobalt-departure .tobalt-time {
	color: var(--tobalt-primary);
}

.tobalt-arrival .tobalt-time {
	color: var(--tobalt-success);
}

.tobalt-stop {
	font-size: 14px;
	color: var(--tobalt-gray-600);
	margin-top: 4px;
}

/* Arrow with Duration */
.tobalt-arrow {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: 64px;
	height: 64px;
	background: var(--tobalt-gray-100);
	border-radius: var(--tobalt-radius-full);
	color: var(--tobalt-gray-400);
	font-size: 20px;
}

.tobalt-arrow::before {
	content: '→';
	font-size: 16px;
}

.tobalt-duration {
	font-size: 11px;
	font-weight: 600;
	color: var(--tobalt-gray-600);
	white-space: nowrap;
}

/* Result Actions - Pastel Button Group */
.tobalt-result-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
	padding-top: var(--tobalt-space-md);
	border-top: 1px solid var(--tobalt-gray-100);
}

/* Action Button Base */
.tobalt-result-actions .tobalt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 18px;
	font-size: 13px;
	font-weight: 600;
	border-radius: 8px;
	border: 1.5px solid transparent;
	cursor: pointer;
	transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
	white-space: nowrap;
	min-height: 42px;
}

.tobalt-result-actions .tobalt-btn svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	transition: transform 200ms ease;
}

/* Map Button - Primary Action (Light Green) */
.tobalt-result-actions .tobalt-btn-map {
	background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
	border-color: #a7f3d0;
	color: #047857;
}

.tobalt-result-actions .tobalt-btn-map:hover {
	background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
	border-color: #6ee7b7;
	color: #065f46;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

.tobalt-result-actions .tobalt-btn-map:hover svg {
	transform: scale(1.1);
}

.tobalt-result-actions .tobalt-btn-map:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(5, 150, 105, 0.12);
}

/* Print Buttons - Same Light Green Style */
.tobalt-result-actions .tobalt-btn-print {
	background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
	border-color: #a7f3d0;
	color: #047857;
}

.tobalt-result-actions .tobalt-btn-print:hover {
	background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
	border-color: #6ee7b7;
	color: #065f46;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

.tobalt-result-actions .tobalt-btn-print:hover svg {
	transform: scale(1.1);
}

.tobalt-result-actions .tobalt-btn-print:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(5, 150, 105, 0.12);
}

/* Focus states for accessibility */
.tobalt-result-actions .tobalt-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.3);
}

/* Button icon alignment fix */
.tobalt-result-actions .tobalt-btn span {
	line-height: 1;
}

/* ==========================================================================
   Stops List (Expandable)
   ========================================================================== */

.tobalt-stops-list {
	padding: var(--tobalt-space-md) var(--tobalt-space-lg);
	background: var(--tobalt-gray-50);
	border-top: 1px solid var(--tobalt-gray-200);
}

.tobalt-stops-list .tobalt-label {
	display: inline;
	font-size: 12px;
	margin-right: var(--tobalt-space-sm);
}

.tobalt-stop-item {
	font-size: 13px;
	color: var(--tobalt-gray-600);
}

.tobalt-stop-item small {
	font-family: var(--tobalt-font-mono);
	font-size: 12px;
	color: var(--tobalt-primary);
	background: var(--tobalt-primary-light);
	padding: 2px 6px;
	border-radius: 4px;
	margin-left: 4px;
}

/* ==========================================================================
   Results Toolbar & Favorites Filter
   ========================================================================== */

.tobalt-results-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: var(--tobalt-space-md);
}

.tobalt-favorites-filter {
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-sm);
	font-size: 14px;
	color: var(--tobalt-gray-600);
	cursor: pointer;
	padding: 8px 12px;
	border-radius: var(--tobalt-radius-sm);
	transition: all var(--tobalt-transition-fast);
}

.tobalt-favorites-filter:hover {
	background: var(--tobalt-gray-50);
	color: var(--tobalt-gray-800);
}

.tobalt-checkbox {
	width: 18px;
	height: 18px;
	accent-color: var(--tobalt-primary);
	cursor: pointer;
}

/* ==========================================================================
   Header Badges & Frequency
   ========================================================================== */

.tobalt-header-badges {
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-sm);
	flex-wrap: wrap;
}

.tobalt-frequency-badge {
	font-size: 11px;
	font-weight: 600;
	color: var(--tobalt-primary);
	background: var(--tobalt-primary-light);
	padding: 4px 10px;
	border-radius: var(--tobalt-radius-full);
	border: 1px solid rgba(3, 105, 161, 0.2);
	white-space: nowrap;
}

/* ==========================================================================
   Favorite Button
   ========================================================================== */

.tobalt-result-card {
	position: relative;
}

/* Override Elementor button styles completely */
.tobalt-favorite-btn,
.tobalt-routes-container .tobalt-favorite-btn,
.tobalt-routes-container button.tobalt-favorite-btn,
button.tobalt-favorite-btn,
.elementor button.tobalt-favorite-btn,
.elementor-widget-container button.tobalt-favorite-btn,
.tobalt-result-card button.tobalt-favorite-btn,
.tobalt-result-card .tobalt-favorite-btn {
	position: absolute !important;
	top: 16px !important;
	right: 16px !important;
	z-index: 10 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 36px !important;
	height: 36px !important;
	min-width: 36px !important;
	max-width: 36px !important;
	min-height: 36px !important;
	max-height: 36px !important;
	padding: 0 !important;
	margin: 0 !important;
	background: #ecfdf5 !important;
	background-color: #ecfdf5 !important;
	border: 1px solid #a7f3d0 !important;
	border-width: 1px !important;
	border-style: solid !important;
	border-radius: 50% !important;
	color: #059669 !important;
	cursor: pointer !important;
	transition: all 150ms ease !important;
	line-height: 1 !important;
	box-shadow: none !important;
	text-decoration: none !important;
	font-size: 14px !important;
	font-weight: 400 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
}

.tobalt-favorite-btn:hover,
.tobalt-routes-container .tobalt-favorite-btn:hover,
button.tobalt-favorite-btn:hover,
.tobalt-result-card button.tobalt-favorite-btn:hover {
	color: #047857 !important;
	border-color: #059669 !important;
	background: #d1fae5 !important;
	background-color: #d1fae5 !important;
	box-shadow: none !important;
}

.tobalt-favorite-btn.is-favorite,
.tobalt-routes-container .tobalt-favorite-btn.is-favorite,
button.tobalt-favorite-btn.is-favorite,
.tobalt-result-card button.tobalt-favorite-btn.is-favorite {
	color: #059669 !important;
	border-color: #059669 !important;
	background: #d1fae5 !important;
	background-color: #d1fae5 !important;
}

.tobalt-favorite-btn:focus,
.tobalt-favorite-btn:focus-visible,
button.tobalt-favorite-btn:focus,
button.tobalt-favorite-btn:focus-visible {
	outline: none !important;
	box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.4) !important;
}

.tobalt-favorite-btn svg,
.tobalt-routes-container .tobalt-favorite-btn svg,
button.tobalt-favorite-btn svg,
.tobalt-result-card .tobalt-favorite-btn svg,
.tobalt-heart-icon {
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	min-height: 18px !important;
	stroke: #059669 !important;
	stroke-width: 2 !important;
	fill: none !important;
	display: block !important;
	transition: fill 150ms ease !important;
}

/* Filled heart when favorited */
.tobalt-favorite-btn.is-favorite svg,
.tobalt-favorite-btn.is-favorite .tobalt-heart-icon,
button.tobalt-favorite-btn.is-favorite svg,
.tobalt-result-card .tobalt-favorite-btn.is-favorite svg {
	fill: #059669 !important;
}

/* Adjust header to account for favorite button */
.tobalt-result-header {
	padding-right: calc(var(--tobalt-space-lg) + 44px);
}

/* ==========================================================================
   Next Departures Section
   ========================================================================== */

.tobalt-next-departures {
	border-top: 1px solid var(--tobalt-gray-200);
}

.tobalt-next-departures-toggle {
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-sm);
	width: 100%;
	padding: var(--tobalt-space-md) var(--tobalt-space-lg);
	background: var(--tobalt-gray-50);
	border: none;
	font-family: var(--tobalt-font-sans);
	font-size: 13px;
	font-weight: 600;
	color: var(--tobalt-gray-600);
	cursor: pointer;
	transition: all var(--tobalt-transition-fast);
	text-align: left;
}

.tobalt-next-departures-toggle:hover {
	background: var(--tobalt-gray-100);
	color: var(--tobalt-gray-800);
}

.tobalt-next-departures-toggle:focus-visible {
	outline: none;
	box-shadow: inset var(--tobalt-focus-ring);
}

.tobalt-next-departures-toggle .tobalt-chevron {
	margin-left: auto;
	transition: transform var(--tobalt-transition-fast);
}

.tobalt-next-departures-toggle.is-expanded .tobalt-chevron {
	transform: rotate(180deg);
}

/* Departures List */
.tobalt-next-departures-list {
	padding: var(--tobalt-space-sm) var(--tobalt-space-lg) var(--tobalt-space-md);
	background: var(--tobalt-gray-50);
}

.tobalt-next-departure-item {
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-md);
	padding: var(--tobalt-space-sm) var(--tobalt-space-md);
	background: var(--tobalt-white);
	border-radius: var(--tobalt-radius-sm);
	margin-bottom: var(--tobalt-space-xs);
}

.tobalt-next-departure-item:last-child {
	margin-bottom: 0;
}

.tobalt-next-dep-time {
	font-family: var(--tobalt-font-mono);
	font-size: 15px;
	font-weight: 700;
	color: var(--tobalt-primary);
	min-width: 50px;
}

.tobalt-next-dep-arrow {
	color: var(--tobalt-gray-400);
	font-size: 14px;
}

.tobalt-next-arr-time {
	font-family: var(--tobalt-font-mono);
	font-size: 15px;
	font-weight: 600;
	color: var(--tobalt-success);
	min-width: 50px;
}

.tobalt-next-dep-duration {
	margin-left: auto;
	font-size: 12px;
	color: var(--tobalt-gray-500);
	background: var(--tobalt-gray-100);
	padding: 2px 8px;
	border-radius: var(--tobalt-radius-full);
}

/* ==========================================================================
   Modal
   ========================================================================== */

.tobalt-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--tobalt-space-md);
}

.tobalt-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.tobalt-modal-content {
	position: relative;
	background: var(--tobalt-white);
	border-radius: var(--tobalt-radius-lg);
	width: 100%;
	max-width: 800px;
	max-height: calc(100vh - 2rem);
	overflow: hidden;
	box-shadow: var(--tobalt-shadow-xl);
	display: flex;
	flex-direction: column;
}

.tobalt-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--tobalt-space-lg);
	background: var(--tobalt-gray-50);
	border-bottom: 1px solid var(--tobalt-gray-200);
	flex-shrink: 0;
}

.tobalt-modal-header h3 {
	font-size: 18px;
	font-weight: 700;
	color: var(--tobalt-gray-900);
	margin: 0;
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-sm);
}

.tobalt-modal-header h3::before {
	content: '';
	width: 4px;
	height: 20px;
	background: var(--tobalt-primary);
	border-radius: 2px;
}

.tobalt-modal-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: var(--tobalt-white);
	border: 1px solid var(--tobalt-gray-200);
	border-radius: var(--tobalt-radius-md);
	color: var(--tobalt-gray-500);
	font-size: 24px;
	cursor: pointer;
	transition: all var(--tobalt-transition-fast);
	line-height: 1;
}

.tobalt-modal-close:hover {
	background: var(--tobalt-gray-100);
	color: var(--tobalt-gray-700);
	border-color: var(--tobalt-gray-300);
}

.tobalt-modal-close:focus-visible {
	outline: none;
	box-shadow: var(--tobalt-focus-ring);
}

.tobalt-modal-body {
	flex: 1;
	overflow-y: auto;
}

#tobalt-map {
	width: 100%;
	height: 400px;
	background: var(--tobalt-gray-100);
}

.tobalt-modal-footer {
	padding: var(--tobalt-space-md) var(--tobalt-space-lg);
	background: var(--tobalt-gray-50);
	border-top: 1px solid var(--tobalt-gray-200);
	display: flex;
	justify-content: flex-end;
	flex-shrink: 0;
}

/* ==========================================================================
   Map Legend
   ========================================================================== */

.tobalt-map-legend {
	padding: var(--tobalt-space-lg);
	background: var(--tobalt-white);
	border-top: 1px solid var(--tobalt-gray-200);
}

.tobalt-legend-title {
	font-size: 13px;
	font-weight: 700;
	color: var(--tobalt-gray-800);
	margin-bottom: var(--tobalt-space-md);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.tobalt-legend-items {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tobalt-space-lg);
	margin-bottom: var(--tobalt-space-md);
}

.tobalt-legend-item {
	display: flex;
	align-items: center;
	gap: var(--tobalt-space-sm);
	font-size: 14px;
	color: var(--tobalt-gray-600);
}

.tobalt-legend-marker {
	width: 16px;
	height: 16px;
	border-radius: var(--tobalt-radius-full);
	border: 3px solid var(--tobalt-white);
	box-shadow: 0 0 0 1px var(--tobalt-gray-300), var(--tobalt-shadow-sm);
	flex-shrink: 0;
}

.tobalt-marker-green {
	background: var(--tobalt-success);
}

.tobalt-marker-blue {
	background: var(--tobalt-primary);
}

.tobalt-marker-red {
	background: var(--tobalt-error);
}

.tobalt-legend-line {
	width: 28px;
	height: 4px;
	background: var(--tobalt-primary);
	border-radius: 2px;
	flex-shrink: 0;
}

.tobalt-legend-help {
	font-size: 13px;
	color: var(--tobalt-gray-500);
	line-height: 1.6;
	padding-top: var(--tobalt-space-md);
	border-top: 1px solid var(--tobalt-gray-100);
}

.tobalt-legend-help strong {
	color: var(--tobalt-gray-700);
}

/* ==========================================================================
   Leaflet Customization
   ========================================================================== */

.tobalt-routes-container .leaflet-popup-content-wrapper {
	border-radius: var(--tobalt-radius-md);
	box-shadow: var(--tobalt-shadow-lg);
	padding: 0;
}

.tobalt-routes-container .leaflet-popup-content {
	margin: 0;
}

.tobalt-map-popup {
	padding: var(--tobalt-space-md);
	font-family: var(--tobalt-font-sans);
}

.tobalt-map-popup strong {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--tobalt-gray-900);
	margin-bottom: 4px;
}

.tobalt-map-popup small {
	font-family: var(--tobalt-font-mono);
	font-size: 13px;
	color: var(--tobalt-primary);
	font-weight: 600;
}

/* ==========================================================================
   Flatpickr Customization
   ========================================================================== */

.tobalt-routes-container ~ .flatpickr-calendar,
.flatpickr-calendar {
	font-family: var(--tobalt-font-sans), -apple-system, BlinkMacSystemFont, sans-serif;
	border-radius: var(--tobalt-radius-md);
	box-shadow: var(--tobalt-shadow-lg);
	border: 1px solid var(--tobalt-gray-200);
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.tobalt-loading {
	position: relative;
	pointer-events: none;
}

.tobalt-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 24px;
	height: 24px;
	margin: -12px 0 0 -12px;
	border: 3px solid var(--tobalt-gray-200);
	border-top-color: var(--tobalt-primary);
	border-radius: var(--tobalt-radius-full);
	animation: tobalt-spin 0.7s linear infinite;
}

@keyframes tobalt-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Button loading state */
.tobalt-btn-primary.tobalt-loading {
	color: transparent;
}

.tobalt-btn-primary.tobalt-loading::after {
	border-color: rgba(255, 255, 255, 0.3);
	border-top-color: var(--tobalt-white);
}

/* ==========================================================================
   Alpine.js Cloak
   ========================================================================== */

[x-cloak] {
	display: none !important;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.tobalt-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 100001;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 20px;
	background: #059669;
	color: #ffffff;
	font-size: 14px;
	font-weight: 500;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tobalt-toast svg {
	width: 16px;
	height: 16px;
	stroke: #ffffff;
	fill: none;
	flex-shrink: 0;
}

/* Toast transitions */
.tobalt-toast-enter {
	transition: all 200ms ease-out;
}

.tobalt-toast-enter-start {
	opacity: 0;
	transform: translateX(-50%) translateY(20px);
}

.tobalt-toast-enter-end {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.tobalt-toast-leave {
	transition: all 150ms ease-in;
}

.tobalt-toast-leave-start {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.tobalt-toast-leave-end {
	opacity: 0;
	transform: translateX(-50%) translateY(20px);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet */
@media screen and (max-width: 900px) {
	.tobalt-routes-container {
		padding: var(--tobalt-space-md);
	}

	.tobalt-search-form {
		padding: var(--tobalt-space-lg);
	}

	.tobalt-form-row {
		gap: var(--tobalt-space-md);
	}
}

/* Mobile */
@media screen and (max-width: 600px) {
	.tobalt-routes-container {
		padding: var(--tobalt-space-sm);
		font-size: 15px;
	}

	.tobalt-direction-toggle {
		width: 100%;
		margin-bottom: var(--tobalt-space-lg);
	}

	.tobalt-direction-toggle .tobalt-btn {
		flex: 1;
		padding: 10px 16px;
		font-size: 14px;
	}

	.tobalt-search-form {
		padding: var(--tobalt-space-md);
		border-radius: var(--tobalt-radius-md);
	}

	.tobalt-form-row {
		grid-template-columns: 1fr;
		gap: var(--tobalt-space-md);
		margin-bottom: var(--tobalt-space-md);
	}

	.tobalt-form-group label {
		font-size: 12px;
	}

	.tobalt-select,
	.tobalt-input {
		padding: 12px 14px;
		font-size: 16px; /* Prevents zoom on iOS */
	}

	.tobalt-select {
		padding-right: 40px;
	}

	.tobalt-form-actions {
		padding-top: var(--tobalt-space-md);
	}

	.tobalt-form-actions .tobalt-btn-primary {
		width: 100%;
		min-width: auto;
	}

	/* Result Cards Mobile */
	.tobalt-result-header {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--tobalt-space-sm);
		padding: var(--tobalt-space-md);
	}

	.tobalt-result-body {
		padding: var(--tobalt-space-md);
	}

	.tobalt-time-info {
		grid-template-columns: 1fr;
		gap: var(--tobalt-space-md);
		text-align: center;
	}

	.tobalt-departure,
	.tobalt-arrival {
		text-align: center;
		padding: var(--tobalt-space-md);
		background: var(--tobalt-gray-50);
		border-radius: var(--tobalt-radius-md);
	}

	.tobalt-time {
		font-size: 24px;
	}

	.tobalt-arrow {
		margin: 0 auto;
		transform: rotate(90deg);
		width: 48px;
		height: 48px;
		font-size: 16px;
	}

	.tobalt-duration {
		transform: rotate(-90deg);
		font-size: 10px;
	}

	/* Header badges mobile */
	.tobalt-header-badges {
		width: 100%;
		justify-content: flex-start;
	}

	/* Favorite button mobile */
	.tobalt-favorite-btn,
	.tobalt-routes-container .tobalt-favorite-btn,
	button.tobalt-favorite-btn,
	.tobalt-result-card .tobalt-favorite-btn {
		top: 8px !important;
		right: 8px !important;
		width: 32px !important;
		height: 32px !important;
		min-width: 32px !important;
		max-width: 32px !important;
		min-height: 32px !important;
		max-height: 32px !important;
	}

	.tobalt-favorite-btn svg,
	button.tobalt-favorite-btn svg,
	.tobalt-result-card .tobalt-favorite-btn svg {
		width: 16px !important;
		height: 16px !important;
		min-width: 16px !important;
		min-height: 16px !important;
	}

	/* Next departures mobile */
	.tobalt-next-departures-toggle {
		padding: var(--tobalt-space-md);
		font-size: 12px;
	}

	.tobalt-next-departures-list {
		padding: var(--tobalt-space-sm) var(--tobalt-space-md);
	}

	.tobalt-next-departure-item {
		gap: var(--tobalt-space-sm);
		padding: var(--tobalt-space-sm);
	}

	.tobalt-next-dep-time,
	.tobalt-next-arr-time {
		font-size: 14px;
		min-width: 45px;
	}

	.tobalt-result-actions {
		justify-content: center;
		gap: 8px;
	}

	.tobalt-result-actions .tobalt-btn {
		padding: 10px 14px;
		font-size: 12px;
		min-height: 40px;
		flex: 1 1 auto;
		max-width: calc(50% - 4px);
	}

	.tobalt-result-actions .tobalt-btn-map {
		flex: 1 1 100%;
		max-width: 100%;
		order: -1;
	}

	/* Modal Mobile */
	.tobalt-modal {
		padding: 0;
		align-items: flex-end;
	}

	.tobalt-modal-content {
		border-radius: var(--tobalt-radius-lg) var(--tobalt-radius-lg) 0 0;
		max-height: 90vh;
	}

	.tobalt-modal-header {
		padding: var(--tobalt-space-md);
	}

	.tobalt-modal-header h3 {
		font-size: 16px;
	}

	#tobalt-map {
		height: 300px;
	}

	.tobalt-map-legend {
		padding: var(--tobalt-space-md);
	}

	.tobalt-legend-items {
		flex-direction: column;
		gap: var(--tobalt-space-sm);
	}

	.tobalt-legend-item {
		font-size: 13px;
	}

	.tobalt-legend-help {
		font-size: 12px;
	}

	/* Stops list mobile */
	.tobalt-stops-list {
		padding: var(--tobalt-space-md);
	}
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.tobalt-routes-container {
		--tobalt-gray-200: #999;
		--tobalt-gray-400: #666;
		--tobalt-gray-500: #555;
	}

	.tobalt-btn,
	.tobalt-select,
	.tobalt-input {
		border-width: 3px;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	.tobalt-routes-container *,
	.tobalt-routes-container *::before,
	.tobalt-routes-container *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* Print styles */
@media print {
	.tobalt-routes-container {
		max-width: none;
		padding: 0;
	}

	.tobalt-direction-toggle,
	.tobalt-search-form,
	.tobalt-result-actions,
	.tobalt-modal {
		display: none !important;
	}

	.tobalt-result-card {
		break-inside: avoid;
		box-shadow: none;
		border: 1px solid #000;
	}
}
