/* weather.css - 天气模块专用拟态样式 */
.weather-widget {
  /* 覆盖卡片的颜色变量，营造清新蓝调 */
  --card-bg: #f0f6fb;
  --card-shadow-dark: #b0c4e8;
  --card-shadow-light: #ffffff;
  border-radius: 16px; /* 更圆润 */
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-family: 'HarmonyOS Sans', 'Noto Sans SC', sans-serif;
  color: #2a3a5b;
}

/* 标题 */
.weather-widget .widget-title {
  font-weight: 800;
  font-size: 1.6rem;
  color: #1a2a4a;
  margin-bottom: 12px;
  letter-spacing: 1.2px;
  user-select: none;
}

/* 主体区域，图标 + 主要信息 */
.weather-main {
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
}

/* 图标尺寸和样式 */
.weather-icon img {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.12));
  border-radius: 12px;
}

/* 主要天气信息 */
.weather-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 1; 
}

/* 温度数字 */
.weather-info .temperature {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: #1c2a49;
  position: relative;
  z-index: 1; 
}

/* 天气描述 */
.weather-info .description {
  font-size: 1.1rem;
  font-weight: 600;
  color: #3a4a73;
  text-transform: capitalize;
  position: relative;
  z-index: 1; 
}

/* 位置 */
.weather-info .location {
  font-size: 0.9rem;
  color: #4a5a7a;
  user-select: text;
  position: relative;
  z-index: 1; 
}

/* 详细数据区块：桌面端两行两列 */
.weather-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
}

/* 每个天气项自动填充两行两列 */
.weather-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow:
    4px 4px 6px #c9d4f1,
    -4px -4px 6px #ffffff;
  color: #2c3a6b;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
  min-width: 0;
  min-height: 0;
}

/* 图标放大 */
.weather-item i {
  font-size: 1.6rem;
  margin-bottom: 8px;
  color: #4a5a7a;
}

/* 数值文本 */
.weather-item span {
  font-size: 1.1rem;
  font-weight: 600;
  user-select: text;
}

/* hover 效果 */
.weather-item:hover {
  transform: translateY(-3px);
  box-shadow:
    6px 6px 10px #a0b0e0,
    -6px -6px 10px #ffffff;
}

.weather-icon i {
  font-size: 80px;
  color: #444;
}








/* 动画容器基础样式 */
.weather-anim {
  position: absolute;        /* 底层绝对定位 */
  top: 50%;                  /* 容器中心 */
  left: 50%;
  transform: translate(-50%, -50%); /* 居中 */
  width: 100%;
  height: 80px;              /* 可调，根据动画大小 */
  z-index: 0;                /* 底层 */
  pointer-events: none;      /* 不阻挡鼠标事件 */
}




/* 雾动画 */
.weather-anim .fog {
  width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 60%, rgba(255,255,255,0.5) 0%, transparent 80%);
  animation: fogMove 6s infinite linear;
  opacity: 0.5;
}
@keyframes fogMove {
  0% { filter: blur(8px); }
  50% { filter: blur(16px); }
  100% { filter: blur(8px); }
}

/* 雨动画 */
.weather-anim .rain,
.weather-anim .rain-medium,
.weather-anim .rain-heavy,
.weather-anim .rain-storm {
  width: 100%; height: 100%;
  position: absolute;
  left: 0; top: 0;
  overflow: hidden;
}
.weather-anim .rain-drop {
  position: absolute;
  width: 2px; height: 18px;
  background: rgba(120,180,255,0.7);
  border-radius: 1px;
  animation: rainDrop 1s linear infinite;
}
@keyframes rainDrop {
  0% { top: -20px; opacity: 1; }
  100% { top: 100%; opacity: 0.2; }
}
.weather-anim .rain-medium .rain-drop {
  background: rgba(80,140,220,0.8);
  height: 22px;
  animation-duration: 0.8s;
}
.weather-anim .rain-heavy .rain-drop {
  background: rgba(40,100,200,0.9);
  height: 28px;
  animation-duration: 0.6s;
}
.weather-anim .rain-storm .rain-drop {
  background: rgba(20,80,180,1);
  height: 36px;
  animation-duration: 0.4s;
}

