/* 天气组件样式 - 适配电子墨水屏 */

.weather {
  padding: clamp(12px, 3vw, 20px);
  margin-bottom: 8px;
  /* 设置固定最小高度，确保在API数据加载前就占用正确空间 */
  min-height: clamp(120px, 25vw, 160px);
  /* 添加过渡效果，使高度变化更平滑 */
  transition: min-height 0.3s ease;
}

/* 增强型天气布局 */
.weather-enhanced {
  width: 100%;
}

/* 天气组件占位符样式 */
.weather-placeholder {
  opacity: 0.7;
  animation: pulse 2s infinite;
}

.weather-placeholder .data-value,
.weather-placeholder .weather-text,
.weather-placeholder .weather-location,
.weather-placeholder .hourly-time,
.weather-placeholder .hourly-temp,
.weather-placeholder .hourly-weather,
.weather-placeholder .hourly-rain {
  color: #999;
}

/* 脉冲动画效果 */
@keyframes pulse {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 0.5;
  }
}

/* 主容器 */
.weather-main-container {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

/* 左侧区域：icon + 天气 + 城市 */
.weather-left-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 120px;
}

.weather-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 右侧区域：数据网格 */
.weather-right-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

/* 数据行 */
.weather-data-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.weather-data-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-align: center;
}

.weather-divider {
  display: none;
}

.weather-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(36px, 8vw, 48px);
  height: clamp(36px, 8vw, 48px);
}

.weather-icon svg {
  width: 100%;
  height: 100%;
}
/* 温度显示 */
.weather-temp {
  font-size: clamp(23px, 4vw, 31px);
  font-weight: 500;
  color: #333;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
  min-height: 1.2em;
}

.weather-location {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 500;
  color: #333;
  text-align: center;
  margin-top: clamp(2px, 0.5vw, 4px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-height: 1.2em;
  line-height: 1.2;
  display: block;
}

.weather-text {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 500;
  color: #333;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.2em;
  line-height: 1.2;
  display: block;
  max-width: 100%;
  word-break: break-all;
}

/* 数据标签样式 */
.data-label {
  font-size: clamp(12px, 2vw, 14px);
  color: #666;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.2;
}

/* 数据数值样式 */
.data-value {
  font-size: clamp(15px, 2.5vw, 17px);
  font-weight: 700;
  color: #333;
  white-space: nowrap;
  line-height: 1.2;
  margin-top: clamp(2px, 0.5vw, 4px);
}

/* 未来五小时预报行 - 与上方数据列对齐 */
.weather-hourly-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.hourly-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-align: center;
  gap: 2px;
}

.hourly-time {
  font-size: clamp(11px, 2vw, 13px);
  color: #666;
  font-weight: 500;
}

.hourly-temp {
  font-size: clamp(13px, 2.5vw, 15px);
  color: #333;
  font-weight: 500;
}

.hourly-weather-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.hourly-weather {
  font-size: clamp(10px, 1.8vw, 12px);
  color: #555;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hourly-rain {
  font-size: clamp(11px, 2vw, 13px);
  color: #666;
  font-weight: 400;
}

.detail-label {
  font-size: clamp(17px, 2.5vw, 19px);
  color: #666;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.2;
  min-height: 1.2em;
}
/* 详细信息数值 */
.detail-value {
  font-size: clamp(17px, 2.5vw, 19px);
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
  min-height: 1.2em;
}

