@import url("https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap");
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  list-style: none;
  font-family: "Rubik", sans-serif;
}
:root {
  --font-color-main: #332464;
  --white-color: #fff;
}
body {
  background-color: #B4D6F3;
}

#screen {
  background-color: #E0EEFA;
  width: 100%;
  height: 100vh;
  position: relative; 
}
nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 70px;
  background-color: var(--font-color-main);
  z-index: 100;
}
nav ul {
  display: flex;
  gap: 2pc;
}
nav ul li a {
  color: var(--white-color);
  font-size: 18px;
}
.active {
  background-color: var(--white-color);
  color: var(--font-color-main);
  border-radius: 100px;
  padding: 8px 15px;
}
/*  */
h3 {
  color: var(--font-color-main);
  text-align: center;
  padding: 30px 0;
}
.search {
  width: 340px;
  height: 50px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 1px 2px 2px var(--font-color-main);
  background-color: var(--white-color);
}
.search-icon {
  width: 18px;
  height: 50px;
  display: flex;
  border-radius: 20px;
  justify-content: center;
  align-items: center;
}
.search-icon i {
  font-size: 18px;
  color: var(--font-color-main);
}
.search input {
  width: 85%;
  padding: 10px;
  font-size: 15px;
  color: var(--font-color-main);
  border: none;
  outline: none;
}
.search input::placeholder {
  color: var(--font-color-main);
}
/*  */
.error-message {
  display: none;
}
.error-message p {
  width: 100%;
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--font-color-main);
  text-align: center;
  padding: 40px;
}
/*  */
.message {
  display: block;
}
.message p {
  width: 100%;
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--font-color-main);
  text-align: center;
  padding: 50px;
}
/*  */
.return {
  display: none;
}
.box {
  max-width: 400px;
  height: auto;
  display: grid;
  place-content: center;
  margin: 50px auto;
}
.weather-box {
  height: 200px;
  max-width: 350px;
  border-radius: 40px;
  margin-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--font-color-main);
}
.name {
  padding-left: 40px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--white-color);
  height: auto;
}
.city-name {
  font-size: 20px;
}
.weather-temp {
  font-size: 60px;
}
.weather-icon {
  padding: 0 20px;
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.weather-icon img {
  width: 100%;
}
/*  */
.weather-desc {
  display: flex;
  justify-content: center;
  column-gap: 10px;
}
.desc-box {
  width: 100px;
  display: grid;
  padding: 15px;
  gap: 5px;
  height: 110px;
  margin-top: 10px;
  border-radius: 20px;
  justify-content: start;
  align-items: center;
  color: var(--white-color);
  background-color: var(--font-color-main);
}

/* City suggestion dropdown */
.suggestions {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  background: var(--white-color);
  border-radius: 0 0 20px 20px;
  box-shadow: 0 2px 8px rgba(51,36,100,0.1);
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}
.suggestions.active {
  display: block;
}
.suggestions li {
  padding: 10px 20px;
  cursor: pointer;
  color: var(--font-color-main);
}
.suggestions li:hover {
  background: #f0f0f0;
}

/* Chart container */
.chart-container {
  width: 90%;
  max-width: 500px;
  margin: 30px auto 0 auto;
  background: var(--white-color);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(51,36,100,0.1);
  padding: 20px;
}

/* Fun fact box */
.fun-fact {
  margin: 20px auto;
  padding: 15px 20px;
  background: #f9f6ff;
  border-left: 5px solid var(--font-color-main);
  border-radius: 10px;
  color: var(--font-color-main);
  max-width: 400px;
  font-size: 16px;
}

/* Dark mode styles */
body.dark-mode {
  background-color: #232136;
}
body.dark-mode #screen {
  background-color: #2d2a45;
}
body.dark-mode .search,
body.dark-mode .chart-container,
body.dark-mode .fun-fact {
  background: #332464;
  color: #fff;
}
body.dark-mode .suggestions {
  background: #332464;
  color: #fff;
}
body.dark-mode .suggestions li:hover {
  background: #232136;
}
body.dark-mode nav {
  background-color: #232136;
}
body.dark-mode .desc-box,
body.dark-mode .weather-box {
  background-color: #232136;
  color: #fff;
}
body.dark-mode .active {
  background-color: #fff;
  color: #232136;
}

/* Theme toggle button */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 30px;
  background: var(--font-color-main);
  color: var(--white-color);
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 16px;
  z-index: 200;
}
body.dark-mode .theme-toggle {
  background: #fff;
  color: var(--font-color-main);
}

@media screen and (min-width: 430px) {
  #screen {
    max-width: 50%;
    min-width: 450px;
    height: 100%;
    margin: 50px auto;
    border-radius: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.494);
    margin-bottom: 120px; /* Add space for fixed nav */
  }
  nav {
    border-radius: 20px;
    border-radius: 0 0 20px 20px;
    width: 100%;
    bottom: 0;
    position: relative;
  }
  .box{
    max-width: 500px;
  }
  .weather-box {
    max-width: 400px;
    height: 200px;
  }
  .desc-box{
    width: 120px;
    height: 120px;
  } 
}