/* BWOT Satellite Viewer - Frontend Styles */

.bwot-sv-viewer {
	position: relative;
	width: 100%;
	min-height: 320px;
	background: #0a0e14;
	border-radius: 6px;
	overflow: hidden;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	touch-action: pan-x pan-y;
}

.bwot-sv-viewer * {
	box-sizing: border-box;
}

.bwot-sv-viewer.bwot-sv-theme-light {
	background: #eef1f4;
}

.bwot-sv-map {
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* Leaflet fades each individual tile in from opacity 0 over ~200ms as it
   loads, via a JS requestAnimationFrame loop - separate from, and in
   addition to, this plugin's own crossfade logic that swaps opacity at
   the LAYER level once a whole frame's tiles are ready. Setting
   fadeAnimation:false on the map (see bwot-map.js) is supposed to disable
   this, but it's a known Leaflet quirk that it doesn't always fully take.
   Forcing every tile to opacity:1 here is a deterministic belt-and-suspenders
   fix: CSS opacity compounds down the DOM tree, so this doesn't fight the
   plugin's own layer-level opacity control (a tile forced to opacity:1
   inside a layer container still at opacity:0 stays invisible) - it only
   ever removes Leaflet's separate per-tile fade-in, giving a hard instant
   cut on every frame change instead of a soft blink. */
.bwot-sv-map .leaflet-tile {
	opacity: 1 !important;
	transition: none !important;
}

/* Dark/light basemap now comes from real CartoDB tile sets (see bwot-map.js),
   no CSS filter hack needed. */

/* --- City labels --- */
.bwot-sv-city-label {
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
	transform: translate(-4px, -8px);
	pointer-events: none;
}

.bwot-sv-city-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #ffd23f;
	border: 1px solid rgba(0, 0, 0, 0.5);
	flex: 0 0 auto;
}

.bwot-sv-city-name {
	font-size: 11px;
	font-weight: 600;
	color: #fff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.6);
}

.bwot-sv-theme-light .bwot-sv-city-name {
	color: #1a1a1a;
	text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9), 0 0 4px rgba(255, 255, 255, 0.6);
}

/* --- Toolbar --- */
.bwot-sv-toolbar {
	position: absolute;
	top: 8px;
	left: 8px;
	right: 8px;
	z-index: 500;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex-wrap: wrap;
	pointer-events: none;
	min-height: 40px;
}

/* Our toolbar spans the full width at the top of the map, which is
   exactly where Leaflet places its default zoom control - without this,
   the zoom buttons render underneath our toolbar and become unclickable.
   Push any Leaflet-anchored top controls down below the toolbar band. */
.bwot-sv-viewer .leaflet-top {
	top: 56px;
}

.bwot-sv-toolbar-left,
.bwot-sv-toolbar-right {
	display: flex;
	align-items: center;
	gap: 6px;
	pointer-events: auto;
}

.bwot-sv-toolbar select,
.bwot-sv-toolbar input[type="range"] {
	background: rgba(20, 24, 32, 0.85);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 4px;
	padding: 4px 6px;
	font-size: 12px;
}

.bwot-sv-theme-light .bwot-sv-toolbar select {
	background: rgba(255, 255, 255, 0.9);
	color: #1a1a1a;
	border-color: rgba(0, 0, 0, 0.15);
}

.bwot-sv-opacity-wrap {
	display: flex;
	align-items: center;
}

.bwot-sv-opacity {
	width: 90px;
}

.bwot-sv-reset-view,
.bwot-sv-fullscreen-toggle {
	background: rgba(20, 24, 32, 0.85);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 4px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
}

.bwot-sv-theme-light .bwot-sv-reset-view,
.bwot-sv-theme-light .bwot-sv-fullscreen-toggle {
	background: rgba(255, 255, 255, 0.9);
	color: #1a1a1a;
	border-color: rgba(0, 0, 0, 0.15);
}

/* --- Animation bar --- */
.bwot-sv-animation-bar {
	position: absolute;
	left: 8px;
	right: 8px;
	bottom: 8px;
	z-index: 500;
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(15, 18, 24, 0.85);
	backdrop-filter: blur(4px);
	border-radius: 6px;
	padding: 6px 10px;
	color: #fff;
	flex-wrap: wrap;
}

.bwot-sv-theme-light .bwot-sv-animation-bar {
	background: rgba(255, 255, 255, 0.92);
	color: #1a1a1a;
}

.bwot-sv-transport {
	display: flex;
	gap: 4px;
}

.bwot-sv-btn {
	background: transparent;
	border: none;
	color: inherit;
	font-size: 16px;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
}

.bwot-sv-btn:hover,
.bwot-sv-reset-view:hover,
.bwot-sv-fullscreen-toggle:hover {
	background: rgba(255, 255, 255, 0.15);
}

.bwot-sv-timeline {
	flex: 1 1 120px;
	min-width: 100px;
	accent-color: #2a9df4;
}

.bwot-sv-timestamp {
	font-size: 12px;
	white-space: nowrap;
	min-width: 90px;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* --- Status message --- */
.bwot-sv-status {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 600;
	color: #fff;
	background: rgba(0, 0, 0, 0.6);
	padding: 6px 14px;
	border-radius: 4px;
	font-size: 13px;
	pointer-events: none;
}

.bwot-sv-status:empty {
	display: none;
}

.bwot-sv-status-error {
	background: rgba(200, 40, 40, 0.85);
}

/* --- Offline / stale-data notice --- */
/* Small, unobtrusive corner badge - never blocks interaction or covers
   the map, and never interrupts animation. Only shown when the backend
   flags the served data as stale (see FrameManager::is_data_stale()). */
.bwot-sv-offline-notice {
	position: absolute;
	left: 8px;
	bottom: 8px;
	z-index: 550;
	display: none;
	background: rgba(120, 90, 10, 0.9);
	color: #fff;
	font-size: 11px;
	padding: 4px 10px;
	border-radius: 4px;
	pointer-events: none;
	max-width: calc(100% - 16px);
}

.bwot-sv-offline-notice.bwot-sv-visible {
	display: block;
}

/* When the animation bar is present, sit above it instead of overlapping. */
.bwot-sv-viewer:has(.bwot-sv-animation-bar) .bwot-sv-offline-notice {
	bottom: 56px;
}

/* --- Fullscreen mode --- */
.bwot-sv-viewer.bwot-sv-is-fullscreen,
.bwot-sv-viewer.bwot-sv-is-fullscreen-fallback {
	position: fixed !important;
	inset: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	z-index: 100000;
	border-radius: 0;
}

/* --- Mobile responsiveness --- */
@media (max-width: 600px) {
	.bwot-sv-toolbar {
		font-size: 11px;
	}
	.bwot-sv-opacity {
		width: 60px;
	}
	.bwot-sv-timestamp {
		min-width: 70px;
		font-size: 11px;
	}
	.bwot-sv-animation-bar {
		gap: 6px;
		padding: 4px 6px;
	}
	.bwot-sv-btn {
		font-size: 14px;
		padding: 3px 6px;
	}
	/* Toolbar is more likely to wrap to two lines on narrow screens -
	   give the zoom control extra clearance. */
	.bwot-sv-viewer .leaflet-top {
		top: 92px;
	}
}
