/**
 * Tobalt Routes Frontend Styles
 *
 * @package Tobalt_Routes
 * @author Tobalt — https://tobalt.lt
 */

/* Container */
.tobalt-routes-container {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	max-width: 900px;
	margin: 0 auto;
	padding: 20px;
}

/* Direction Toggle */
.tobalt-direction-toggle {
	display: flex;
	gap: 10px;
	margin-bottom: 20px;
	justify-content: center;
}

.tobalt-btn {
	padding: 10px 20px;
	border: 2px solid #0073aa;
	background: #fff;
	color: #0073aa;
	border-radius: 5px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s ease;
}

.tobalt-btn:hover {
	background: #f0f7fc;
}

.tobalt-btn.active {
	background: #0073aa;
	color: #fff;
}

.tobalt-btn-primary {
	background: #0073aa;
	color: #fff;
}

.tobalt-btn-primary:hover {
	background: #005a87;
}

.tobalt-btn-sm {
	padding: 6px 12px;
	font-size: 12px;
}

.tobalt-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* Search Form */
.tobalt-search-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 15px;
	margin-bottom: 30px;
	padding: 20px;
	background: #f9f9f9;
	border-radius: 8px;
}

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

.tobalt-form-group label {
	font-size: 13px;
	color: #555;
	margin-bottom: 5px;
	font-weight: 500;
}

.tobalt-select,
.tobalt-input {
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 5px;
	font-size: 14px;
	background: #fff;
	width: 100%;
	box-sizing: border-box;
}

.tobalt-select:focus,
.tobalt-input:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Results */
.tobalt-results {
	margin-top: 20px;
}

.tobalt-no-results {
	text-align: center;
	padding: 40px;
	background: #f9f9f9;
	border-radius: 8px;
	color: #666;
}

/* Result Card */
.tobalt-result-card {
	background: #fff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	margin-bottom: 15px;
	overflow: hidden;
	transition: box-shadow 0.2s ease;
}

.tobalt-result-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tobalt-result-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	background: #f9f9f9;
	border-bottom: 1px solid #e5e5e5;
}

.tobalt-route-name {
	font-weight: 600;
	font-size: 16px;
	color: #333;
}

.tobalt-route-type {
	font-size: 12px;
	color: #666;
	background: #e5e5e5;
	padding: 4px 10px;
	border-radius: 20px;
}

.tobalt-result-body {
	padding: 20px;
}

.tobalt-time-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 15px;
}

.tobalt-departure,
.tobalt-arrival {
	flex: 1;
}

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

.tobalt-label {
	display: block;
	font-size: 12px;
	color: #666;
	margin-bottom: 3px;
}

.tobalt-time {
	display: block;
	font-size: 24px;
	font-weight: 700;
	color: #0073aa;
}

.tobalt-stop {
	display: block;
	font-size: 14px;
	color: #333;
	margin-top: 3px;
}

.tobalt-arrow {
	font-size: 24px;
	color: #ccc;
	padding: 0 20px;
}

.tobalt-result-actions {
	display: flex;
	justify-content: flex-end;
	padding-top: 15px;
	border-top: 1px solid #f0f0f0;
}

/* Stops List */
.tobalt-stops-list {
	padding: 10px 20px;
	background: #fafafa;
	border-top: 1px solid #e5e5e5;
	font-size: 13px;
	color: #666;
}

.tobalt-stops-list .tobalt-label {
	display: inline;
	margin-right: 5px;
}

.tobalt-stop-item small {
	color: #0073aa;
	margin-left: 3px;
}

/* Modal */
.tobalt-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tobalt-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
}

.tobalt-modal-content {
	position: relative;
	background: #fff;
	border-radius: 8px;
	width: 90%;
	max-width: 800px;
	max-height: 90vh;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.tobalt-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	border-bottom: 1px solid #e5e5e5;
}

.tobalt-modal-header h3 {
	margin: 0;
	font-size: 18px;
}

.tobalt-modal-close {
	background: none;
	border: none;
	font-size: 28px;
	color: #666;
	cursor: pointer;
	line-height: 1;
	padding: 0;
}

.tobalt-modal-close:hover {
	color: #333;
}

.tobalt-modal-body {
	padding: 0;
}

.tobalt-modal-footer {
	padding: 15px 20px;
	border-top: 1px solid #e5e5e5;
	text-align: right;
}

/* Map */
#tobalt-map {
	width: 100%;
	height: 400px;
}

/* x-cloak for Alpine.js */
[x-cloak] {
	display: none !important;
}

/* Loading State */
.tobalt-loading {
	position: relative;
	pointer-events: none;
}

.tobalt-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border: 3px solid #e5e5e5;
	border-top-color: #0073aa;
	border-radius: 50%;
	animation: tobalt-spin 0.8s linear infinite;
}

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

/* Responsive */
@media screen and (max-width: 600px) {
	.tobalt-search-form {
		grid-template-columns: 1fr;
	}

	.tobalt-time-info {
		flex-direction: column;
		text-align: center;
	}

	.tobalt-departure,
	.tobalt-arrival {
		text-align: center;
		padding: 10px 0;
	}

	.tobalt-arrow {
		transform: rotate(90deg);
		padding: 10px 0;
	}

	.tobalt-result-header {
		flex-direction: column;
		gap: 10px;
		text-align: center;
	}

	.tobalt-modal-content {
		width: 95%;
		max-height: 95vh;
	}
}

/* Flatpickr customization */
.flatpickr-calendar {
	font-family: inherit;
}

/* Leaflet customization */
.leaflet-popup-content-wrapper {
	border-radius: 8px;
}

.tobalt-map-popup {
	font-size: 13px;
}

.tobalt-map-popup strong {
	display: block;
	margin-bottom: 5px;
}

.tobalt-map-popup small {
	color: #666;
}