/* AQI 颜色指示 - 移除所有着色 */
.detail-value.aqi-good, .data-value.aqi-good { color: #333; }
.detail-value.aqi-moderate, .data-value.aqi-moderate { color: #333; }
.detail-value.aqi-unhealthy-sensitive, .data-value.aqi-unhealthy-sensitive { color: #333; }
.detail-value.aqi-unhealthy, .data-value.aqi-unhealthy { color: #333; }
.detail-value.aqi-very-unhealthy, .data-value.aqi-very-unhealthy { color: #333; }
.detail-value.aqi-hazardous, .data-value.aqi-hazardous { color: #333; }
.detail-value.no-data, .data-value.no-data { color: #333; }

/* UV 指数颜色指示 */
.detail-value.uv-low { color: #008000; }
.detail-value.uv-moderate { color: #b8860b; }
.detail-value.uv-high { color: #ff7e00; }
.detail-value.uv-very-high { color: #ff0000; }
.detail-value.uv-extreme { color: #8f3f97; }

.weather-minutecast {
  margin-top: clamp(6px, 1.5vw, 10px);
  padding: clamp(6px, 1.5vw, 10px);
  border: 1px solid var(--border);
  background: var(--bg);
}

.weather-alerts {
  margin-top: clamp(6px, 1.5vw, 10px);
}

.weather-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(8px, 2vw, 12px);
  gap: 15px;
}

.weather .city {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 600;
  color: var(--fg);
  flex-shrink: 0;
}

.weather .current {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 12px);
  flex: 1;
  justify-content: flex-end;
}

.weather .temp {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 700;
  color: var(--fg);
  flex-shrink: 0;
}

.weather .cond {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
  flex-shrink: 0;
}

.weather .icon {
  display: inline-block;
  width: clamp(24px, 5vw, 32px);
  height: clamp(24px, 5vw, 32px);
  flex-shrink: 0;
}

.weather .icon svg {
  width: 100%;
  height: 100%;
}

.weather .cond span:last-child {
  font-size: clamp(12px, 2.5vw, 16px);
  color: var(--fg);
}

/* 预报区域 */
.forecast {
  display: flex;
  gap: clamp(6px, 1.5vw, 10px);
  overflow-x: auto;
  padding: clamp(4px, 1vw, 8px) 0;
}

.forecast::-webkit-scrollbar {
  display: none;
}

.forecast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2px, 0.5vw, 4px);
  min-width: clamp(45px, 10vw, 60px);
  padding: clamp(4px, 1vw, 8px);
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.forecast-item .hour {
  font-size: clamp(10px, 2vw, 12px);
  color: var(--fg);
  font-weight: 500;
}

.forecast-item .icon {
  width: clamp(16px, 3vw, 20px);
  height: clamp(16px, 3vw, 20px);
}

.forecast-item .temp {
  font-size: clamp(10px, 2vw, 12px);
  color: var(--fg);
  font-weight: 600;
}

/* 详细天气信息 */
.weather-details {
  margin-top: clamp(8px, 2vw, 12px);
  padding-top: clamp(8px, 2vw, 12px);
  border-top: 1px solid var(--border);
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: clamp(6px, 1.5vw, 10px);
}

.weather-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2px, 0.5vw, 4px);
  padding: clamp(4px, 1vw, 8px);
}

.weather-item .label {
  font-size: clamp(9px, 1.8vw, 11px);
  color: var(--fg);
  opacity: 0.8;
}

.weather-item .value {
  font-size: clamp(11px, 2.2vw, 14px);
  color: var(--fg);
  font-weight: 600;
}

.weather-item .icon {
  width: clamp(14px, 2.5vw, 18px);
  height: clamp(14px, 2.5vw, 18px);
}

/* 分钟级降水预报 */
.minutecast-section {
  margin-top: clamp(8px, 2vw, 12px);
  padding: clamp(6px, 1.5vw, 10px);
  border: 1px solid var(--border);
  background: var(--bg);
}

.minutecast-title {
  font-size: clamp(11px, 2.2vw, 14px);
  font-weight: 600;
  color: var(--fg);
  margin-bottom: clamp(4px, 1vw, 6px);
}

.minutecast-status {
  font-size: clamp(10px, 2vw, 13px);
  color: var(--fg);
  padding: clamp(4px, 1vw, 6px);
  border-radius: 2px;
  margin-bottom: clamp(4px, 1vw, 6px);
}

.minutecast-status.has-rain {
  background: var(--fg);
  color: var(--bg);
  opacity: 0.9;
}

.minutecast-status.no-rain {
  background: var(--bg);
  border: 1px solid var(--border);
}

.minutecast-details {
  font-size: clamp(9px, 1.8vw, 11px);
  color: var(--fg);
  opacity: 0.8;
}

.rain-type, .nearest-rain {
  margin-bottom: clamp(2px, 0.5vw, 3px);
}

/* 天气提醒 */
.weather-alerts {
  margin-top: clamp(8px, 2vw, 12px);
  padding: clamp(6px, 1.5vw, 10px);
  border: 2px solid var(--border);
  background: var(--bg);
}

.weather-alert {
  font-size: clamp(11px, 2.2vw, 14px);
  color: var(--fg);
  line-height: 1.4;
  margin-bottom: clamp(4px, 1vw, 6px);
}

.weather-alert:last-child {
  margin-bottom: 0;
}

.weather-alert.warning {
  font-weight: 600;
}

.weather-alert.info {
  opacity: 0.9;
}

.weather-alert.tip {
  opacity: 0.8;
  font-style: italic;
}

/* 空气质量指示器 */
.aqi-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 4px;
  border: 1px solid var(--border);
}

.aqi-good { background: var(--bg); }
.aqi-moderate { background: var(--fg); opacity: 0.3; }
.aqi-unhealthy { background: var(--fg); opacity: 0.6; }
.aqi-very-unhealthy { background: var(--fg); opacity: 0.8; }
.aqi-hazardous { background: var(--fg); }

/* 紫外线强度指示器 */
.uv-indicator {
  display: inline-block;
  width: 12px;
  height: 4px;
  margin-left: 4px;
  border: 1px solid var(--border);
}

.uv-low { background: var(--bg); }
.uv-moderate { background: var(--fg); opacity: 0.3; }
.uv-high { background: var(--fg); opacity: 0.6; }
.uv-very-high { background: var(--fg); opacity: 0.8; }
.uv-extreme { background: var(--fg); }

/* 响应式调整 */
@media (max-width: 600px) {
  .weather-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .forecast {
    gap: clamp(4px, 1vw, 6px);
  }
  
  .forecast-item {
    min-width: clamp(40px, 8vw, 50px);
  }
}

@media (max-width: 500px) {
  .weather-item {
    padding: 0 clamp(2px, 0.5vw, 4px);
  }
  
  .weather-text {
    font-size: clamp(14px, 2.8vw, 18px);
  }
  
  .weather-location {
    font-size: clamp(14px, 2.8vw, 18px);
  }
  
  .weather-temp {
    font-size: clamp(16px, 3.2vw, 22px);
  }
  
  .detail-label {
    font-size: clamp(12px, 2.2vw, 14px);
  }
  
  .detail-value {
    font-size: clamp(12px, 2.2vw, 14px);
  }
  
  /* 优化左侧区域在小屏幕下的显示 */
  .weather-left-section {
    gap: 6px;
    min-width: 90px;
  }
  
  .weather-icon {
    width: clamp(30px, 6vw, 40px);
    height: clamp(30px, 6vw, 40px);
  }
  
  /* 优化小屏幕数据显示 */
  .data-label {
    font-size: clamp(9px, 1.8vw, 11px);
    font-weight: 700;
    white-space: nowrap;
  }
  
  .data-value {
    font-size: clamp(11px, 2vw, 13px);
    font-weight: 700;
    white-space: nowrap;
  }
  
  .weather-data-row {
    gap: clamp(2px, 0.5vw, 3px);
  }
  
  .weather-data-column {
    flex: 1;
    min-width: 0; /* 允许压缩但保持比例 */
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
  }
}

@media (max-width: 400px) {
  /* 保持左右排列，不改变flex-direction */
  .weather-main-container {
    gap: 4px;
  }
  
  .weather-left-section {
    min-width: 100px;
    flex: 0 0 auto;
  }
  
  .weather-right-section {
    flex: 1;
    min-width: 0;
  }
  
  .weather-data-row {
    gap: clamp(2px, 0.5vw, 4px);
  }
  
  .weather-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .weather .current {
    justify-content: flex-start;
    width: 100%;
  }
  
  .weather-grid {
    grid-template-columns: 1fr;
  }
}