/* styles.css */

:root {
	--font-primary: system-ui, 'Poppins', sans-serif;
	--primary-color: #5ba96b;
	--primary-color-rgb: 83, 153, 97;

	--text-white: #F1F1F1;
	--text-black: #222222;
	--icon-color: #a8a8ad;

	--fuel-regular-color: #539961;
	--fuel-midgrade-color:#2a77aa;
	--fuel-premium-color: #d7751f;
	--fuel-diesel-color: #d0ab16;

	
	/* Dark Mode Colors */
	--body-bg-dark: #1F1F1F;
	--header-bg-dark: #2A2A2A;
	--primary-bg-dark: #2E2E2E;
	--base-bg-dark: #1e1e1e;
	--text-muted-dark: #b4b4b4;

	/* Light Mode Colors */
	--body-bg-light: #F2EEE8;
	--header-bg-light: #2C2C2C;
	--base-bg-light: #E6E0D9;
	--primary-bg-light: #DCDCDC;
	

	--header-bg: var(--header-bg-light);
	--bubble-bg: var(--primary-bg-light);
	--bubble-text: var(--text-black);

	--title-color: var(--text-black);
	--subtitle-color: #373737;

	--fuel-row-bg: var(--base-bg-light);
	--fuel-button-bg: var(--primary-bg-light);
	--fuel-gradient-base: var(--primary-bg-light);
	--fuel-img-filter: none;
	--fuel-text-color: var(--text-black);
	--bubble-section-bg: var(--base-bg-light);
	--bubble-section-title-color: var(--text-black);
	--last-updated-color: var(--text-black);

	/* Map control tokens */
	--map-control-bg: rgba(249, 243, 234, 0.85);
	--map-control-border: rgba(0, 0, 0, 0.12);
	--map-control-button-bg: rgba(249, 243, 234, 0.0);
	--map-control-button-border: rgba(0, 0, 0, 0.10);
	--map-control-button-hover-bg: rgba(0, 0, 0, 0.04);
	--map-control-text: var(--text-black);
}


html, body {
	margin: 0;
	padding: 0;
	/* height: 100%; */
	font-family: var(--font-primary);
	box-sizing: border-box;
}

body {
	background-color: var(--body-bg-light);
}

body.dark{
	background-color: var(--body-bg-dark);
	--header-bg: var(--header-bg-dark);
	--fuel-row-bg: var(--base-bg-dark);
	--fuel-button-bg: var(--primary-bg-dark);
	--fuel-gradient-base: var(--primary-bg-dark);
	--fuel-img-filter: invert(1);
	--fuel-text-color: var(--text-white);
	--bubble-bg:   var(--primary-bg-dark);
	--bubble-text: var(--text-white);
	--title-color: var(--text-white);
	--subtitle-color: var(--text-muted-dark);
	--bubble-section-title-color: var(--text-white);
	--last-updated-color: var(--text-muted-dark);
	--bubble-section-bg: var(--base-bg-dark);

	--map-control-bg: rgba(20, 20, 20, 0.9);
	--map-control-border: rgba(var(--primary-color-rgb), 0.35);
	--map-control-button-bg: rgba(0, 0, 0, 0.0);
	--map-control-button-border: rgba(255, 255, 255, 0.06);
	--map-control-button-hover-bg: rgba(var(--primary-color-rgb), 0.10);
	--map-control-text: var(--text-white);
}


.header {
	background-color: var(--header-bg);
	height: 80px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	/* padding: 0 2.5rem; */
	padding: 0 max(2.2rem, env(safe-area-inset-right));

}



.logo-container {
	margin-left: 2dvw;
	line-height: 1;
	flex: 0 0 auto;
}

.logo-container span {
	/* font-size: 1.8rem; */
	font-size: clamp(1.7rem, 4vw, 1.8rem);
	font-weight: 700;
	transition: color 0.2s;
}

.logo-container span:first-child {
	color: var(--text-white);
}

.logo-container .finder {
	color: var(--primary-color);
	margin-left: 1px;
}

.logo-container span:first-child:hover {
	color: #ffffff;
	cursor: default
}

.logo-container .finder:hover {
	color: #66b377;
	cursor: default
}

