* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(
      circle at 15% 80%,
      rgba(230, 180, 150, 0.35),
      transparent 30%
    ),
    radial-gradient(
      circle at 85% 20%,
      rgba(216, 112, 147, 0.25),
      transparent 35%
    ),
    linear-gradient(135deg, #e8a0ac, #a77ca7 50%, #6990ab);
  color: white;
}

.weather-widget button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: white;
  font-family: inherit;
}

/* =========================
   Main widget
========================= */

.weather-widget {
  width: min(1200px, 100%);
  display: grid;
  grid-template-columns: 1fr minmax(340px, 410px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

/* =========================
   Current weather
========================= */

.weather-current {
  padding: 38px;
  min-width: 0;
}

.weather-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.weather-meta {
  display: flex;
  flex-direction: column;
}

.weather-location-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 600;
  text-align: left;
  transition: opacity 0.2s ease;
}

.weather-location-btn:hover {
  opacity: 0.85;
}

.location-icon {
  font-size: 32px;
}

.location-arrow {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 3px solid #ffffff;
  border-bottom: 3px solid #ffffff;
  transform: rotate(45deg);
  margin-left: 4px;
  margin-bottom: 6px;
  opacity: 0.7;
}

.weather-date {
  margin-top: 7px;
  margin-left: 42px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 15px;
}

.weather-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  transition:
    background 0.2s,
    transform 0.2s;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.icon-button:active {
  transform: translateY(0);
}

#refresh {
  outline: none;
}

.icon-button .wi-refresh {
  font-size: 22px;
}

.icon-button .wi-refresh.spinning {
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.dots-icon {
  font-size: 24px;
  line-height: 1;
  margin-bottom: 4px;
}

/* =========================
   Current temperature
========================= */

.weather-main {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 50px;
}

.weather-icon-large {
  font-size: 150px;
  line-height: 1;
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.2));
}

.temperature-container {
  display: flex;
  flex-direction: column;
}

.temperature {
  display: flex;
  align-items: flex-start;
  font-size: 130px;
  line-height: 0.85;
  font-weight: 300;
  letter-spacing: -6px;
}

.temperature-unit {
  font-size: 44px;
  font-weight: 300;
  letter-spacing: normal;
  margin-top: 10px;
  margin-left: 4px;
  line-height: 1;
}

.weather-description {
  margin-top: 20px;
  font-size: 24px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -0.3px;
}

.temperature-range {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  font-size: 18px;
  font-weight: 600;
}

.temperature-high {
  color: #ffa4a4;
}

.temperature-low {
  color: #92d4ff;
}

/* =========================
   Detail cards
========================= */

.weather-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.detail-card {
  min-height: 100px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
}

.detail-icon {
  flex-shrink: 0;
  font-size: 26px;
  color: rgba(255, 255, 255, 0.85);
  width: 32px;
  text-align: center;
}

.detail-content {
  display: flex;
  flex-direction: column;
}

.detail-label {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
}

