/* ========================================================
   Nowoczesny "Candy Glass" UI - Responsywny Dashboard
======================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    "SF Pro Display",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: #2d3748;
  min-height: 100dvh;
  transition: background 1.5s ease;
  background-size: 200% 200%;
  animation: gradientMove 15s ease infinite;
  overflow-x: hidden; /* Zabezpiecza przed poziomym przewijaniem całej strony */
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* --- DYNAMICZNE TŁA --- */
.bg-clear {
  background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
}
.bg-clouds {
  background: linear-gradient(135deg, #e2e2e2 0%, #9eb0d5 100%);
}
.bg-rain {
  background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
}
.bg-clear-night {
  background: linear-gradient(135deg, #304352 0%, #d7d2cc 100%);
}
.bg-clouds-night {
  background: linear-gradient(135deg, #434343 0%, #28313b 100%);
  color: #fff;
}

.bg-clouds-night .text-muted,
.bg-clear-night .text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}
.bg-clouds-night .detail-header,
.bg-clear-night .detail-header {
  color: rgba(255, 255, 255, 0.8);
}

/* --- GŁÓWNY KONTENER --- */
.app-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  animation: fadeIn 0.4s ease-out;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.view-container::-webkit-scrollbar {
  display: none;
}
.hidden {
  display: none !important;
}

/* --- BAZOWY EFEKT SZKŁA --- */
.glass-panel {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  padding: 20px;
  width: 100%;
}

.bg-clouds-night .glass-panel,
.bg-clear-night .glass-panel {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- NAWIGACJA GÓRNA --- */
.top-nav {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  align-items: center;
  width: 100%;
}

.search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  padding: 12px 20px;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02);
  min-width: 0; /* Zabezpieczenie przed rozpychaniem */
}

.bg-clouds-night .search-bar,
.bg-clear-night .search-bar {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}
.search-bar:focus-within {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
  outline: none;
  font-weight: 500;
  min-width: 0;
}
.search-bar input::placeholder {
  color: #718096;
}
.bg-clouds-night .search-bar input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
.search-bar button,
.nav-icon {
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-icon {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* --- UKŁAD DASHBOARDU (Responsywność) --- */
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(
    0,
    1fr
  ); /* KRYTYCZNE: minmax(0, 1fr) zapobiega blow-outowi na mobile */
  gap: 20px;
  flex: 1;
  width: 100%;
}

@media (min-width: 850px) {
  .dashboard-layout {
    grid-template-columns: 350px minmax(0, 1fr);
    gap: 30px;
  }
  .current-weather {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

.main-weather-section,
.details-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0; /* KRYTYCZNE: pozwala kontenerom się kurczyć */
}

/* --- GŁÓWNA POGODA --- */
.current-weather {
  text-align: center;
}

#main-city {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 10px;
  /* Wymusza łamanie bardzo długich tekstów (np. Direktionsbezirk) */
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.accent-temp {
  font-size: 110px;
  font-weight: 200;
  line-height: 1;
  color: #ff7675;
  text-shadow: 2px 4px 10px rgba(255, 118, 117, 0.2);
  margin-bottom: 10px;
}
.accent-temp-small {
  color: #ff7675;
  font-weight: 500;
}
#main-condition {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 5px;
}
.text-muted {
  font-size: 16px;
  font-weight: 500;
  color: #4a5568;
}

/* --- WYKRES DŁUGOŚCI DNIA --- */
.sun-arc-wrapper {
  position: relative;
  width: 150px;
  margin: 35px auto 10px auto;
}
.sun-arc-svg {
  width: 100%;
  display: block;
  overflow: visible;
}
.sun-arc-text {
  position: absolute;
  bottom: 15px;
  left: 0;
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: #3182ce;
}
.bg-clouds-night .sun-arc-text,
.bg-clear-night .sun-arc-text {
  color: #90cdf4;
}
.sun-arc-icon {
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffca28;
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* --- NAGŁÓWKI PANELI --- */
.panel-header {
  font-size: 14px;
  text-transform: uppercase;
  color: #718096;
  font-weight: 700;
  letter-spacing: 1px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 12px;
  margin-bottom: 15px;
}
.bg-clouds-night .panel-header,
.bg-clear-night .panel-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

/* --- PROGNOZA GODZINOWA --- */
.hourly-scroll {
  display: flex;
  overflow-x: auto;
  gap: 30px;
  padding-bottom: 5px;
  width: 100%; /* Zapobiega wychodzeniu poza ekran */
}
.hour-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.time-small {
  font-weight: 600;
  font-size: 15px;
}
.hour-item .icon {
  font-size: 30px;
  color: #3182ce;
}
.bg-clouds-night .hour-item .icon,
.bg-clear-night .hour-item .icon {
  color: #90cdf4;
}
.hour-temp {
  font-size: 20px;
  font-weight: 700;
}

/* --- PROGNOZA 5-DNIOWA --- */
.horizontal-daily {
  display: flex;
  justify-content: space-between;
  text-align: center;
  width: 100%;
}
.daily-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.daily-day {
  font-size: 16px;
  font-weight: 700;
}
.daily-icon .icon {
  font-size: 28px;
  color: #3182ce;
}
.bg-clouds-night .daily-icon .icon,
.bg-clear-night .daily-icon .icon {
  color: #90cdf4;
}
.daily-temp {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
}
.daily-temp span {
  color: #718096;
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}

/* --- SIATKA DETALI --- */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 15px;
  width: 100%;
}
.detail-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  padding: 15px;
}
.detail-header {
  font-size: 13px;
  text-transform: uppercase;
  color: #718096;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-header i {
  font-size: 18px;
  color: #3182ce;
}
.bg-clouds-night .detail-header i,
.bg-clear-night .detail-header i {
  color: #90cdf4;
}
.detail-value {
  font-size: 24px;
  font-weight: 600;
  margin-top: 15px;
}

/* --- HUB --- */
.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.weather-card {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  padding: 25px;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.weather-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}
.card-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}
.city-info h2 {
  font-size: 26px;
  font-weight: 700;
  word-wrap: break-word;
}
.temp-display {
  font-size: 46px;
  font-weight: 300;
  color: #ff7675;
}
.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 2px solid rgba(0, 0, 0, 0.05);
  padding-top: 15px;
}
.condition-text {
  font-weight: 600;
  font-size: 16px;
}
.hi-lo {
  color: #718096;
  font-weight: 500;
  font-size: 14px;
  margin-top: 5px;
}
.card-bottom .icon {
  font-size: 40px;
  color: #3182ce;
}

