* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html,
body,
#root {
	height: 100%;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app {
	display: flex;
	height: 100%;
}

.sidebar {
	width: 320px;
	min-width: 320px;
	height: 100%;
	overflow-y: auto;
	padding: 16px;
	background: #f8f9fa;
	border-right: 1px solid #dee2e6;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.auth-controls {
	display: flex;
	align-items: center;
}

.sign-in-btn {
	padding: 5px 12px;
	background: #212529;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
}

.sign-in-btn:hover {
	background: #343a40;
}

.map-container {
	flex: 1;
	height: 100%;
}

.search-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ced4da;
	border-radius: 6px;
	font-size: 14px;
}

.stop-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.stop-item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 8px;
	padding-left: 12px;
	border-radius: 6px;
	background: white;
	border: 1px solid #e9ecef;
	border-left: 3px solid #6c757d;
	cursor: pointer;
}

.stop-item:hover {
	background: #e9ecef;
}

.stop-item input[type="checkbox"] {
	margin-top: 3px;
	width: 18px;
	height: 18px;
	min-width: 18px;
	pointer-events: none;
}

.stop-info {
	flex: 1;
	font-size: 13px;
}

.stop-name {
	font-weight: 600;
	font-size: 14px;
}

.stop-modes {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
	margin-top: 2px;
}

.mode-badge {
	display: inline-block;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 600;
	color: white;
	line-height: 1.4;
}

.stop-meta {
	color: #6c757d;
	font-size: 12px;
}

.slider-container {
	padding: 8px 0;
}

.slider-container label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 8px;
}

.slider-container input[type="range"] {
	width: 100%;
}

.slider-value {
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	color: #495057;
}

.stats-bar {
	padding: 8px 12px;
	background: #e9ecef;
	border-radius: 6px;
	font-size: 12px;
	color: #495057;
}

.section-title {
	font-size: 13px;
	font-weight: 600;
	color: #495057;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.loading {
	text-align: center;
	padding: 16px;
	color: #6c757d;
	font-size: 13px;
}

.error-message {
	padding: 8px 12px;
	background: #f8d7da;
	color: #842029;
	border-radius: 6px;
	font-size: 13px;
}

.stop-indicator {
	font-weight: 400;
	color: #6c757d;
}

.stop-towards {
	font-size: 12px;
	color: #0d6efd;
	font-style: italic;
}

.loading-bar {
	display: flex;
	align-items: center;
	gap: 8px;
}

.spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid #dee2e6;
	border-top-color: #495057;
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
}

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

.favourites-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.favourite-item {
	display: flex;
	align-items: center;
	gap: 4px;
	border-radius: 6px;
	background: white;
	border: 1px solid #e9ecef;
}

.favourite-load {
	flex: 1;
	padding: 8px;
	background: none;
	border: none;
	cursor: pointer;
	text-align: left;
	font: inherit;
	border-radius: 6px 0 0 6px;
}

.favourite-load:hover {
	background: #e9ecef;
}

.favourite-name {
	font-weight: 600;
	font-size: 13px;
}

.favourite-meta {
	color: #6c757d;
	font-size: 11px;
}

.favourite-action {
	padding: 4px 8px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 14px;
	color: #6c757d;
	border-radius: 4px;
}

.favourite-action:hover {
	background: #e9ecef;
}

.favourite-delete:hover {
	color: #dc3545;
}

.favourite-edit {
	flex: 1;
	padding: 4px;
}

.favourite-edit-input {
	width: 100%;
	padding: 4px 8px;
	border: 1px solid #0d6efd;
	border-radius: 4px;
	font-size: 13px;
	outline: none;
}

.save-favourite-btn {
	width: 100%;
	padding: 8px;
	background: #e9ecef;
	border: 1px solid #ced4da;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: #495057;
}

.save-favourite-btn:hover {
	background: #dee2e6;
}

.postcode-panel {
	background: white;
	border: 1px solid #e9ecef;
	border-radius: 6px;
	padding: 8px;
}

.postcode-tree {
	display: flex;
	flex-direction: column;
}

.postcode-group-header {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 3px 6px;
	cursor: pointer;
	border-radius: 4px;
	font-size: 12px;
}

.postcode-group-header:hover {
	background: #f0f0f0;
}

.postcode-group-arrow {
	width: 12px;
	font-size: 8px;
	color: #6c757d;
	transition: transform 0.15s;
	flex-shrink: 0;
}

