:root {
  --bg-start: #2e335a;
  --bg-end: #1c1b33;
  --card-strong: rgba(72, 49, 157, 0.65);
  --card-soft: rgba(72, 49, 157, 0.45);
  --line-soft: rgba(255, 255, 255, 0.14);
  --text-main: #ffffff;
  --text-soft: #ebebf5;
  --accent: #40cbd8;
  --warning: #ffd26f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 15% 10%, #c427fb33, transparent 35%),
    radial-gradient(circle at 80% 75%, #40cbd822, transparent 35%),
    linear-gradient(180deg, var(--bg-start), var(--bg-end));
  display: grid;
  place-items: center;
}

.app-shell {
  width: min(100%, 390px);
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.weather-screen {
  padding: 18px 16px 20px;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  overflow-y: hidden;
  overflow-x: hidden;
  position: relative;
  isolation: isolate;
}

.weather-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/Image.png") center top / cover no-repeat;
  z-index: 0;
}

.weather-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 23, 58, 0.25), rgba(30, 26, 62, 0.18) 45%, rgba(28, 21, 62, 0.48));
  z-index: 1;
}

.weather-screen > * {
  min-width: 0;
  max-width: 100%;
  position: relative;
  z-index: 2;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.city-group {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.city-group h1 {
  margin: 0;
  font-size: 2.15rem;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.city-group p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.icon-span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
}

.icon-btn {
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.hero-weather {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  position: relative;
  min-height: 0;
  padding-top: 6px;
}

.hero-text {
  display: grid;
  justify-items: center;
  gap: 2px;
  z-index: 3;
}

.weather-icon {
  width: 88px;
  height: 88px;
  object-fit: contain;
  animation: floatIcon 4s ease-in-out infinite;
  filter: drop-shadow(0 6px 14px rgba(20, 14, 44, 0.45));
}

.temperature {
  margin: 0;
  font-size: 6.35rem;
  font-weight: 300;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.weather-desc {
  margin: -2px 0 0;
  font-size: 0.98rem;
  color: var(--text-soft);
  font-weight: 600;
}

.high-low {
  margin: 1px 0 0;
  font-size: 0.9rem;
  color: #f6f2ff;
  font-weight: 600;
}

.house-art {
  width: min(100%, 370px);
  height: auto;
  position: absolute;
  left: 50%;
  bottom: -52px;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 28px rgba(11, 9, 30, 0.55));
  z-index: 2;
  pointer-events: none;
}

.stats-grid {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 210px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.metric-card {
  padding: 12px;
  min-height: 92px;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--card-strong), var(--card-soft));
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.metric-card h3 {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  font-weight: 600;
}

.metric-card p {
  margin: 8px 0 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.forecast-panel {
  background: radial-gradient(circle at 50% 10%, rgba(126, 89, 214, 0.45), transparent 48%),
    linear-gradient(180deg, rgba(80, 64, 146, 0.78), rgba(36, 34, 75, 0.92));
  border: 1px solid rgba(146, 161, 255, 0.45);
  border-radius: 36px 36px 0 0;
  padding: 10px 0px 8px;
  backdrop-filter: blur(16px);
  margin: 0;
  width: 100%;
  max-width: calc(100% + 32px);
  box-shadow: 0 -8px 30px rgba(40, 26, 92, 0.46);
  z-index: 4;
}

.segment-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0 12px 10px;
}

.segment-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 7px 8px;
  cursor: pointer;
}

.segment-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(146, 161, 255, 0.5);
  color: var(--text-main);
}

.forecast-view {
  display: none;
  width: 100%;
  max-width: 100%;
}

.forecast-view.show {
  display: block;
}

.hourly-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 12px 12px;
  scrollbar-width: thin;
  max-width: 100%;
}

