/* ===== LifeDashboard Web —— 样式完全参照 Qt Main.qml / MyCalendar.qml =====
   布局策略：背景图充满视口(cover,不改)；内容区 #root 严格 16:9，
   在视口内尽量大（宽优先或高优先自适应），垂直居中，设最小尺寸下限。
   内部尺寸全部使用容器查询单位 cqw(1%内容宽)/cqh(1%内容高)，随内容框自动缩放，不用 px。
*/

@font-face {
  font-family: 'qweather-icons';
  src: url('../fonts/qweather-icons.woff2') format('woff2'),
       url('../fonts/qweather-icons.woff') format('woff'),
       url('../fonts/qweather-icons.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { width: 100%; height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background-image: url('../assets/bg1.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #FFFFFF;
  /* 内容区垂直 + 水平居中 */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 主题变量：亮色 = 半透明黑 / 暗色 = #121212（全屏底色共用） */
body.theme-light {
  --left-bg: rgba(0, 0, 0, 0.5);
}
body.theme-dark {
  --left-bg: #121212;
}

/* ---------- 内容区：严格 16:9，自动缩放，垂直居中 ---------- */
#root {
  container-type: size;            /* 启用容器查询，子元素可用 cqw/cqh */
  aspect-ratio: 16 / 9;            /* 严格 16:9 */
  /* 尽量大：宽优先，但不超过 高*16/9（即高度放不下时由高度反推宽度） */
  width: min(100vw, calc(100vh * 16 / 9));
  /* 最小尺寸下限，避免内容过小不可显示（px 仅作可读性地板，不参与缩放） */
  min-width: 480px;
  min-height: 270px;               /* 480:270 = 16:9，触底时仍保持比例 */
  display: flex;
  overflow: hidden;
  position: relative;              /* 抬到全屏背景之上 */
  z-index: 1;
  border: 0.2cqw solid rgba(255, 255, 255, 0.5);  /* 16:9 区域透明白边框 */
  border-radius: 1.2cqw;                            /* 圆角 */
}

/* 全屏主题底色：整屏铺满，不限于 16:9 内容区 */
#bgTint {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--left-bg);      /* 亮/暗两主题共用同一底色变量 */
}

/* 左上角不可见手动切换区（固定定位、置于 #root 外，避免被圆角/overflow 裁切） */
#themeToggle {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  z-index: 20;
  cursor: pointer;
  /* 透明，仅作点击热区 */
}

/* ---------- 左栏 40% ---------- */
#left {
  flex: 0 0 40%;
  height: 100%;
}
.col {
  display: flex;
  flex-direction: column;
  height: 100%;
  align-items: center;
}

.time-wrap {
  width: 100%;
  height: 26cqh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.5cqh;
}
.time {
  font-size: 8cqw;            /* = left.width(40cqw) * 0.2 */
  color: #4fc3f7;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
}