.app-footer {
  text-align: center;
  font-size: 12px;
  color: #718096;
  margin-top: 30px;
  margin-bottom: 20px;
  font-weight: 600;
}
.app-footer a {
  color: inherit;
  text-decoration: underline;
}

/* ========================================================
   POPRAWKI DLA WĄSKICH EKRANÓW (Mobile Fixes dla iPhone)
======================================================== */
@media (max-width: 450px) {
  .app-container {
    padding: 12px;
  }
  .glass-panel {
    padding: 15px;
  }

  /* Gwarancja, że tytuły jak "Direktionsbezirk" się przełamią i nie rozsadzą ekranu */
  #main-city {
    font-size: 30px;
    line-height: 1.1;
  }

  .accent-temp {
    font-size: 90px;
  }

  /* Idealne dopasowanie 5-dniowej prognozy (ciaśniej, żeby nie obcinało po prawej) */
  .horizontal-daily {
    gap: 0;
  }
  .daily-day {
    font-size: 14px;
  }
  .daily-icon .icon {
    font-size: 22px;
  }
  .daily-temp {
    font-size: 14px;
  }
  .daily-temp span {
    font-size: 12px;
  }

  /* Wymuszamy 2 równe kolumny w siatce (nawet na bardzo wąskich telefonach) */
  .details-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .detail-card {
    padding: 12px;
    min-height: 100px;
  }
  .detail-value {
    font-size: 18px;
    margin-top: 10px;
  }
  .detail-header {
    font-size: 11px;
  }
}
