:root {
  /* responsive variables */
  --content-max-width: 920px;
  --page-gap: 24px;
  --widget-max-width: 560px;
  --mini-gap: 12px;
  --footer-height: 56px; /* Added footer height variable */
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: var(--page-gap);
  background: #000000;
  min-height: 100vh;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    "Roboto Mono", "Courier New", monospace;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 400ms ease;
  padding-top: 30px;
}

body.bg-clear {
  background: linear-gradient(135deg, #1a1200 0%, #000000 100%);
}

body.bg-clouds {
  background: linear-gradient(135deg, #0a1216 0%, #000000 100%);
}

body.bg-rain {
  background: linear-gradient(135deg, #001a2e 0%, #000000 100%);
}

body.bg-snow {
  background: linear-gradient(135deg, #0d1517 0%, #000000 100%);
}

body.bg-thunderstorm {
  background: linear-gradient(135deg, #0d071a 0%, #000000 100%);
}

body.bg-mist {
  background: linear-gradient(135deg, #0a1514 0%, #000000 100%);
}

body {
  position: relative; /* create stacking context for pseudo-element */
  padding-bottom: calc(
    var(--footer-height) + 14px
  ); /* avoid content under fixed footer */
}

/* Ensure the page content sits above the pseudo-element */
body > * {
  position: relative;
  z-index: 1;
}

/* Constrain and center top-level content except the footer */
body > *:not(.site-footer) {
  width: 100%;
  max-width: var(--content-max-width);
  box-sizing: border-box;
}

body::before {
  content: "";
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  z-index: 0;
}

/* Remove the radial gradient backgrounds */
body.bg-clear::before,
body.bg-clouds::before,
body.bg-rain::before,
body.bg-snow::before,
body.bg-thunderstorm::before,
body.bg-mist::before {
  display: none;
}

#title {
  color: white;
  font-size: 42px;
  font-weight: 800;
  margin-top: 8px;
  margin-bottom: 8px;
  line-height: 1.05;
  text-align: center;
  letter-spacing: -0.5px;
}

#localTime {
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  margin: 0 0 24px 0;
  display: flex;
  gap: 6px;
  align-items: baseline;
  justify-content: center;
  font-weight: 500;
}

#localTime .tz {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  margin-left: 6px;
  font-weight: 400;
}

.input-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 8px;
  width: 100%;
  max-width: 580px;
  margin-left: auto;
  margin-right: auto;
}

#citySelector {
  font-family: inherit;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  color: white;
  font-size: 15px;
  font-weight: 500;
  height: 48px;
  padding: 0 24px;
  padding-right: 56px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  outline: none;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  flex: 1;
  max-width: 580px;
}

#citySelector::placeholder {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 400;
}

#citySelector:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#citySelector:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25), 0 3px 6px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 0 4px rgba(255, 255, 255, 0.08);
}