.logo-container .tm {
	font-size: 0.4rem;
	font-weight: lighter;
	opacity: 0.8;
	vertical-align: bottom;
	color: var(--text-white);
}



.input-container {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 1rem;
	width: min(23rem, 100% - 2rem); 
}

.input-container input {
	width: 100%;
	background-color: var(--base-bg-dark);
	color: var(--text-white);
	font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
	font-size: 1rem;
	padding: 0.75rem 2.75rem;
	border-radius: 10px;
	border: none;
	box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
	outline: none;
	box-sizing: border-box;
}

.input-icon {
	color: var(--icon-color);
	position: absolute;
	left: 0.9rem;
	font-size: 1.125rem;
	pointer-events: none;
}

@media (max-width: 480px) {
  .input-container {
    width: 100%;
    padding: 0 0.75rem;
  }

  .input-container input {
    font-size: 0.9rem;
    padding: 0.5rem 2.5rem;
  }

  .input-icon {
    font-size: 1rem;
  }
}

.search-bar::placeholder {
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 0.9rem;
	color: var(--text-white);
	opacity: 0.3;
}


.header-right {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 0.8rem;
}


.icon-btn.moon,
.icon-btn.notifications,
.icon-btn.hamburger
  {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background-color: var(--base-bg-dark);
	border-radius: 9999px;
	width: 37px;
	height: 37px;

}

ion-icon {
	font-size: 20px;
	color: var(--icon-color);

}

.icon-btn {
	border: none;
	cursor: pointer;
	outline: none;
}


.icon-btn.moon ion-icon,
.icon-btn.notifications ion-icon {
	position: absolute;
	transition: opacity 0.25s ease;
}

/* default: outline visible, filled hidden */
.icon-btn.moon .outline,
.icon-btn.notifications .notification-outline {
	opacity: 1;
}

.icon-btn.moon .filled,
.icon-btn.notifications .notification-filled {
	opacity: 0;
}

/* hover: swap */
.icon-btn.moon:hover .outline,
.icon-btn.notifications:hover .notification-outline {
	opacity: 0;
}

.icon-btn.moon:hover .filled,
.icon-btn.notifications:hover .notification-filled {
	opacity: 1;
}


#map {
	height: 70vh;
	outline: none;
}








.leaflet-top.leaflet-right .leaflet-bar.leaflet-control {
	display: flex;
	flex-direction: column;
	border-radius: 10px;
	border: 1px solid var(--map-control-border);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
	background: var(--map-control-bg);
	overflow: hidden;
}

.leaflet-top.leaflet-right .leaflet-bar a {
	width: 38px;
	height: 38px;
	line-height: 38px;
	text-align: center;
	text-decoration: none;
	font-weight: 600;
	cursor: pointer;
	color: var(--map-control-text);
	background: var(--map-control-button-bg);
	border: none;
	border-bottom: 1px solid var(--map-control-button-border);
	transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.leaflet-top.leaflet-right .leaflet-bar a:last-child {
  border-bottom: none !important;
}

.leaflet-top.leaflet-right .leaflet-bar a:hover {
	background: var(--map-control-button-hover-bg);
}


.leaflet-control-reset-view {
	font-size: 23px;
}

.leaflet-control-reset-view {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
}














#map,
.station-bubble {
	width: 100%;

	border-radius: 1rem;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
	box-sizing: border-box;
}


.station-bubble {
	background-color: var(--bubble-bg);
	color: var(--bubble-text);
	margin: 0 auto 1rem;
	padding: 1rem 1.5rem;
	font-size: 0.7rem;
	line-height: 1.6;
}


.station-bubble strong {
	color: inherit;
}

.fuel-grade {
	font-size: 0.8rem;
}

.station-bubble-inner {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.station-row {
	display: flex;
	align-items: flex-start;
}

/* fixed-width icon column */
.station-col-icon {
	width: 1.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

/* text column grows, all text starts at same x-position */
.station-col-text { flex: 1; }

.bubble-icon {font-size: 16px; }

#cheapest-regular .bubble-icon,
#cheapest-regular strong {
	color: var(--fuel-regular-color);
}

#cheapest-midgrade .bubble-icon,
#cheapest-midgrade strong {
	color: var(--fuel-midgrade-color);
}

#cheapest-premium .bubble-icon,
#cheapest-premium strong {
	color: var(--fuel-premium-color);
}

