/* ===== 天气卡片组件样式 ===== */

/* 天气网格布局 */
.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
  padding: var(--spacing-md);
  position: relative;
  z-index: 5;
}

/* ===== 天气卡片基础样式 ===== */
.weather-card {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-large);
  padding: var(--spacing-lg);
  min-height: 320px;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--animation-normal) var(--easing-default);
  will-change: transform, box-shadow, background;
  
  /* GPU加速 */
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 卡片背景层 */
.card-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-large);
  opacity: 0.8;
  transition: opacity var(--animation-normal) var(--easing-default);
  z-index: 1;
}

/* 卡片内容容器 */
.card-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ===== 天气图标容器 ===== */
.weather-icon-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 120px;
  margin-bottom: var(--spacing-md);
}

.weather-icon {
  width: 80px;
  height: 80px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ===== 天气信息样式 ===== */
.weather-info {
  text-align: center;
  margin-bottom: var(--spacing-md);
}

.weather-title {
  font-family: var(--font-family-display);
  font-size: var(--font-size-title3);
  font-weight: 600;
  color: white;
  margin-bottom: var(--spacing-sm);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.temperature {
  display: flex;
  justify-content: center;
  align-items: baseline;
  margin-bottom: var(--spacing-sm);
}

.temp-value {
  font-family: var(--font-family-display);
  font-size: 48px;
  font-weight: 300;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.temp-unit {
  font-family: var(--font-family-display);
  font-size: var(--font-size-title2);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
  margin-left: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.weather-description {
  font-family: var(--font-family-text);
  font-size: var(--font-size-callout);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ===== 天气详情样式 ===== */
.weather-details {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.detail-item {
  flex: 1;
  text-align: center;
  padding: var(--spacing-sm);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-medium);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.detail-label {
  display: block;
  font-family: var(--font-family-text);
  font-size: var(--font-size-caption1);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
  margin-bottom: var(--spacing-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  display: block;
  font-family: var(--font-family-display);
  font-size: var(--font-size-subheadline);
  color: white;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ===== 天气卡片主题样式 ===== */

/* 晴天卡片 */
.weather-card.sunny {
  color: white;
}

.weather-card.sunny .card-background {
  background: var(--sunny-gradient);
}

.weather-card.sunny:hover .card-background {
  background: var(--sunny-gradient-light);
}

/* 大风卡片 */
.weather-card.windy {
  color: white;
}

.weather-card.windy .card-background {
  background: var(--windy-gradient);
}

.weather-card.windy:hover .card-background {
  background: var(--windy-gradient-light);
}

/* 暴雨卡片 */
.weather-card.rainy {
  color: white;
}

.weather-card.rainy .card-background {
  background: var(--rainy-gradient);
}

.weather-card.rainy:hover .card-background {
  background: var(--rainy-gradient-light);
}

/* 暴雪卡片 */
.weather-card.snowy {
  color: #333;
}

.weather-card.snowy .card-background {
  background: var(--snowy-gradient);
}

.weather-card.snowy:hover .card-background {
  background: var(--snowy-gradient-light);
}

.weather-card.snowy .weather-title,
.weather-card.snowy .temp-value,
.weather-card.snowy .detail-value {
  color: #333;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.weather-card.snowy .temp-unit,
.weather-card.snowy .weather-description {
  color: #666;
}

.weather-card.snowy .detail-label {
  color: #888;
}

/* ===== 卡片交互状态 ===== */

/* 悬停效果 */
.weather-card:hover {
  transform: translateY(-8px) translateZ(0);
  box-shadow: 
    0 16px 32px rgba(0, 0, 0, 0.15),
    0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.weather-card:hover .card-background {
  opacity: 0.9;
}

/* 激活状态 */
.weather-card:active {
  transform: translateY(-4px) translateZ(0);
  transition-duration: var(--animation-fast);
}

/* 焦点状态 */
.weather-card:focus {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 4px;
}

.weather-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

/* ===== 特殊效果和装饰 ===== */

/* 卡片光影效果 */
.weather-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  border-radius: var(--radius-large) var(--radius-large) 0 0;
  pointer-events: none;
  z-index: 3;
}

/* 卡片边缘高光 */
.weather-card::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
  bottom: 1px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(var(--radius-large) - 1px);
  pointer-events: none;
  z-index: 4;
}

/* ===== 毛玻璃效果增强 ===== */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.15);
}

.glass-effect-strong {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ===== 响应式调整 ===== */
@media (max-width: 768px) {
  .weather-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
  }
  
  .weather-card {
    min-height: 280px;
    padding: var(--spacing-md);
  }
  
  .weather-icon-container {
    height: 100px;
  }
  
  .weather-icon {
    width: 60px;
    height: 60px;
  }
  
  .temp-value {
    font-size: 40px;
  }
  
  .weather-details {
    gap: var(--spacing-sm);
  }
}

@media (max-width: 480px) {
  .weather-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }
  
  .weather-card {
    min-height: 240px;
  }
  
  .weather-icon-container {
    height: 80px;
  }
  
  .weather-icon {
    width: 50px;
    height: 50px;
  }
  
  .temp-value {
    font-size: 36px;
  }
  
  .weather-title {
    font-size: var(--font-size-headline);
  }
}

/* ===== 性能优化 ===== */
.weather-card,
.card-background,
.weather-icon {
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* 减少动画的用户偏好 */
@media (prefers-reduced-motion: reduce) {
  .weather-card {
    transition: none;
  }
  
  .weather-card:hover {
    transform: none;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .weather-card {
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.7);
  }
  
  .detail-item {
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
  }
}