/*
  文件：css/modals.css
  作用：弹窗模块相关样式（.popup、.popup-mask、弹窗动画等）。
  当前阶段：修复缺失的弹窗基础样式，确保弹窗正常显示和关闭。
  注释语言：中文
*/

/* 弹窗遮罩 - 去除背景，只保留定位功能 */
.popup-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

/* 音乐列表弹窗专用样式 */
.music-list-popup .modal-content{ padding: 16px; }
.music-list-popup .music-list-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 8px; }
.music-list-popup .music-list-header h3{ margin:0; font-size:18px; font-weight:600; }
/* 列头 */
.music-list-popup .music-list-cols{ position: sticky; top: 0; z-index: 1;  display:grid; grid-template-columns: 32px 40px 1fr auto; align-items:center; gap:10px; padding:4px 10px 6px; margin-bottom:6px; color:rgba(255,255,255,0.75); font-size:12px; border-bottom:1px dashed rgba(255,255,255,0.15); }
.music-list-popup .music-list-cols .col-idx{ text-align:center; }
.music-list-popup .music-list-cols .col-dur{ text-align:right; padding-right:2px; }
/* 列表 */
.music-list-popup .music-list{ display:flex; flex-direction:column; gap:8px; }
.music-list-popup .music-item{ display:grid; grid-template-columns: 32px 40px 1fr auto; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; transition: background .2s ease, transform .18s ease, box-shadow .18s ease; cursor:pointer; }
.music-list-popup .music-item:hover{ background: rgba(255,255,255,0.10); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.25); }
.music-list-popup .music-item:active{ transform: translateY(-1px); background: rgba(255,255,255,0.15); box-shadow: 0 4px 12px rgba(0,0,0,0.22); }
/* 默认不显示凸起选中状态，保留一个更轻的标识（可选） */
.music-list-popup .music-item.active{ background: rgba(255,255,255,0.10); box-shadow: none; }
.music-list-popup .music-item .index{ width:32px; text-align:center; color: rgba(255,255,255,0.7); font-variant-numeric: tabular-nums; display:flex; align-items:center; justify-content:center; }
.music-list-popup .music-item .index .play-icon{ display:none; font-size:16px; }
.music-list-popup .music-item:hover .index .num{ display:none; }
.music-list-popup .music-item:hover .index .play-icon{ display:inline-block; }
.music-list-popup .music-item .cover{ width:40px; height:40px; border-radius:6px; object-fit:cover; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.music-list-popup .music-item .meta{ display:flex; flex-direction:column; min-width:0; }
.music-list-popup .music-item .title{ font-size:14px; font-weight:600; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.music-list-popup .music-item .artist{ font-size:12px; color: rgba(255,255,255,0.75); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.music-list-popup .music-item .duration{ font-size:12px; color: rgba(255,255,255,0.8); margin-left: 10px; text-align:right; }

@media (max-width: 520px){
  .music-list-popup .music-list-cols{ grid-template-columns: 28px 36px 1fr auto; font-size:11px; }
  .music-list-popup .music-item{ grid-template-columns: 28px 36px 1fr auto; gap:8px; padding:8px; }
  .music-list-popup .music-item .cover{ width:36px; height:36px; }
  .music-list-popup .music-item .title{ font-size:13px; }
}

/* 移除重复的移动端音乐项布局，统一使用上方定义的网格列（含序号列与封面列） */

.popup-mask.show {
    opacity: 1;
    visibility: visible;
}

/* 弹窗基础样式 - 将背景色融入弹窗本身 */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    padding: 20px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(25px) saturate(150%);
    -webkit-backdrop-filter: blur(25px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    box-shadow: 
        0 32px 100px rgba(0, 0, 0, 0.4),
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    color: #fff;
}

.popup.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* 弹窗动画状态 */
.popup.animating {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-mask.animating {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-mask.fading {
    opacity: 0;
    visibility: hidden;
}

/* 弹窗内容区域 */
.popup .modal-content {
    height: 100%;
    overflow-y: auto;
}

/* 弹窗标题 */
.popup h2 {
    margin: 0 0 20px;
    text-align: center;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* 天气预报弹窗专用样式（与现有弹窗一致的结构与风格） */
.weather-forecast-popup .modal-content{ 
  background: transparent;
}
.weather-forecast-popup h3{ 
  margin: 0 0 16px; 
  font-size: 20px; 
  font-weight: 700; 
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.weather-forecast-popup .forecast-controls{ 
  margin-bottom: 20px; 
  background: rgba(255, 255, 255, 0.06);
  padding: 16px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.weather-forecast-popup .region-form{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; }
.weather-forecast-popup .region-form label{ 
  font-size: 13px; 
  color: rgba(255,255,255,0.85); 
  font-weight: 500;
}
.weather-forecast-popup .region-form input{ 
  flex: 0 1 180px; 
  height: 36px; 
  border-radius: 10px; 
  border: 1px solid rgba(255,255,255,0.15); 
  padding: 8px 12px; 
  background: rgba(255,255,255,0.1); 
  color: #fff; 
  font-size: 14px;
  transition: all 0.2s ease;
}
.weather-forecast-popup .region-form input:focus{
  outline: none;
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
.weather-forecast-popup .region-form .region-submit,
.weather-forecast-popup .region-form .region-current{ 
  height: 36px; 
  padding: 0 16px; 
  border-radius: 10px; 
  border: 1px solid rgba(255,255,255,0.2); 
  background: rgba(255,255,255,0.12); 
  color: #fff; 
  cursor: pointer; 
  transition: all 0.2s ease; 
  font-weight: 500;
  font-size: 14px;
}
.weather-forecast-popup .region-form .region-submit:hover,
.weather-forecast-popup .region-form .region-current:hover{ 
  background: rgba(255,255,255,0.2); 
  transform: translateY(-1px); 
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.weather-forecast-popup .region-form .region-submit:active,
.weather-forecast-popup .region-form .region-current:active{ 
  transform: translateY(0); 
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.weather-forecast-popup .forecast-grid{ display:grid; grid-template-columns: repeat(7, 1fr); gap:10px; }
.weather-forecast-popup .forecast-status{ 
  margin: 0 0 16px; 
  font-size: 14px; 
  color: rgba(255, 255, 255, 0.9); 
  background: rgba(255, 255, 255, 0.08); 
  padding: 12px 16px; 
  border-radius: 10px; 
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
  font-weight: 500;
}

/* 实时天气大卡片样式 - 去除框架，融入整体背景 */
.weather-forecast-popup .realtime-weather-card{
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: 20px;
  color: #fff;
  box-shadow: none;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}
.weather-forecast-popup .realtime-weather-card:hover{
  transform: none;
  box-shadow: none;
  background: transparent;
}
.weather-forecast-popup .realtime-top{ 
  display: flex; 
  justify-content: flex-end; 
  font-size: 13px; 
  color: rgba(255, 255, 255, 0.7); 
  margin-bottom: 8px;
}
.weather-forecast-popup .realtime-center{ display:flex; align-items:center; justify-content:center; gap:16px; margin: 10px 0 12px; }
.weather-forecast-popup .realtime-icon{ 
  font-size: 72px; 
  line-height: 1; 
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
.weather-forecast-popup .realtime-temp{ 
  font-size: 64px; 
  font-weight: 800; 
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.weather-forecast-popup .realtime-text{ 
  font-size: 20px; 
  font-weight: 600; 
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.weather-forecast-popup .realtime-desc{ 
  text-align: center; 
  color: rgba(255, 255, 255, 0.85); 
  margin: 12px 0 20px; 
  font-size: 16px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.weather-forecast-popup .realtime-metrics{ 
  display: grid; 
  grid-template-columns: repeat(7, 1fr); 
  gap: 10px; 
  background: rgba(255,255,255,0.04); 
  padding: 16px; 
  border-radius: 12px; 
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.weather-forecast-popup .metric-item{ 
  background: rgba(255,255,255,0.06); 
  border-radius: 10px; 
  padding: 12px 8px; 
  text-align: center; 
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.weather-forecast-popup .metric-item:hover{
  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}
.weather-forecast-popup .metric-value{ 
  font-weight: 700; 
  color: #fff; 
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.weather-forecast-popup .metric-label{ 
  font-size: 12px; 
  color: rgba(255, 255, 255, 0.75); 
  margin-top: 4px;
  font-weight: 500;
}

@media (max-width: 900px){
  .weather-forecast-popup .realtime-metrics{ grid-template-columns: repeat(4, 1fr); }
  .weather-forecast-popup .realtime-center{ gap: 12px; }
  .weather-forecast-popup .realtime-icon{ font-size: 60px; }
  .weather-forecast-popup .realtime-temp{ font-size: 52px; }
  .weather-forecast-popup .realtime-text{ font-size: 18px; }
}
@media (max-width: 520px){
  .weather-forecast-popup .realtime-metrics{ grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .weather-forecast-popup .realtime-weather-card{ padding: 20px; }
  .weather-forecast-popup .realtime-center{ 
    flex-direction: column; 
    gap: 8px; 
    text-align: center;
  }
  .weather-forecast-popup .realtime-icon{ font-size: 56px; }
  .weather-forecast-popup .realtime-temp{ font-size: 48px; }
  .weather-forecast-popup .realtime-text{ font-size: 16px; }
  .weather-forecast-popup .realtime-desc{ font-size: 14px; }
  .weather-forecast-popup .metric-item{ padding: 10px 6px; }
  .weather-forecast-popup .metric-value{ font-size: 14px; }
  .weather-forecast-popup .metric-label{ font-size: 11px; }
  .daily-forecast-grid{ 
    padding: 16px; 
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .daily-item{ 
    padding: 12px 8px; 
    min-height: 120px; 
  }
  .daily-icon{ width: 40px; height: 40px; }
  .daily-day{ font-size: 13px; }
  .daily-text{ font-size: 12px; }
  .daily-temp{ font-size: 14px; }
}
.weather-forecast-popup .forecast-item{ position:relative; border-radius:10px; overflow:hidden; padding:10px; color:#fff; background: linear-gradient(135deg, #6a85b6, #bac8e0); box-shadow: 0 6px 16px rgba(0,0,0,0.25); transition: transform .18s ease, box-shadow .18s ease; }
.weather-forecast-popup .forecast-item:hover{ transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,0.28); }
.weather-forecast-popup .forecast-item .day{ font-size:12px; opacity:0.9; margin-bottom:6px; }
.weather-forecast-popup .forecast-item .icon{ width:28px; height:28px; object-fit:contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); position:absolute; top:10px; right:10px; }
.weather-forecast-popup .forecast-item .meta{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.weather-forecast-popup .forecast-item .temp-range{ font-size:16px; font-weight:700; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.weather-forecast-popup .forecast-item .desc{ font-size:12px; opacity:0.9; text-align:right; }

@media (max-width: 980px){
  .weather-forecast-popup .forecast-grid{ grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 620px){
  .weather-forecast-popup .forecast-grid{ grid-template-columns: repeat(2, 1fr); }
}

/* 1–7天预报网格（使用接口图标，位于实时卡片下方） */
.daily-forecast-grid{
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0;
  background: rgba(255, 255, 255, 0.04);
  padding: 20px;
  border-radius: 16px;
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.daily-item{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 12px;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 140px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.daily-item:last-child {
  border-right: none;
}
.daily-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.02);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.daily-item:hover::before {
  opacity: 1;
}
.daily-item:hover{ 
  transform: translateY(-2px); 
  background: rgba(255,255,255,0.04);
}
.daily-day{ 
  font-size: 14px; 
  font-weight: 700; 
  color: rgba(255, 255, 255, 0.95); 
  margin-bottom: 8px; 
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.daily-icon{ 
  width: 48px; 
  height: 48px; 
  object-fit: contain; 
  margin: 8px 0; 
  image-rendering: -webkit-optimize-contrast; 
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
  transition: transform 0.2s ease;
}
.daily-item:hover .daily-icon{
  transform: scale(1.05);
}
.daily-text{ 
  font-size: 13px; 
  color: rgba(255, 255, 255, 0.85); 
  margin-bottom: 6px; 
  max-width: 100%; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.daily-temp{ 
  font-size: 15px; 
  color: rgba(255, 255, 255, 0.9); 
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

@media (max-width: 980px){
  .daily-forecast-grid{ 
    grid-template-columns: repeat(4, 1fr); 
  }
  .daily-item:nth-child(4n) {
    border-right: none;
  }
  .daily-item:nth-child(-n+4) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
}
@media (max-width: 620px){
  .daily-forecast-grid{ 
    grid-template-columns: repeat(2, 1fr); 
  }
  .daily-item:nth-child(4n) {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .daily-item:nth-child(2n) {
    border-right: none;
  }
  .daily-item:nth-child(-n+2) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .daily-item:nth-child(n+3):nth-child(-n+4) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .daily-item:nth-child(n+5):nth-child(-n+6) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* 弹窗关闭按钮 */
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.071);
    background: rgba(255, 255, 255, 0.133);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    z-index: 2001;
}

.modal-close:hover {
    transform: scale(1.06);
    background: rgba(255, 255, 255, 0.28);
}

.modal-close:active {
    transform: scale(0.94);
}

/* 设置中心弹窗专用样式 */
.settings-center-popup {
    max-width: 900px;
    width: 95%;
    min-height: 500px;
}


/* 响应式调整 */
@media (max-width: 768px) {
    .popup {
        width: 95%;
        max-height: 85vh;
        border-radius: 16px;
    }
    
    .popup h2 {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    /* 设置中心在移动端的特殊处理 */
    .settings-center-popup {
        width: 98%;
        max-width: none;
        max-height: 90vh;
    }
    
    .settings-center-popup .modal-content {
        padding: 12px;
    }
}

/* 壁纸弹窗内容样式（与音乐弹窗一致的玻璃风格） */
.wallpaper-popup .modal-content{ padding:16px; }
.wallpaper-section{ margin-bottom: 20px; }
.wallpaper-popup .section-header{ display: flex; margin:8px 0; align-items:center; justify-content:space-between;  }
.wallpaper-popup .section-actions{ display:flex; align-items:center; gap:8px; }
.wallpaper-popup .section-title{ font-weight:600; font-size:14px; opacity:.95; }
.wallpaper-popup .section-more{ font-size:12px; color:#c1c1c1; text-decoration:none; }
.wallpaper-popup .section-more:hover{ text-decoration:underline; }

.wallpaper-popup .row-wrap{ position:relative; }
.wallpaper-popup .wallpaper-row{ display:flex; gap:8px; overflow-x:auto; overscroll-behavior-x:contain; scroll-behavior:smooth; padding-bottom:8px; }
.wallpaper-popup .wallpaper-card{ flex:0 0 auto; width:140px; height:90px; border-radius:8px; overflow:hidden; position:relative; cursor:pointer; background:#0002; box-shadow:0 2px 8px rgba(0,0,0,.15); }
.wallpaper-popup .wallpaper-card img, .wallpaper-popup .wallpaper-card video{ width:100%; height:100%; object-fit:cover; display:block; }
.wallpaper-popup .wallpaper-card .card-mask{ position:absolute; inset:0; background:linear-gradient(to top, rgba(0,0,0,.35), rgba(0,0,0,.05)); opacity:0; transition:opacity .2s ease; }
.wallpaper-popup .wallpaper-card:hover .card-mask{ opacity:1; }
.wallpaper-popup .wallpaper-card .card-title{ position:absolute; left:8px; bottom:6px; right:8px; font-size:12px; color:#fff; text-shadow:0 1px 2px rgba(0,0,0,.5); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.wallpaper-popup .row-arrows{ position:static; display:flex; gap:6px; }
.wallpaper-popup .row-arrows.hidden{ display:none; }
.wallpaper-popup .row-arrow{ width:26px; height:auto; border:none; border-radius:20px; background:rgba(255, 255, 255, 0.04); color:#fff; backdrop-filter: blur(6px);  cursor:pointer; transition:transform .15s ease, background .15s ease; }
.wallpaper-popup .row-arrow:hover{ transform:scale(1.06); background:rgba(255,255,255,.3); }
.wallpaper-popup .row-arrow:active{ transform:scale(.94); }
/* 自定义滚动条：短小灰色 */
/* 隐藏滚动条（Chrome/Safari/Edge） */
.wallpaper-popup .wallpaper-row::-webkit-scrollbar{ display:none; width:0; height:0; }
/* Firefox 隐藏滚动条 */
.wallpaper-popup .wallpaper-row{ scrollbar-width: none; }
/* IE/旧版 Edge 可选支持 */
.wallpaper-popup .wallpaper-row{ -ms-overflow-style: none; }
/* 滚动条已隐藏，移除旧的样式以避免干扰 */

/* 显示全部：改为多行多列向下排布 */
.wallpaper-popup .wallpaper-row.show-all{ 
  /* 改为自适应网格填满可用宽度，避免右侧空白 */
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  overflow-x: hidden; 
}
/* 弹窗内容允许上下滚动显示超出部分 */
.wallpaper-popup .modal-content{ max-height: 70vh; overflow-y: auto; }

/* 垂直滚动条美化：毛玻璃风格，细窄灰白半透明 */
.wallpaper-popup .modal-content::-webkit-scrollbar{ width:4px; height:4px; }
.wallpaper-popup .modal-content::-webkit-scrollbar-track{ background: transparent; border-radius:10px; }
.wallpaper-popup .modal-content::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.25); border-radius:10px; border: 1px solid rgba(255,255,255,0.18); }
.wallpaper-popup .modal-content::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.35); }
.wallpaper-popup .modal-content{ scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.35) transparent; }

/* 网格模式下卡片宽度自适应并保持比例 */
.wallpaper-popup .wallpaper-row.show-all .wallpaper-card{ width:100%; height:auto; aspect-ratio: 16 / 10; }
.wallpaper-popup .wallpaper-row.show-all .wallpaper-card img,
.wallpaper-popup .wallpaper-row.show-all .wallpaper-card video{ width:100%; height:100%; object-fit: cover; }