* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --Gray-900: #212121;
  --Gray-900-60f: #21212199;
  --Gray-900-32f: #21212152;
  --Gray-100: #f5f5f5;
  --Gray-100-60f: #f5f5f599;
  --White-32f: #ffffff52;
  --White-24f: #ffffff3d;
  --White-8f: #ffffff14;
  --Blue: #20233e;
  --Indigo-400: #5c6bc0;
  --Indigo-50: #e8eaf6;
}

body {
  font-family: 'Nunito', sans-serif;
  height: 100vh;
  overflow: hidden;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.hidden {
  display: none;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}
header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: bold;
}
header .search {
  position: relative;
  width: 70%;
}
header .search input[type='text'] {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background-color: var(--Indigo-50);
  color: var(--Gray-900-60f);
  font-size: 16px;
  font-weight: 400;
}
header .search input[type='text']:focus {
  outline: solid 2px var(--Indigo-400);
}
header .search .recent,
header .search .suggestion-list {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background-color: var(--Indigo-50);
  border-radius: 8px 8px 0 0;
  padding: 8px;
  box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.1);
}
.search .recent .recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.search .recent .recent-list,
header .search .suggestion-list {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--Indigo-400) var(--White-8f);
}
.suggestion-list .suggestion-item {
  font-size: 16px;
  font-weight: 400;
  color: var(--Gray-900);
  letter-spacing: 0.15px;
  padding: 8px;
  cursor: pointer;
}
.suggestion-list .suggestion-item:hover {
  text-decoration: underline;
}
.search .recent .recent-label {
  color: var(--Gray-900);
  font-size: 21px;
  letter-spacing: 0.25px;
  font-weight: 600;
}
.search .recent .clear-btn {
  border: none;
  background: none;
  color: var(--Indigo-400);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.25px;
  transition: opacity 0.3s;
}
.search .recent .clear-btn:hover {
  opacity: 0.7;
}
.search .recent .recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  margin-bottom: 4px;
}
.recent .recent-item .recent-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.recent-temp {
  width: 50px;
}
.recent-city-name {
  color: var(--Gray-900);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.25px;
}
.recent-country-name {
  color: var(--Gray-900-60f);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.15px;
}
.recent .recent-item .delete-btn {
  border: none;
  background: none;
  color: var(--Indigo-400);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.25px;
  transition: opacity 0.3s;
}
.recent .recent-item .delete-btn:hover {
  opacity: 0.7;
}
.no-recent p {
  color: var(--Gray-900-60f);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.15px;
}

.toggle {
  position: relative;
  display: flex;
  width: 70px;
  height: 35px;
  background: #fcebeb;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.3s;
  user-select: none;
}
.toggle-input {
  display: none;
}
.unit {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  color: #ffffff;
  z-index: 1;
  transition: color 0.3s;
}
.slider {
  position: absolute;
  width: 50%;
  height: 100%;
  background: #f44336;
  border-radius: 50%;
  top: 0;
  left: 0;
  transition: 0.3s;
}
.toggle-input:checked + .toggle {
  background: #ebf7fc;
}
.toggle-input:checked + .toggle .slider {
  background: #03a9f4;
  transform: translateX(100%);
}
.toggle-input:checked + .toggle .unit:first-child {
  color: #03a9f4;
}
.toggle-input:not(:checked) + .toggle .unit:nth-child(2) {
  color: #ff0000;
}

main {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}
main section {
  width: 65%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
}
main section article {
  width: 100%;
}

main aside {
  width: 35%;
}

.today-weather-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.today-weather-info .weather-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.today-weather-info .weather-info #date {
  color: var(--Gray-900-60f);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.15px;
}
.today-weather-info .weather-info #city {
  color: var(--Gray-900);
  font-weight: 600;
  font-size: 40px;
  letter-spacing: 0.25px;
}
.today-weather-info .weather-info #country {
  color: var(--Gray-900-60f);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.15px;
}
.today-weather-info .weather-info #temperature {
  color: var(--Gray-900);
  font-weight: 600;
  font-size: 64px;
  letter-spacing: 0.25px;
}
.today-weather-info img {
  width: 150px;
  height: 150px;
}

.weather-forecast,
.weather-details,
aside {
  background-color: var(--Indigo-50);
  border-radius: 16px;
  padding: 16px;
}

aside {
  padding: 16px 0;
}

.days7-forecast-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.days7-forecast-container .day {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px;
  background-color: var(--White-32f);
}

.days7-forecast-container .day .right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  width: 25%;
  margin-right: 5px;
}

.days7-forecast-container .day .right p:nth-child(1) {
  color: var(--Gray-900-60f);
  font-size: 16px;
  letter-spacing: 0.15px;
}
.days7-forecast-container .day .right p:nth-child(2) {
  color: var(--Gray-900);
  font-weight: 600;
  letter-spacing: 0.15px;
}