#cheapest-diesel .bubble-icon,
#cheapest-diesel strong {
	color: var(--fuel-diesel-color);
}

.coords-text {
  font-size: 0.63rem;
}




.fuel-buttons-row {
	display: flex;
	width: 100%;
	margin: auto;
	gap: 1px;
	box-sizing: border-box;
	border-radius: 4px;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
	/* background-color: var(--base-bg-light); */
	background-color: var(--fuel-row-bg);


}


.fuel-buttons-row button {
	flex: 1;
	padding: 0.8rem;
	font-size: 0.63rem;
	border: none;
	border-radius: 4px;
	font-family: var(--font-primary);
	font-weight: 500;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;

	background-color: var(--fuel-button-bg);
	color: var(--fuel-text-color);

	min-width: 0;
	white-space: nowrap;

	box-shadow: 0 1px 2px rgba(19, 19, 19, 0.4);
	transition: ease-in-out;
	transition-duration: 250ms;
}


.fuel-buttons-row button:hover {
	background-color: var(--fuel-regular-color);
}

.fuel-buttons-row img {
	filter: var(--fuel-img-filter);
}


/* regular */
#fuel-selector   button[data-fuel="regular_price"]:hover,
#desktop-fuel-selector button[data-fuel="regular_price"]:hover,
#fuel-selector   button[data-fuel="regular_price"].selected,
#desktop-fuel-selector button[data-fuel="regular_price"].selected {
	background: linear-gradient(
		to left,
		var(--fuel-regular-color),
		var(--fuel-gradient-base)
	);
}

/* mid-grade */
#fuel-selector   button[data-fuel="mid_grade_price"]:hover,
#desktop-fuel-selector button[data-fuel="mid_grade_price"]:hover,
#fuel-selector   button[data-fuel="mid_grade_price"].selected,
#desktop-fuel-selector button[data-fuel="mid_grade_price"].selected {
	background: linear-gradient(
		to left,
		var(--fuel-midgrade-color),
		var(--fuel-gradient-base)
	);
}

/* premium */
#fuel-selector   button[data-fuel="premium_price"]:hover,
#desktop-fuel-selector button[data-fuel="premium_price"]:hover,
#fuel-selector   button[data-fuel="premium_price"].selected,
#desktop-fuel-selector button[data-fuel="premium_price"].selected {
	background: linear-gradient(
		to left,
		var(--fuel-premium-color),
		var(--fuel-gradient-base)
	);
}

/* diesel */
#fuel-selector   button[data-fuel="diesel_price"]:hover,
#desktop-fuel-selector button[data-fuel="diesel_price"]:hover,
#fuel-selector   button[data-fuel="diesel_price"].selected,
#desktop-fuel-selector button[data-fuel="diesel_price"].selected {
	background: linear-gradient(
		to left,
		var(--fuel-diesel-color),
		var(--fuel-gradient-base)
	);
}