.hourly-item {
  min-width: 84px;
  padding: 11px 8px 12px;
  border-radius: 30px;
  text-align: center;
  background: linear-gradient(180deg, rgba(90, 70, 170, 0.9), rgba(55, 46, 108, 0.92));
  border: 1px solid rgba(136, 124, 212, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 20px rgba(10, 8, 28, 0.38);
}

.hourly-item.current {
  border-color: #8e70ff;
  background: linear-gradient(180deg, rgba(98, 72, 210, 0.95), rgba(74, 54, 184, 0.95));
}

.hourly-item p {
  margin: 0;
}

.hour-label {
  font-size: 0.62rem;
  color: #f1ecff;
  font-weight: 600;
  white-space: nowrap;
}

.hour-temp {
  margin-top: 6px;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1;
}

.hour-rain {
  margin-top: 3px;
  font-size: 0.66rem;
  color: var(--accent);
  font-weight: 600;
}

.weekly-list {
  list-style: none;
  margin: 0;
  padding: 4px 12px 12px;
  max-width: 100%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.weekly-list li {
  min-width: 118px;
  padding: 11px 10px 12px;
  border-radius: 30px;
  text-align: center;
  background: linear-gradient(180deg, rgba(90, 70, 170, 0.9), rgba(55, 46, 108, 0.92));
  border: 1px solid rgba(136, 124, 212, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 20px rgba(10, 8, 28, 0.38);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.weekly-list li:last-child {
  border-bottom: 1px solid rgba(136, 124, 212, 0.62);
}

.day-name {
  font-size: 0.72rem;
  color: #f1ecff;
  font-weight: 600;
  text-transform: capitalize;
}

.day-desc {
  font-size: 0.66rem;
  color: var(--accent);
  font-weight: 600;
  line-height: 1.1;
}

.day-temp {
  margin-top: 4px;
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.1;
}

.day-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.status-message {
  margin: 0;
  text-align: center;
  font-size: 0.68rem;
  color: #bfb6df;
  min-height: 18px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0px;
  z-index: 5;
  pointer-events: none;
}

.search-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #2e335a, #1c1b33);
  z-index: 20;
}

.search-overlay.hidden {
  display: none;
}

.search-screen {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 18px 14px 10px;
}

.search-header-big {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-header-big h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 500;
}

.search-form-big {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.search-form-big input {
  width: 100%;
  border: 1px solid var(--line-soft);
  background: rgba(36, 40, 86, 0.72);
  color: var(--text-main);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 1rem;
  outline: none;
}

.search-form-big button {
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #10263a;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}

.city-cards {
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding-right: 2px;
}

.city-weather-card {
  border: none;
  background-color: #4d3ab200;
  background-image: url("assets/Rectangle.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  padding: 16px;
  min-height: 170px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.city-weather-card:hover {
  transform: translateY(-1px);
}

.card-weather-city {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
}

.card-icon-city {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    justify-content: center;
    max-width: 60%;
}

.city-card-temp {
  font-size: 3.6rem;
  line-height: 0.95;
  font-weight: 500;
  color: var(--text-soft);
}

.city-card-meta {
  color: #948BB8;
  font-size: 0.82rem;
}

.city-card-name {
  font-size: 1.2rem;
  margin-top: 2px;
  color: var(--text-soft);
}

.city-card-desc {
  margin-top: 4px;
  font-size: 0.9rem;
  text-align: right;
  color: var(--text-soft);
}

.city-weather-card img {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -35px;
}

.hourly-item img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

@media (max-height: 860px) {
  .temperature {
    font-size: 5.65rem;
  }

  .house-art {
    width: min(100%, 345px);
    bottom: -44px;
  }

  .forecast-panel {
    margin-top: 0;
  }
}

/* Scrollbar tematica para combinar com o gradiente do app */
.weather-screen,
.stats-grid,
.hourly-list,
.city-cards {
  scrollbar-width: thin;
  scrollbar-color: #7a66e9 rgba(255, 255, 255, 0.08);
}

.weather-screen::-webkit-scrollbar,
.stats-grid::-webkit-scrollbar,
.hourly-list::-webkit-scrollbar,
.city-cards::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.weather-screen::-webkit-scrollbar-track,
.stats-grid::-webkit-scrollbar-track,
.hourly-list::-webkit-scrollbar-track,
.city-cards::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(20, 16, 44, 0.38));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.weather-screen::-webkit-scrollbar-thumb,
.stats-grid::-webkit-scrollbar-thumb,
.hourly-list::-webkit-scrollbar-thumb,
.city-cards::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8f7dff, #5c48d0 70%, #45bdd5);
  border-radius: 999px;
  border: 2px solid rgba(23, 18, 56, 0.75);
  box-shadow: 0 0 8px rgba(128, 108, 255, 0.45);
}

.weather-screen::-webkit-scrollbar-thumb:hover,
.stats-grid::-webkit-scrollbar-thumb:hover,
.hourly-list::-webkit-scrollbar-thumb:hover,
.city-cards::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a99bff, #6d58de 70%, #58d2e8);
}

.weather-screen::-webkit-scrollbar-corner,
.stats-grid::-webkit-scrollbar-corner,
.hourly-list::-webkit-scrollbar-corner,
.city-cards::-webkit-scrollbar-corner {
  background: transparent;
}

@keyframes floatIcon {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@media (min-width: 640px) {
  .app-shell {
    min-height: 844px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  }

  body {
    padding: 20px;
  }
}