button {
  background: rgba(15, 15, 15, 0.9);
  height: 28px;
  width: 28px;
  border-radius: 50%;
  color: rgb(255, 255, 255);
  border: 2px solid rgba(255, 255, 255, 0.1);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button:hover {
  background: rgba(20, 20, 20, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Style the search button next to the input to look modern and glassy */
#searchBtn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  cursor: pointer;
  position: relative;
  margin-left: -52px;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#searchBtn svg {
  color: white;
  width: 18px;
  height: 18px;
}

#searchBtn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#searchBtn:active {
  transform: scale(0.95);
}

#searchBtn:focus {
  outline: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.weather-widget {
  margin-top: 20px;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 560px;
  width: min(100%, 560px);
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
  min-width: 220px;
  padding: 0;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.weather-widget::before {
  display: none;
}

.weather-widget:hover::before {
  display: none;
}

.weather-widget .icon {
  width: 140px;
  height: 140px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.weather-widget .icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.weather-widget .icon img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  display: block;
  z-index: 1;
  pointer-events: none;
}

.icon-emoji {
  font-size: 96px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.weather-widget .details {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1 1 auto;
  text-align: center;
  align-items: center;
  position: relative;
  z-index: 1;
}

.weather-widget .main-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
  position: relative;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.weather-widget .city-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 1;
  margin-bottom: 4px;
  color: white;
}

.weather-widget .extra-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  margin-top: 8px;
}

.weather-widget .extra-item {
  background: rgba(15, 15, 15, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 200ms ease;
}

.weather-widget .extra-item:hover {
  background: rgba(20, 20, 20, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.weather-widget .extra-label {
  font-size: 10px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: white;
}

.weather-widget .extra-value {
  font-size: 16px;
  font-weight: 800;
  opacity: 1;
  color: white;
}

/* Mini widgets area */
.mini-widgets {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--mini-gap);
  max-width: var(--widget-max-width);
  width: min(100%, var(--widget-max-width));
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
  padding-bottom: calc(var(--footer-height) + 14px);
  position: relative;
  opacity: 1;
  visibility: visible;
}

.mini-widget {
  width: 100%;
  background: rgba(15, 15, 15, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.1);
  padding: clamp(12px, 2.2vw, 16px) clamp(14px, 2.5vw, 18px);
  border-radius: 28px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-sizing: border-box;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  user-select: none;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-widget:hover {
  background: rgba(20, 20, 20, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px);
}

.mini-widget .icon {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(25, 25, 25, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.mini-widget.enter {
  animation: miniEnter 280ms ease forwards;
}
.mini-widget.exit {
  animation: miniExit 220ms ease forwards;
}
.mini-widget .icon .icon-emoji {
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Footer */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px) saturate(110%);
  -webkit-backdrop-filter: blur(8px) saturate(110%);
  color: rgba(230, 238, 248, 0.85);
  font-size: 13px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    "Roboto Mono", "Courier New", monospace;
  text-align: center;
  padding: 0 12px;
}
.site-footer p {
  margin: 0;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer a {
  background: rgba(15, 15, 15, 0.9);
  color: white;
  text-decoration: none;
  border-radius: 28px;
  font-weight: 700;
  padding: 8px 18px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.site-footer a:hover,
.site-footer a:focus {
  background: rgba(25, 25, 25, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Animations for mini widgets */
@keyframes miniEnter {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes miniExit {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateY(6px) scale(0.98);
    opacity: 0;
  }
}
.mini-widget .icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
}
.mini-widget .info .t {
  font-size: 16px;
  text-transform: none;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 700;
}

.mini-time {
  margin-top: 6px;
  color: rgba(230, 238, 248, 0.75);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono",
    "Courier New", monospace;
}

/* Ensure mini widget city names are white and left-aligned */
.mini-widget .info .city {
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  text-transform: none;
}

/* Gradient variants for mini widgets */
.mini-widget.clear {
  background: rgba(15, 15, 15, 0.7);
  border-color: rgba(255, 193, 7, 0.35);
}
.mini-widget.clouds {
  background: rgba(15, 15, 15, 0.7);
  border-color: rgba(96, 125, 139, 0.4);
}
.mini-widget.rain {
  background: rgba(15, 15, 15, 0.7);
  border-color: rgba(33, 150, 243, 0.35);
}
.mini-widget.snow {
  background: rgba(15, 15, 15, 0.7);
  border-color: rgba(224, 247, 250, 0.35);
}
.mini-widget.thunderstorm {
  background: rgba(15, 15, 15, 0.7);
  border-color: rgba(94, 53, 177, 0.35);
}
.mini-widget.mist {
  background: rgba(15, 15, 15, 0.7);
  border-color: rgba(69, 90, 100, 0.45);
}

.mini-remove {
  margin-left: auto;
  background: rgba(20, 20, 20, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms ease;
  flex-shrink: 0;
}
.mini-remove:hover {
  background: rgba(30, 30, 30, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
  color: white;
  transform: scale(1.1);
}

/* pin/check button inside main widget */
.pin-btn {
  position: static;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0 24px;
  height: 48px;
  border-radius: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  margin-top: 8px;
  min-width: 110px;
}

.pin-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.5px;
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.pin-btn-text {
  font-family: inherit;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.pin-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.pin-btn:hover svg {
  transform: scale(1.1);
}

.pin-btn:active {
  transform: scale(0.95);
}

.pin-btn.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}
.pin-btn.active:hover {
  background: rgba(40, 40, 40, 0.98);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.weather-widget .temp {
  font-size: clamp(72px, 12vw, 96px);
  font-weight: 900;
  letter-spacing: -5px;
  line-height: 0.9;
  margin: 0;
  color: white;
  opacity: 1;
}

/* Ensure the mini widget temperature/summary stands out distinctly */
.mini-widget .info .t {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}

.weather-widget .cond {
  font-size: 20px;
  opacity: 1;
  text-transform: capitalize;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  color: white;
}

/* Subtle hover pop for widget */
.weather-widget:hover {
  transform: none;
}

/* Add transitions and a subtle hover/focus effect to mini widgets */
.mini-widget {
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-widget:hover,
.mini-widget:focus-within {
  border-color: rgba(255, 255, 255, 0.25);
}

/* Make the emoji pop on hover/focus for both main and mini widgets */
.mini-widget .icon .icon-emoji,
.weather-widget .icon .icon-emoji {
  transition: none;
}

/* Make mini widget emoji grow slightly on hover/focus (main emoji remains static) */
/* Removed separate emoji scaling: entire mini widget now scales on hover instead */

/* Keyboard focus visible state for accessibility */
.mini-widget:focus-within,
.mini-widget:focus {
  outline: 2px solid rgba(8, 110, 254, 0.12);
  outline-offset: 4px;
}

/* Weather colors removed from main widget - no background */

/* Responsive tweak: reduce icon and temp on narrow screens */
@media (max-width: 420px) {
  .weather-widget {
    padding: 20px;
    gap: 16px;
    max-width: 100%;
  }
  .weather-widget .icon {
    width: 90px;
    height: 90px;
  }
  .icon-emoji {
    font-size: 46px;
  }
  .weather-widget .temp {
    font-size: 44px;
  }
  .weather-widget .extra-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .pin-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}
/* Slightly larger mobile threshold: stack mini widgets */
@media (max-width: 520px) {
  .mini-widgets {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  /* reduce left/right margins for very small screens */
  body {
    margin-left: 12px;
    margin-right: 12px;
    align-items: stretch; /* let content fill horizontally on mobile */
    justify-content: flex-start; /* keep content near the top on small screens */
  }
}