/* 雪动画 */
.weather-anim .snow {
  width: 100%; height: 100%;
  position: absolute;
  left: 0; top: 0;
  overflow: hidden;
}
.weather-anim .snow-flake {
  position: absolute;
  width: 8px; height: 8px;
  background: white;
  border-radius: 50%;
  opacity: 0.8;
  animation: snowFall 3s linear infinite;
}
@keyframes snowFall {
  0% { top: -10px; opacity: 1; }
  100% { top: 100%; opacity: 0.3; }
}

/* 晴天动画：太阳光晕 */
/* 太阳主体 */
.weather-anim .sunny {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #ffe066 60%, #fffbe6 100%);
  /* 多层光晕叠加 */
  box-shadow:
    0 0 20px 5px #ffe06644,
    0 0 40px 10px #ffe06633,
    0 0 60px 20px #ffe06622;
  animation:
    sunnyGlow 3s infinite alternate,
    sunnyScale 6s infinite alternate;
  z-index: 0;
}

/* 太阳呼吸光晕动画 */
@keyframes sunnyGlow {
  0% {
    box-shadow:
      0 0 20px 5px #ffe06633,
      0 0 40px 10px #ffe06622,
      0 0 60px 20px #ffe06611;
  }
  100% {
    box-shadow:
      0 0 30px 10px #ffe06655,
      0 0 50px 15px #ffe06644,
      0 0 70px 25px #ffe06633;
  }
}

/* 太阳轻微缩放动画 */
@keyframes sunnyScale {
  0% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.05); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* 太阳光线伪元素 */
.weather-anim .sunny::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 140px;
  height: 140px;
  transform: translate(-50%, -50%) rotate(0deg);
  border-radius: 50%;
  background: radial-gradient(circle, #ffe06611 10%, transparent 70%);
  animation: sunRays 8s infinite linear;
  z-index: -1;
  pointer-events: none;
}

/* 光线旋转动画 */
@keyframes sunRays {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 小闪光伪元素，增加真实感 */
.weather-anim .sunny::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 160px;
  height: 160px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff4aa22 5%, transparent 70%);
  animation: sunFlicker 4s infinite alternate;
  z-index: -1;
  pointer-events: none;
}

@keyframes sunFlicker {
  0% { opacity: 0.2; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.03); }
  100% { opacity: 0.2; transform: translate(-50%, -50%) scale(1); }
}

/* 阴天动画：灰色云朵 */
.weather-anim .cloudy {
  position: absolute;
  left: 40%; top: 35%;
  width: 80px; height: 40px;
  background: #d3d6db;
  border-radius: 40px/20px;
  box-shadow: 30px 0 30px 0 #bfc3c9, -30px 0 30px 0 #e2e4e7;
  animation: cloudyMove 6s infinite linear;
  opacity: 0.5;
}

@keyframes cloudyMove {
  0% { left: 38%; }
  50% { left: 42%; }
  100% { left: 38%; }
}

/* 雷雨动画：闪电+雨滴 */
.weather-anim .thunderstorm {
  position: absolute;
  left: 50%; top: 30%;
  width: 60px; height: 60px;
  transform: translate(-50%, -50%);
  opacity: 0.5;
}
.weather-anim .thunderstorm .lightning {
  position: absolute;
  left: 25px; top: 10px;
  width: 10px; height: 30px;
  background: linear-gradient(135deg, #fff700 60%, #fffbe6 100%);
  clip-path: polygon(0 0, 100% 0, 60% 60%, 100% 60%, 0 100%, 40% 40%);
  animation: lightningFlash 1.2s infinite;
}
@keyframes lightningFlash {
  0%, 80%, 100% { opacity: 0.2; }
  10%, 20% { opacity: 1; }
}


/* 响应式支持 */
@media (max-width: 900px) {
  .weather-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .weather-info .temperature {
    font-size: 2.2rem;
  }
  .weather-widget {
    padding: 14px;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .weather-widget {
    font-size: 0.95em;
    padding: 10px;
    gap: 8px;
  }
  .weather-main {
    flex-direction: column;
    gap: 8px;
  }
  .weather-info .temperature {
    font-size: 1.6rem;
  }
  .weather-details {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: unset;
    gap: 8px;
  }
}