.postcode-group-arrow.expanded {
	transform: rotate(90deg);
}

.postcode-group-label {
	font-weight: 600;
	font-family: monospace;
	font-size: 12px;
}

.postcode-group-count {
	color: #6c757d;
	font-size: 11px;
}

.postcode-group-avg {
	color: #198754;
	font-size: 11px;
	font-weight: 600;
}

.postcode-group-children {
	padding-left: 16px;
}

.postcode-group-links {
	margin-left: auto;
	display: flex;
	gap: 2px;
	flex-shrink: 0;
}

.postcode-leaf {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 2px 6px;
	font-size: 12px;
}

.postcode-leaf-code {
	font-family: monospace;
	font-size: 11px;
	color: #495057;
}

.postcode-price {
	font-size: 10px;
	font-weight: 600;
	color: #198754;
}

.postcode-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 2px;
	text-decoration: none;
	border-radius: 3px;
}

.postcode-link:hover {
	background: #dee2e6;
}

.postcode-icon {
	width: 14px;
	height: 14px;
	display: block;
}

.postcode-actions {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

.postcode-action-btn {
	padding: 4px 8px;
	background: none;
	border: 1px solid #ced4da;
	border-radius: 4px;
	cursor: pointer;
	font-size: 11px;
	color: #495057;
}

.postcode-action-btn:hover {
	background: #e9ecef;
}

.search-type-toggle {
	display: flex;
	border: 1px solid #ced4da;
	border-radius: 4px;
	overflow: hidden;
}

.toggle-btn {
	padding: 4px 8px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 11px;
	color: #495057;
}

.toggle-btn.active {
	background: #495057;
	color: white;
}

.toggle-btn:not(.active):hover {
	background: #e9ecef;
}

.postcode-tooltip {
	position: fixed;
	padding: 4px 8px;
	background: rgba(0, 0, 0, 0.8);
	color: white;
	font-size: 12px;
	font-family: monospace;
	border-radius: 4px;
	pointer-events: none;
	z-index: 1000;
	white-space: nowrap;
}

.map-click-popup {
	position: fixed;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	background: white;
	border: 1px solid #dee2e6;
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	pointer-events: auto;
	z-index: 1001;
	white-space: nowrap;
}

.map-click-popup-close {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	color: #6c757d;
	padding: 0 2px;
	order: 3;
}

.map-click-popup-close:hover {
	color: #343a40;
}

.map-click-popup-postcode {
	font-family: monospace;
	font-size: 13px;
	font-weight: 600;
	color: #212529;
}

.map-click-popup-links {
	display: flex;
	gap: 2px;
}

.debug-overlay {
	position: fixed;
	bottom: 16px;
	right: 16px;
	z-index: 1001;
	width: 360px;
	max-height: 50vh;
	overflow-y: auto;
}

.debug-panel {
	background: #1e1e1e;
	border-radius: 6px;
	overflow: hidden;
	font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.debug-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 10px;
	background: #2d2d2d;
	font-size: 11px;
	font-weight: 600;
	color: #9da5b4;
}

.debug-close {
	padding: 2px 6px;
	background: #3a3a3a;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	font-size: 10px;
	font-family: inherit;
	color: #666;
}

.debug-close:hover {
	background: #444;
	color: #9da5b4;
}

.debug-elapsed {
	color: #e5c07b;
}

.debug-elapsed.debug-done {
	color: #98c379;
}

.debug-steps {
	padding: 4px 0;
}

.debug-step {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 2px 10px;
	font-size: 11px;
	color: #abb2bf;
}

.debug-step-icon {
	color: #61afef;
	width: 14px;
	text-align: center;
	flex-shrink: 0;
}

.debug-step-done .debug-step-icon {
	color: #98c379;
}

.debug-step-active {
	color: #e5c07b;
}

.debug-step-active .spinner {
	width: 10px;
	height: 10px;
	border-width: 1.5px;
	border-color: #555;
	border-top-color: #e5c07b;
}

.debug-step-detail {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.paywall-banner {
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 8px;
	padding: 16px;
}

.paywall-title {
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 6px;
}

.paywall-text {
	font-size: 13px;
	color: #495057;
	line-height: 1.5;
	margin-bottom: 10px;
}

.paywall-price {
	font-size: 20px;
	font-weight: 700;
	margin-bottom: 12px;
}

.paywall-btn {
	width: 100%;
	padding: 10px;
	background: #212529;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
}

.paywall-btn:hover {
	background: #343a40;
}

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