.days7-forecast-container .day .mid {
  display: flex;
  justify-content: start;
  align-items: center;
  gap: 8px;
  width: 49%;
}
.days7-forecast-container .day .mid img {
  width: 40px;
  height: 40px;
}
.days7-forecast-container .day .mid p {
  color: var(--Gray-900-60f);
  font-size: 16px;
  letter-spacing: 0.15px;
  word-break: keep-all;
}
.days7-forecast-container .day .left {
  width: 25%;
}
.days7-forecast-container .day .left p {
  color: var(--Gray-900-60f);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.15px;
}

.weather-forecast h2,
.weather-details h2,
aside h2 {
  color: var(--Gray-900-60f);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 16px;
  margin-bottom: 20px;
}

aside h2 {
  padding: 12px 0px 0px 12px;
}

.weather-forecast {
  padding-right: 0px;
}

.today-forecast-container {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 16px 0;
  padding-left: 20px;
}

.today-forecast-container::-webkit-scrollbar {
  display: none;
}

.today-forecast-container .forecast-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border-radius: 16px;
  background-color: var(--White-32f);
}

.forecast-item:last-child {
  margin-right: 20px;
}

.today-forecast-container .forecast-item p:nth-child(1) {
  color: var(--Gray-900-60f);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.15px;
  width: 75px;
  text-align: center;
}
.today-forecast-container .forecast-item img {
  width: 40px;
  height: 40px;
}
.today-forecast-container .forecast-item p:nth-child(2) {
  color: var(--Gray-900);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.25px;
}

.details-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.details-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  background-color: var(--White-32f);
}

.details-item h3 {
  color: var(--Gray-900-60f);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.15px;
}

@media (max-width: 1024px) {
  body {
    overflow: auto;
    height: auto;
  }

  .container {
    width: 100%;
    padding: 16px;
    padding-bottom: 60px;
  }

  header {
    flex-wrap: wrap;
    gap: 15px;
    padding: 8px 0;
  }
  header .logo {
    order: 1;
    flex: 1;
  }
  header .toggle-container {
    order: 2;
  }
  header .search {
    order: 3;
    width: 100%;
  }
  .toggle {
    width: 60px;
    height: 30px;
  }
  .unit {
    font-size: 12px;
  }

  main {
    flex-direction: column-reverse;
    align-items: center;
    padding: 0;
  }
  main section {
    width: 100%;
    padding: 0;
  }
  main aside {
    width: 100%;
  }
  .today-weather-info {
    margin-top: 16px;
    flex-wrap: wrap;
  }
  .details-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .welcome-message {
    padding: 16px 0;
  }
}
@media (max-width: 480px) {
  .today-weather-info {
    justify-content: center;
  }
}

.error-message {
  margin-top: 40px;
}
.error-message h2 {
  color: #f44336;
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.25px;
}
.error-message p {
  color: var(--Gray-900-60f);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.15px;
}

/* Loading Screen */
.loading-message {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  z-index: 1000;
}

.loading-message .loading-container {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.loading-message .loading-spinner {
  position: relative;
  margin: 0 auto 2rem;
  width: 80px;
  height: 80px;
}

.loading-message .spinner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(33, 150, 243, 0.2);
  border-top-color: #2196f3;
  animation: spin 1s linear infinite;
}

.loading-message .weather-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  color: #2196f3;
  animation: float 3s ease-in-out infinite;
}

.loading-message .loading-title {
  font-size: 1.5rem;
  color: #1a237e;
  margin-bottom: 1rem;
  animation: fadeInOut 2s infinite;
}

.loading-message .loading-text {
  color: #444;
  margin-bottom: 2rem;
  font-style: italic;
}

.loading-message .progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(33, 150, 243, 0.2);
  border-radius: 2px;
  margin: 0 auto;
  overflow: hidden;
}

.loading-message .progress-fill {
  width: 50%;
  height: 100%;
  background: #2196f3;
  border-radius: 2px;
  animation: progress 2s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0);
  }
  50% {
    transform: translate(-50%, -50%) translateY(-10px);
  }
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

@keyframes progress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}

/* Dev Credit Section */
.dev-credit {
  position: fixed;
  bottom: 20px;
  right: 10px;
  z-index: 1000;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}
.dev-credit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.dev-credit p {
  margin: 0;
  font-size: 0.9rem;
  color: #2d3436;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dev-link {
  color: #0984e3;
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: color 0.3s ease;
}
.dev-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #0984e3;
  transition: width 0.3s ease;
}
.dev-link:hover {
  color: #74b9ff;
}
.dev-link:hover::after {
  width: 100%;
}
.dev-credit p::before {
  content: '✨';
  animation: sparkle 2s infinite;
  display: inline-block;
  font-size: 1.2em;
}

/* Sparkle animation */
@keyframes sparkle {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(0);
  }
}
@media (max-width: 1024px) {
  .dev-credit {
    bottom: 10px;
    left: 10px;
    padding: 8px 15px;
    font-size: 0.8rem;
  }
}
