/* 组件样式：卡片 / 按钮 / 开关 / 时间轴 / 倒计时 / 滚轮 / 浮动按钮 等 */

/* ============ 通用 section ============ */
.section {
  padding: var(--sp-4) var(--sp-4) 0;
}
.section-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 var(--sp-3);
}

/* ============ 主页：玩具卡片 ============ */
.toy-card {
  margin: var(--sp-3) var(--sp-4) 0;
  background: linear-gradient(180deg, #FFFAEF 0%, #FFFFFF 100%);
  border-radius: var(--radius-xl);
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  box-shadow: var(--shadow-card);
}
.toy-card .toy-img {
  width: 130px;
  height: 130px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--brand-yellow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  line-height: 1;
}
.toy-card .toy-sn {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-3);
  letter-spacing: 0.5px;
}
.toy-card .toy-cta {
  display: inline-block;
  margin-top: var(--sp-3);
  background: var(--brand-orange);
  color: white;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
}

/* ============ 主页：音乐播放双列卡片 ============ */
.music-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.music-card {
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  position: relative;
  overflow: hidden;
}
.music-card .label {
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.music-card.kids {
  background: linear-gradient(135deg, #FFD66B 0%, #FFA437 100%);
  color: #fff;
}
.music-card.sleep {
  background: linear-gradient(135deg, #5C73B8 0%, #2D3E6E 100%);
  color: #fff;
}
.music-wrap {
  margin-bottom: 28px;
}

/* ============ 主页：闹钟入口卡片 ============ */
.alarm-entry {
  margin-top: var(--sp-3);
  background: linear-gradient(135deg, #FFE2E2 0%, #FFCDD0 100%);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  position: relative;
  overflow: hidden;
}
.alarm-entry .icon {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  flex-shrink: 0;
}
.alarm-entry .info { flex: 1; }
.alarm-entry .info h4 {
  margin: 0 0 4px;
  font-size: var(--fs-lg);
  color: var(--text-1);
}
.alarm-entry .info p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.alarm-entry .arrow {
  color: var(--text-3);
  font-size: 18px;
}

/* ============ 倒计时卡片（截图红框处） ============ */
.countdown-card {
  margin: var(--sp-3) var(--sp-4) var(--sp-2);
  background: linear-gradient(135deg, #C6D4FF 0%, #A8BAFF 100%);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: #2A3970;
  position: relative;
  overflow: hidden;
  min-height: 80px;
}
.countdown-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}
.countdown-card .clock {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.countdown-card .text { flex: 1; position: relative; z-index: 1; }
.countdown-card .text .label {
  font-size: var(--fs-xs);
  opacity: 0.7;
  margin-bottom: 2px;
}
.countdown-card .text .main {
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: 1.3;
}
.countdown-card .text .main .hl {
  color: var(--accent-red);
  margin: 0 2px;
  font-size: var(--fs-lg);
}
.countdown-card.empty .text .main {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
}

/* ============ 闹钟时间轴 + 列表 ============ */
.alarm-screen {
  display: flex;
  padding: var(--sp-3) 0 var(--sp-4);
  gap: var(--sp-3);
  position: relative;
  min-height: 420px;
}
.timeline {
  width: 56px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
  position: relative;
}
.timeline .clock-icon {
  font-size: 36px;
  line-height: 1;
  z-index: 2;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.1));
}
.timeline .line {
  flex: 1;
  width: 3px;
  background: linear-gradient(180deg, #7CC58A 0%, #FFD66B 50%, #ECEDEF 100%);
  border-radius: 2px;
  margin: 6px 0;
  min-height: 80px;
}
.alarm-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-right: var(--sp-4);
  min-width: 0;
}

/* === 一行的外层容器：承载 row-bell 与可滑动的 alarm-item-wrap === */
.alarm-row {
  position: relative;
}
/* 铃铛：贴在 alarm-row 左侧（探出到时间轴列），不参与左滑 */
.alarm-row .row-bell {
  position: absolute;
  left: -38px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  filter: grayscale(1);
  opacity: 0.4;
  z-index: 3;
  pointer-events: none;
  transition: all 0.2s;
}
.alarm-row .row-bell.on { filter: none; opacity: 1; }

/* 滑动剪裁容器：承载 row-delete（背景层） 与 alarm-item（前景滑动层） */
.alarm-item-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.alarm-item-wrap .row-delete {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 84px;
  background: var(--accent-red);
  color: white;
  font-size: var(--fs-md);
  font-weight: 600;
  border: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.alarm-item-wrap.swiped .alarm-item {
  transform: translateX(-84px);
}

.alarm-item {
  background: var(--surface);
  padding: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  position: relative;
  z-index: 2;
  transition: transform 0.22s ease;
  will-change: transform;
  touch-action: pan-y;
  user-select: none;
}
.alarm-item .cat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}
.alarm-item .info { flex: 1; min-width: 0; }
.alarm-item .info .name {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alarm-item .time {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -1px;
  margin-right: var(--sp-2);
  font-feature-settings: "tnum";
}
.alarm-item.disabled .time,
.alarm-item.disabled .info .name {
  color: var(--text-3);
}

/* 分类色应用 */
.cat-wakeup { background: var(--cat-wakeup-bg); color: var(--cat-wakeup); }
.cat-meal { background: var(--cat-meal-bg); color: var(--cat-meal); }
.cat-study { background: var(--cat-study-bg); color: var(--cat-study); }
.cat-nap { background: var(--cat-nap-bg); color: var(--cat-nap); }
.cat-sport { background: var(--cat-sport-bg); color: var(--cat-sport); }
.cat-custom { background: var(--cat-custom-bg); color: var(--cat-custom); }

/* 开关 */
.switch {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: #E5E7EB;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
  cursor: pointer;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: left 0.2s;
}
.switch.on { background: var(--brand-orange); }
.switch.on::after { left: 20px; }

/* ============ 空态 ============ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-3);
  text-align: center;
}
.empty-state .emoji {
  font-size: 64px;
  margin-bottom: var(--sp-3);
  opacity: 0.7;
}
.empty-state .title {
  font-size: var(--fs-md);
  color: var(--text-2);
  margin-bottom: var(--sp-2);
}
.empty-state .desc {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: var(--sp-5);
  line-height: 1.6;
}
.empty-state .cta {
  background: var(--brand-orange);
  color: white;
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 10px 28px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
}

/* 列表底部使用提示 */
.list-hint {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-3);
  padding: var(--sp-2) var(--sp-4) var(--sp-4);
}

/* ============ 浮动 + 按钮 ============ */
.fab {
  position: absolute;
  right: var(--sp-4);
  bottom: calc(var(--sp-5) + var(--safearea-b));
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--brand-orange);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  font-weight: 300;
  box-shadow: var(--shadow-float);
  z-index: 5;
}

/* ============ 编辑页：表单字段 ============ */
.form-group {
  background: var(--surface);
  margin: var(--sp-3) var(--sp-4) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.form-row {
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-md);
}
.form-row:last-child { border-bottom: none; }
.form-row .label {
  color: var(--text-2);
  flex-shrink: 0;
  margin-right: var(--sp-3);
}
.form-row .value {
  flex: 1;
  text-align: right;
  color: var(--text-1);
}
.form-row input.value {
  text-align: right;
}
.form-row textarea.value {
  text-align: left;
  width: 100%;
  margin-top: var(--sp-2);
  min-height: 60px;
  resize: none;
  font-size: var(--fs-sm);
  color: var(--text-1);
  line-height: 1.6;
}
.form-row.vertical {
  flex-direction: column;
  align-items: flex-start;
}
.form-row.vertical .label { margin-bottom: var(--sp-2); }

/* 时间滚轮 */
.time-wheel {
  background: var(--surface);
  margin: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  position: relative;
  overflow: hidden;
}
.time-wheel .wheel {
  height: 100%;
  width: 80px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  text-align: center;
  position: relative;
  padding: 80px 0;
}
.time-wheel .wheel::-webkit-scrollbar { display: none; }
.time-wheel .wheel .item {
  scroll-snap-align: center;
  height: 40px;
  line-height: 40px;
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--text-3);
  font-feature-settings: "tnum";
  transition: color 0.2s, transform 0.2s;
}
.time-wheel .wheel .item.center {
  color: var(--brand-orange);
  font-size: var(--fs-xxl);
  transform: scale(1.05);
}
.time-wheel .colon {
  font-size: var(--fs-xxl);
  font-weight: 600;
  color: var(--text-2);
  margin: 0 var(--sp-2);
}
.time-wheel .mask-top,
.time-wheel .mask-bottom {
  position: absolute;
  left: 0; right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 2;
}
.time-wheel .mask-top {
  top: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 100%);
  border-bottom: 1px solid var(--divider);
}
.time-wheel .mask-bottom {
  bottom: 0;
  background: linear-gradient(0deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 100%);
  border-top: 1px solid var(--divider);
}

/* 分类选择器 */
.cat-picker {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0 var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-picker::-webkit-scrollbar { display: none; }
.cat-picker .cat-opt {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
}
.cat-picker .cat-opt .ic {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  border: 2px solid transparent;
  transition: border 0.15s, transform 0.15s;
}
.cat-picker .cat-opt.active .ic {
  border-color: var(--brand-orange);
  transform: scale(1.05);
}
.cat-picker .cat-opt .nm {
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.cat-picker .cat-opt.active .nm {
  color: var(--brand-orange);
  font-weight: 600;
}

/* 保存 / 删除 CTA */
.cta-bar {
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + var(--safearea-b));
  background: var(--bg);
}
.cta-primary {
  width: 100%;
  height: 48px;
  background: var(--brand-orange);
  color: white;
  font-size: var(--fs-md);
  font-weight: 600;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
}
.cta-danger {
  width: 100%;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--accent-red);
  padding: var(--sp-3) 0;
  margin-top: var(--sp-2);
}

/* 编辑页顶栏的取消/保存 */
.nav-action {
  font-size: var(--fs-md);
  color: var(--text-2);
}
.nav-action.primary {
  color: var(--brand-orange);
  font-weight: 600;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
