/* Reset */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Merriweather Sans", sans-serif;
}

/* Theme Variables */
:root {
  /* Default Theme (Clear Sky) */
  --colorDark1: #1a1b4b;
  --colorDark2: #4a4e8c;
  --colorLight1: #e0e1ff;
  --colorLight2: #f8f9ff;
  --accentColor: #6c63ff;
  --gradientStart: #1a1b4b;
  --gradientEnd: #4a4e8c;
}

/* Rainy Theme */
.wrapper.rainy {
  --gradientStart: #2c3e50;
  --gradientEnd: #34495e;
  --accentColor: #3498db;
  --colorLight1: #bdc3c7;
  --colorLight2: #ecf0f1;
}

/* Sunny Theme */
.wrapper.sunny {
  --gradientStart: #f39c12;
  --gradientEnd: #f1c40f;
  --accentColor: #e67e22;
  --colorLight1: #fef9e7;
  --colorLight2: #fffde7;
}

/* Cloudy Theme */
/* Cloudy Theme (lightened) */
/* ===== Darker Cloudy Theme ===== */
/* ===== Extra‐Dark Cloudy Theme ===== */
.wrapper.cloudy {
  /* Very dark gray → slightly lighter dark gray */
  --gradientStart: #24262a;   /* almost charcoal */
  --gradientEnd:   #35383f;   /* deep slate */
  --accentColor:   #5c5f65;   /* medium‐dark gray accent */
  --colorLight1:   #d1d2d5;   /* light gray for subtle elements */
  --colorLight2:   #eceeef;   /* bright—almost white—for text/icons */
}

.wrapper.cloudy::before {
  content: "";
  position: absolute;
  top: 0;
  overflow-y:hidden;
  left: 0;
  right: 0;
  bottom: 0;
  /* Very subtle dark tint to deepen the overcast feel */
  background: linear-gradient(
    rgba(30, 32, 35, 0.3),
    rgba(30, 32, 35, 0.3)
  );
  pointer-events: none;
}

/* If you want the rain overlay to sit above this darker cloudy
   background, make sure your .rain-container/z-index remains higher. */
.rain-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1; /* stays above wrapper but behind any UI text */
}



/* Night Theme */
.wrapper.night {
  --gradientStart: #1a1a2e;
  --gradientEnd: #16213e;
  --accentColor: #4a4e8c;
  --colorLight1: #e0e1ff;
  --colorLight2: #f8f9ff;
}

/* Wrapper Base */
.wrapper {
  position: relative; /* for rain overlays */
  height: 100vh;
  width: 100vw;
  overflow-y:hidden;
  color: var(--colorLight2);
  background-color: var(--gradientStart);
  background-image: linear-gradient(
    160deg,
    var(--gradientStart) 0%,
    var(--gradientEnd) 100%
  );
  transition: all 0.5s ease-in-out;
}

/* Weather‐specific overlays (subtle tints) */
.wrapper.rainy::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    rgba(44, 62, 80, 0.3),
    rgba(52, 73, 94, 0.3)
  );
  pointer-events: none;
}

.wrapper.sunny::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.2), transparent 70%);
  pointer-events: none;
}

.wrapper.cloudy::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(rgba(127, 140, 141, 0.2), rgba(149, 165, 166, 0.2));
  pointer-events: none;
}

.wrapper.night::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 50%, rgba(26, 26, 46, 0.3), transparent 70%);
  pointer-events: none;
}