.detail-value {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wind-direction-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#wind-arrow {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

.sub-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(216, 112, 147, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
}

/* =========================
   UV
========================= */

.uv-card {
  display: flex;
  align-items: center;
  gap: 35px;
  margin-top: 35px;
  padding: 20px 25px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}

.uv-info {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 180px;
}

.uv-icon {
  font-size: 32px;
  color: #ffb6c1;
  width: 36px;
  text-align: center;
  line-height: 1;
}

.uv-meta {
  display: flex;
  flex-direction: column;
}

.uv-value {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

.uv-value span:last-child {
  margin-left: 5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}

.uv-scale {
  flex: 1;
}

.uv-bar {
  position: relative;
  height: 8px;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    #45dc7d 0%,
    #8cde5b 20%,
    #ffe14e 38%,
    #ff9d3f 55%,
    #ff665b 72%,
    #d7447c 88%,
    #8846e8 100%
  );
}

.uv-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border: 3px solid white;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: left 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.uv-numbers {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 500;
}

/* =========================
   Forecast
========================= */

.weather-forecast {
  padding: 30px 24px;
  background: rgba(40, 35, 55, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.forecast-title {
  padding: 5px 10px 18px;
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.forecast-item {
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr 55px 70px;
  align-items: center;
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.forecast-item:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateX(-4px);
}

.forecast-day {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forecast-day strong {
  font-size: 16px;
  font-weight: 600;
}

.forecast-day span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.forecast-icon-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  line-height: 1;
}

.forecast-icon-wrap .wi {
  font-size: 26px;
  color: #ffffff;
}

.forecast-temperature {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  font-size: 16px;
  font-weight: 600;
}

.forecast-temperature strong {
  color: #ffa4a4;
}

.forecast-temperature span {
  color: #92d4ff;
}

/* =========================
   Responsive
========================= */

@media (max-width: 1220px) {
  .weather-widget {
    grid-template-columns: 1fr;
  }

  .weather-forecast {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 0;
    border-radius: 0 0 30px 30px;
  }

  .forecast-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .forecast-item:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 820px) {
  body {
    padding: 16px;
  }

  .weather-current {
    padding: 28px 20px;
  }

  .weather-location-btn {
    font-size: 22px;
  }

  .weather-date {
    margin-left: 36px;
  }

  .weather-main {
    min-height: auto;
    flex-direction: column;
    gap: 24px;
    padding: 40px 0;
  }

  .weather-icon-large {
    font-size: 110px;
  }

  .temperature {
    justify-content: center;
    font-size: 100px;
  }

  .temperature-container {
    text-align: center;
  }

  .temperature-range {
    justify-content: center;
  }

  .weather-details {
    grid-template-columns: repeat(2, 1fr);
  }

  .uv-card {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .uv-info {
    min-width: auto;
  }

  .forecast-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 450px) {
  .weather-details {
    grid-template-columns: 1fr;
  }

  .weather-actions {
    display: none !important;
  }

  .forecast-item {
    grid-template-columns: 1fr 50px 65px;
  }
}

/* =========================
   Skeleton
========================= */

@keyframes pulse {
  0% {
    background-position: 0% 50%;
    opacity: 0.6;
  }
  50% {
    background-position: 100% 50%;
    opacity: 0.95;
  }
  100% {
    background-position: 0% 50%;
    opacity: 0.6;
  }
}

.skeleton-line,
.skeleton-circle,
.skeleton-card,
.skeleton-forecast-item {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.08) 25%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.08) 75%
  );
  background-size: 200% 100%;
  animation: pulse 1.8s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr minmax(340px, 410px);
  width: 100%;
  min-height: 650px;
}

.skeleton-current {
  padding: 38px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.skeleton-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-title {
  width: 220px;
  height: 32px;
}

.skeleton-subtitle {
  width: 150px;
  height: 18px;
  margin-top: 8px;
}

.skeleton-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 40px 0;
}

.skeleton-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
}

.skeleton-content-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-temp {
  width: 120px;
  height: 60px;
}
.skeleton-desk {
  width: 180px;
  height: 24px;
}
.skeleton-range {
  width: 100px;
  height: 16px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.skeleton-card {
  height: 100px;
  border-radius: 18px;
}

.skeleton-uv {
  display: flex;
  align-items: center;
  gap: 35px;
  margin-top: 35px;
  padding: 20px 25px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  height: 94px;
}

.skeleton-uv-info {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 180px;
}

.skeleton-uv-circle {
  width: 36px;
  height: 36px;
  border-radius: 50% !important;
}

.skeleton-uv-label {
  width: 80px;
  height: 13px;
}

.skeleton-uv-value {
  width: 110px;
  height: 17px;
}

.skeleton-uv-scale {
  flex: 1;
  height: 8px;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.08) 25%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.08) 75%
  );
  background-size: 200% 100%;
  animation: pulse 1.8s ease-in-out infinite;
}

.skeleton-forecast {
  padding: 30px 24px;
  background: rgba(40, 35, 55, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.skeleton-forecast-title {
  width: 180px;
  height: 26px;
}
.skeleton-forecast-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skeleton-forecast-item {
  height: 72px;
  border-radius: 16px;
}

@media (max-width: 1220px) {
  .skeleton-panel {
    grid-template-columns: 1fr;
  }
  .skeleton-forecast {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .skeleton-forecast-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 820px) {
  .skeleton-main {
    flex-direction: column;
    gap: 20px;
  }
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .skeleton-uv {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    height: auto;
  }
  .skeleton-uv-scale {
    width: 100%;
  }
  .skeleton-forecast-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   Loading state
   ========================================= */

.weather-widget.widget-loading .weather-current,
.weather-widget.widget-loading .weather-forecast {
  display: none !important;
}

.weather-widget:not(.widget-loading) .skeleton-panel {
  display: none !important;
}

/* =========================================
   Error Banner
   ========================================= */

.error-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40%);
  max-width: 600px;
  background: rgba(220, 53, 69, 0.92);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  padding: 14px 20px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 100;
  animation: slideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.error-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.error-icon {
  font-size: 20px;
}

#error-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.error-close {
  background: none;
  border: 0;
  color: white;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.7;
  transition:
    opacity 0.2s,
    transform 0.2s;
  line-height: 1;
}

.error-close:hover {
  opacity: 1;
  transform: scale(1.15);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