.todayinfo-wrap {
  width: 100%;
  height: 8cqh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.todayinfo {
  font-size: 2cqw;            /* = left.width * 0.05 */
  color: #FFFFFF;
  text-align: center;
  padding: 0 0.8cqw;
}

.calendar-wrap {
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  margin-top: 0.4cqh;
}
.spacer { flex: 1 1 auto; }

/* ---------- 日历 ---------- */
#calendar {
  position: relative;
  width: 92%;
  max-width: 38cqw;
}
.cal-month-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22cqw;          /* = #calendar.width * 0.6 */
  color: rgba(150, 150, 150, 0.12);
  font-weight: 700;
  user-select: none;
  pointer-events: none;
  line-height: 1;
}
.cal-weekday {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5cqw;
  padding: 0.5cqw;
}
.cal-weekday > div {
  text-align: center;
  font-size: 1.4cqw;
  color: #FFFFFF;
  padding: 0.4cqw 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5cqw;
  padding: 0.5cqw;
}
.cal-cell {
  aspect-ratio: 1 / 1;
  border-radius: 0.8cqw;
  border: 0.3cqw solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  overflow: hidden;
}
.cal-cell .d {
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8cqw;
  font-weight: 600;
}
.cal-cell .l {
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3cqw;
  transform: scale(0.9);
}
.cal-cell.today { border-color: #FF0000; }
.cal-cell.today .d, .cal-cell.today .l { color: #FF0000; }
.cal-cell.holiday .d, .cal-cell.holiday .l { color: #4fc3f7; }
.cal-cell.weekend .d, .cal-cell.weekend .l { color: #4fc3f7; }

/* ---------- 右栏 60% ---------- */
#right {
  flex: 1 1 60%;
  height: 100%;
}
.col-right {
  width: 100%;
  height: 100%;
  padding: 1cqw;
  display: flex;
  flex-direction: column;
  gap: 1cqw;
}

/* 天气卡片：四角 flex 盒子（锚定到四角，保持原观感，20cqh 内全可见） */
.weather-card {
  --card-h: 20cqh;
  position: relative;
  flex: 0 0 var(--card-h);
  border-radius: 0.8cqw;
  overflow: hidden;
}
/* 左上：地区 + 更新时间 */
.wc-topleft {
  position: absolute;
  top: 1.2cqh;
  left: 0.8cqw;
  display: flex;
  align-items: baseline;
  gap: 1.1cqw;
  max-width: calc(100% - 30cqw);
}
.city-info {
  font-size: 4cqh;           /* = card-h * 0.2 */
  color: #FFFFFF;
  white-space: nowrap;
}
.weather-update {
  font-size: 3.2cqh;         /* = card-h * 0.16 */
  color: #FFFFFF;
  white-space: nowrap;
}
/* 右上：环境温湿度 */
.wc-around {
  position: absolute;
  top: 0.5cqh;
  right: 1.6cqw;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
}
.around-temp {
  font-size: 6cqh;           /* = card-h * 0.3 */
  color: #FFFFFF;
}
.around-hum {
  font-size: 6cqh;           /* = card-h * 0.3 */
  color: #FFFFFF;
}
.around-tsp {
  font-size: 2.4cqh;         /* = card-h * 0.12 */
  color: #FFFFFF;
  margin-top: 0.8cqh;         /* 与环境温湿度拉开间距，避免贴太紧 */
}
/* 底部：实时温度(左下) + 描述/图标/最值(其右) */
.wc-bottom {
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  display: flex;
  align-items: flex-end;
  padding-left: 0.4cqw;
}
.weather-temp {
  font-size: 12cqh;          /* = card-h * 0.6 */
  line-height: 1;
  color: #FFFFFF;
  white-space: nowrap;
}
.wc-now {
  margin-left: 0.8cqw;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 0.5cqh;
}
.wc-now-row {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
}
.weather-desc {
  font-size: 5cqh;           /* = card-h * 0.25 */
  color: #FFFFFF;
  white-space: nowrap;
}
.weather-icon {
  font-size: 4cqh;           /* = card-h * 0.2 */
  color: #FFFFFF;
}
.weather-minmax {
  font-size: 4cqh;           /* = card-h * 0.2 */
  margin-top: 0.5cqh;
  color: #FFFFFF;
  white-space: nowrap;
}

/* 7 日预报 */
.day7 {
  flex: 0 0 18cqw;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2cqw;
}
.day7 .day-item {
  border: 0.2cqw solid rgba(255, 255, 255, 0.3);
  border-radius: 1.5cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 0.6cqw 0.2cqw;
  color: #FFFFFF;
  overflow: hidden;
}
.day7 .di-week { font-size: 1.4cqw; }
.day7 .di-date { font-size: 1.4cqw; }
.day7 .di-icon { font-family: 'qweather-icons'; font-size: 2.2cqw; }
.day7 .di-text { font-size: 1.3cqw; text-align: center; }
.day7 .di-temp { font-size: 1.4cqw; }

.qw-font { font-family: 'qweather-icons'; }