/* ===== Rain Animation Styles ===== */
.rain-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.raindrop {
  position: absolute;
  top: -10px;
  width: 2px;
  height: 15px;
  background: rgba(255, 255, 255, 0.6);
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes fall {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* ===== Heading & Tabs ===== */
h1 {
  text-align: center;
  text-transform: uppercase;
  word-spacing: 2px;
  letter-spacing: 1.75px;
  margin-block: 2rem;
}

.tabContainer {
  width: 90%;
  max-width: 550px;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  margin-top: 1rem;
}

.tab {
  cursor: pointer;
  font-size: 0.875rem;
  letter-spacing: 1.75px;
  padding: 5px 8px;
  text-transform: capitalize;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.tab::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(224, 225, 255, 0.15);
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease-in-out;
  border-radius: 4px;
}

.tab:hover::after {
  transform: scaleX(1);
}

.tab.currentTab {
  background-color: rgba(224, 225, 255, 0.15);
  border-radius: 4px;
}

/* ===== Main Container ===== */
.container {
  margin-block: 4rem;
}

.btn {
  all: unset;
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 10px 30px;
  border-radius: 5px;
  cursor: pointer;
  background-color: var(--accentColor);
  color: var(--colorLight2);
  transition: all 0.3s ease;
}

.btn:hover {
  background-color: #5a52e0;
  transform: translateY(-2px);
}

.subContainer {
  width: 90%;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Form Container ===== */
.formContainer {
  width: 90%;
  max-width: 500px;
  margin: 0 auto;
  margin-top: 1rem;
  margin-bottom: 2rem;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0 10px;
}

.formContainer.active {
  display: flex;
}

.formContainer input {
  all: unset;
  width: calc(100% - 80px);
  height: 40px;
  padding: 0 20px;
  background-color: rgba(224, 225, 255, 0.15);
  border-radius: 10px;
  color: var(--colorLight2);
}

.formContainer input:focus {
  outline: 3px solid var(--accentColor);
}

.formContainer input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.formContainer .btn {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: unset;
  border-radius: 100%;
}

.formContainer .btn img {
  object-fit: contain;
}

/* ===== Grant Location ===== */
.grantLocationContainer {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.grantLocationContainer.active {
  display: flex;
}

.grantLocationContainer img {
  margin-bottom: 1.5rem;
}

.grantLocationContainer p:first-of-type {
  font-weight: 600;
  font-size: 1.75rem;
  text-align: center;
}

.grantLocationContainer p:last-of-type {
  font-size: 0.75rem;
  text-align: center;
  margin-top: 0.75rem;
  margin-bottom: 1.75rem;
  font-weight: 300;
  letter-spacing: 0.75px;
}

/* ===== Loading ===== */
.loadingContainer {
  display: none;
  flex-direction: column;
  align-items: center;
}

.loadingContainer.active {
  display: flex;
}

.loadingContainer p {
  text-transform: uppercase;
}

/* ===== User Info ===== */
.userInfoContainer {
  display: none;
  flex-direction: column;
  align-items: center;
}

.userInfoContainer.active {
  display: flex;
}

.userInfoContainer p {
  font-size: 1.5rem;
  font-weight: 200;
}

.userInfoContainer img {
  height: 70px;
  width: 70px;
}

.name {
  display: flex;
  align-items: center;
  gap: 0 0.5rem;
  margin-bottom: 0.7rem;
}

.name img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.userInfoContainer p[data-temp] {
  font-size: 2.25rem;
  font-weight: 700;
}

.userInfoContainer p[data-weatherDesc] {
  text-transform: capitalize;
  font-size: 1.2rem;
}

/* ===== Parameter Boxes ===== */
.parameterContainer {
  width: 90%;
  display: flex;
  justify-content: center;
  gap: 10px 20px;
  margin: 1.6rem auto 0;
  flex-wrap: wrap;
}

.parameter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: column;
  background-color: rgba(224, 225, 255, 0.15);
  padding: 0.8rem;
  border-radius: 5px;
  width: 30%;
  max-width: 200px;
  gap: 5px 0;
  transition: transform 0.3s ease;
}

.parameter:hover {
  transform: translateY(-5px);
  background-color: rgba(224, 225, 255, 0.2);
}

.parameter p {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
}

.parameter img {
  width: 50px;
  height: 50px;
  object-fit: cover;
}

.parameterValue {
  font-size: 0.8rem;
  font-weight: 200;
}

/* ===== Error Container ===== */
.errorContainer {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem 0;
}

.errorContainer.active {
  display: flex;
}

.errorContainer p {
  text-align: center;
}

.errorContainer img {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* ===== Media Queries ===== */
@media screen and (max-width: 768px) {
  .wrapper {
    height: auto;
    min-height: 100vh;
  }

  h1 {
    font-size: 1.5rem;
    margin-block: 1.5rem;
  }

  .tabContainer {
    width: 95%;
    margin-top: 0.5rem;
  }

  .tab {
    font-size: 0.75rem;
    padding: 4px 6px;
  }

  .formContainer {
    width: 95%;
    margin-top: 0.5rem;
  }

  .formContainer input {
    height: 35px;
    font-size: 0.9rem;
  }

  .formContainer .btn {
    width: 35px;
    height: 35px;
  }

  .parameterContainer {
    width: 95%;
    gap: 8px 12px;
  }

  .parameter {
    width: 45%;
    padding: 0.6rem;
  }

  .parameter img {
    width: 40px;
    height: 40px;
  }

  .parameter p {
    font-size: 0.9rem;
  }

  .parameterValue {
    font-size: 0.75rem;
  }

  .userInfoContainer p {
    font-size: 1.2rem;
  }

  .userInfoContainer p[data-temp] {
    font-size: 1.8rem;
  }

  .userInfoContainer p[data-weatherDesc] {
    font-size: 1rem;
  }

  .name {
    gap: 0 0.3rem;
  }

  .name img {
    width: 25px;
    height: 25px;
  }

  .grantLocationContainer p:first-of-type {
    font-size: 1.4rem;
  }

  .grantLocationContainer p:last-of-type {
    font-size: 0.7rem;
  }

  .errorContainer img {
    max-width: 250px;
  }
}

@media screen and (max-width: 380px) {
  .parameter {
    width: 100%;
  }

  .tab {
    font-size: 0.7rem;
    padding: 3px 5px;
  }

  .formContainer input {
    font-size: 0.8rem;
  }
}