/* Map + Bubble Wrapper */
.map-bubble-wrapper {
	margin: 2rem 1rem;

	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.map-bubble-wrapper h1 {
	font-family: var(--font-primary);
	color: var(--title-color);
	/* font-size: 1.8rem; */
	font-size: clamp(1.2rem, 5vw, 1.8rem);
	margin: 0;
	text-align: center;
}


.map-bubble-wrapper h4 {
	font-family: var(--font-primary);
	color: var(--subtitle-color);
	font-weight: 500;
	/* font-size: 0.9rem; */
	font-size: clamp(0.75rem, 3vw, 0.9rem);
	margin: 0;
	text-align: center;

}


/* Map container for desktop layout */
.map-container {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	width: 100%;
}


/* Bubble Section */
.bubble-section {
	display: flex;
	flex-direction: column;
}

.bubble-section h3 {
	color: var(--bubble-section-title-color);
	font-size: clamp(1rem, 4vw, 1.3rem);

	text-align: center;
}


.last-updated {
	color: var(--last-updated-color);
	text-align: center;
	margin-top: 1rem;
	font-size: 0.55rem;
}


.price-label {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	background: #ffffff;
	color: #000000;
	padding: 1px 3px;
	border-radius: 4px;
	font-size: 10px;
	width: fit-content;
	margin: 0 auto;
}

/* Mobile/Desktop visibility classes */
.desktop-only {
	display: none;
}

.mobile-only {
	display: flex;
}


@media screen and (max-width: 600px) {
	.input-container {
		display: none;
	}
}




.input-container-mobile input {
	width: 100%;
	background-color: var(--text-white);
	/* color: var(--text-white); */
	font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
	font-size: 0.9rem;
	padding: 0.6rem 2.75rem;
	border-radius: 9999px;
	border: none;
	box-shadow: 0px 0px 12px 1px rgba(0,0,0,0.63);
	outline: none;
	box-sizing: border-box;
}

.input-container-mobile {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 1rem;

}

/* > 600px: hide */
@media (min-width: 601px) {
	.input-container-mobile {
		display: none;
	}
}


.search-bar-mobile {
  width: 100%;
  padding: 0.6rem 2.3rem; /* space for icons left/right */
  text-align: center;
  box-sizing: border-box;
  color: black;
	caret-color: #000;       
}

/* left icon */
.icon-location {
	position: absolute;
	left: 0.7rem;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	font-size: 25px;
	color: var(--subtitle-color);
}



.icon-search {
	position: absolute;
	right: 0.35rem;
	top: 50%;
	transform: translateY(-50%);
	background-color: #66b377;
	border-radius: 9999px;
	padding: 0.30rem;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 0 5px rgba(102, 179, 119, 0.9);
	transition: box-shadow 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.icon-search:hover {
	box-shadow: 0 0 10px rgba(102, 179, 119, 1);
	transform: translateY(-50%) scale(1.03);
}


.icon-search:active {
	box-shadow: 0 0 6px rgba(102, 179, 119, 0.7);
	transform: translateY(-50%) scale(0.97);
}


.icon-search-btn {
	/* reset default button look */
	background: none;
	border: none;
	padding: 0;
	margin: 0;

	/* make it behave like the original icon */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;

	z-index: 9999;
}








/* Tablets (481px to 767px) */
@media (min-width: 481px) and (max-width: 767px) {
	.map-bubble-wrapper {
		margin: 1.5rem 1rem;
	}
  
}

/* Responsive Layout for Desktop */
@media (min-width: 768px) {
	.map-bubble-wrapper {
		flex-direction: row;
		justify-content: space-between;
		align-items: flex-start;
		margin: 2rem 3rem 3rem 3rem;

	}

	.map-container {
		flex: 2;
		max-width: 58%;
	}


	#map {
		width: 100%;
		max-width: 100%;
	}


	.right-column {
		flex: 1;
		max-width: 40%;
	}

	.bubble-section {
		background-color: var(--bubble-section-bg);
		overflow-y: auto;
		margin-top: 0px;
		gap: 0.2rem;
		border-radius: 17px;
		padding: 5px 25px 30px;
		box-shadow: 0 4px 12px rgba(0,0,0,0.35);
	}
	

	.bubble-section h3 {
		text-align: left;
	}

	.map-bubble-wrapper h1 {
		text-align: left;
	}

	.map-bubble-wrapper h4 {
		text-align: left;
	}

	/* Show desktop buttons, hide mobile buttons */
	.desktop-only { display: flex; }
	.mobile-only { display: none; }

	.fuel-buttons-row button {
		flex: 1;
		padding: 0.8rem 0.8rem;
		font-size: 0.9rem;
		font-family: var(--font-primary);
		border: none;
		gap: 8px;
	}

	#desktop-fuel-selector { order: 1; }
	#map { order: 2; }

	
}

#fuel-selector {
	margin-top: 0;
	order: 2;
}

#desktop-fuel-selector {
  order: 1; /* hidden on mobile */
}


#theme-transition {
	position: fixed;
	inset: 0;
	background: var(--body-bg-dark);
	opacity: 0;
	pointer-events: none;
	z-index: 99999;
	transition: opacity 0.4s ease-in-out;
}

/* visible state */
#theme-transition.active {
	opacity: 1;
}
