/* ============================================
   Components — 所有组件样式
   ============================================ */

/* ---- 导航链接 ---- */
.top-nav__links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 16px;
  padding: var(--gap-xs) var(--gap-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition-normal),
              background var(--transition-normal);
}

.top-nav__links a:hover,
.top-nav__links a.active {
  color: var(--accent-teal-dark);
  background: rgba(100, 160, 158, 0.1);
}

/* ---- 歌词滚动条 ---- */
.lyrics-bar {
  width: 100%;
  height: 48px;
  background: linear-gradient(90deg, var(--accent-teal), var(--accent-teal-dark));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.lyrics-bar__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin: 0 var(--gap-md);
}

.lyrics-bar__inner {
  white-space: nowrap;
  animation: lyrics-scroll 15s linear infinite;
  color: #fff;
  font-size: 18px;
  letter-spacing: 2px;
  padding: 0 var(--gap-lg);
}

@keyframes lyrics-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ---- 弹幕卡片 ---- */
.danmaku-card {
  background: var(--accent-mint);
  border-radius: var(--radius-xl);
  padding: var(--gap-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
}

.danmaku-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.danmaku-card__title {
  font-size: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.danmaku-card__count {
  font-size: 14px;
  color: var(--text-secondary);
}

.danmaku-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.3);
  min-height: 220px;
}

.danmaku-msg {
  position: absolute;
  white-space: nowrap;
  font-size: 15px;
  color: var(--text-primary);
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  animation: danmaku-fly 12s linear forwards;
  pointer-events: none;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.danmaku-msg__author {
  font-weight: bold;
  color: var(--accent-teal-dark);
}

@keyframes danmaku-fly {
  0%   { transform: translateX(105%); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateX(-105%); opacity: 0; }
}

/* ---- 音乐播放器卡片 ---- */
.music-card {
  background: var(--accent-mint);
  border-radius: var(--radius-xl);
  padding: var(--gap-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
  position: relative;
}

.music-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.music-card__title {
  font-size: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.music-card__playlist-btn {
  font-size: 14px;
  color: var(--text-secondary);
  border: none;
  background: rgba(255, 255, 255, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.music-card__playlist-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.music-card__now-playing {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.music-card__cover {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.music-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-card__cover-placeholder {
  width: 36px;
  height: 36px;
  opacity: 0.4;
}

.music-card__track-info {
  flex: 1;
  min-width: 0;
}

.music-card__track-name {
  font-size: 18px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-card__track-artist {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 进度条 */
.music-card__progress {
  margin-bottom: var(--gap-md);
}

.music-card__progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.music-card__progress-fill {
  height: 100%;
  background: var(--accent-teal-dark);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s linear;
}

.music-card__progress-time {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 播放控制 */
.music-card__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-lg);
  margin-bottom: var(--gap-md);
}

.music-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast),
              transform 0.1s ease;
  font-size: 18px;
  color: var(--text-primary);
}

.music-btn:hover {
  background: rgba(255, 255, 255, 0.8);
}

.music-btn:active {
  transform: scale(0.95);
}

.music-btn--play {
  width: 52px;
  height: 52px;
  background: var(--accent-teal-dark);
  color: #fff;
  font-size: 22px;
}

.music-btn--play:hover {
  background: var(--accent-teal);
}

/* 音量 */
.music-card__volume {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  font-size: 14px;
  color: var(--text-secondary);
}

.music-card__volume-slider {
  flex: 1;
  max-width: 100px;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  cursor: pointer;
}

/* 歌单下拉 */
.music-playlist {
  position: absolute;
  top: 48px;
  right: var(--gap-lg);
  background: var(--bg-card-white);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: var(--gap-sm) 0;
  min-width: 200px;
  z-index: 10;
  display: none;
}

.music-playlist--open {
  display: block;
}

.music-playlist__item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--transition-fast);
}

.music-playlist__item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.music-playlist__item--active {
  color: var(--accent-teal-dark);
  font-weight: bold;
}

/* ---- 分类标签 ---- */
.category-tag {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast),
              transform var(--transition-fast);
  box-shadow: var(--shadow-card);
}

.category-tag:hover {
  background: var(--accent-mint);
  transform: scale(1.05);
}

.category-tag__icon {
  width: 28px;
  height: 28px;
  opacity: 0.6;
}

/* ---- 内容卡片 ---- */
.content-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--gap-lg);
  box-shadow: var(--shadow-card);
  min-height: 140px;
}

.content-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.content-card__title {
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.content-card__badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-mint);
  color: var(--text-primary);
}

/* 公告栏 */
.announcement-card__text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  padding: var(--gap-sm) var(--gap-md);
  border-left: 3px solid var(--accent-teal);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.announcement-card__admin-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: var(--gap-sm);
  text-align: right;
}

/* 留言板 */
.guestbook-card__input-area {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}

.guestbook-card__nickname {
  width: 120px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.guestbook-card__input {
  flex: 1;
  min-width: 150px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.guestbook-card__submit {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent-teal-dark);
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background var(--transition-fast);
}

.guestbook-card__submit:hover {
  background: var(--accent-teal);
}

.guestbook-card__nickname.error,
.guestbook-card__input.error {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.05);
}

.guestbook-card__error-msg {
  width: 100%;
  font-size: 12px;
  color: #e74c3c;
  display: none;
}

.guestbook-card__error-msg--visible {
  display: block;
}

.guestbook-card__messages {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.guestbook-msg {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.guestbook-msg__author {
  font-weight: bold;
  color: var(--accent-teal-dark);
  margin-right: 8px;
}

.guestbook-msg__meta {
  float: right;
  font-size: 11px;
  color: var(--text-light);
}

.guestbook-msg__device {
  margin-left: 6px;
  opacity: 0.6;
}

/* 博客卡片 */
.blog-card__list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.blog-card__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  text-decoration: none;
  color: var(--text-primary);
}

.blog-card__item:hover {
  background: rgba(255, 255, 255, 0.8);
}

.blog-card__item-title {
  font-size: 15px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-card__item-date {
  font-size: 13px;
  color: var(--text-light);
  margin-right: var(--gap-md);
  flex-shrink: 0;
}

.blog-card__item-arrow {
  width: 18px;
  height: 18px;
  opacity: 0.4;
  flex-shrink: 0;
}

/* ---- 天气组件 ---- */
.weather-widget {
  background: var(--bg-card-white);
  border-radius: var(--radius-xl);
  padding: var(--gap-lg);
  box-shadow: var(--shadow-card);
}

.weather-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.weather-widget__title {
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.weather-widget__location {
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
}

.weather-widget__main {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
}

.weather-widget__icon {
  width: 64px;
  height: 64px;
}

.weather-widget__temp {
  font-size: 42px;
  font-weight: bold;
  line-height: 1;
}

.weather-widget__desc {
  font-size: 14px;
  color: var(--text-secondary);
}

.weather-widget__details {
  display: flex;
  gap: var(--gap-lg);
  margin-top: var(--gap-md);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---- 日历组件 ---- */
.calendar-widget {
  background: var(--accent-mint);
  border-radius: var(--radius-xl);
  padding: var(--gap-lg);
  box-shadow: var(--shadow-card);
}

.calendar-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.calendar-widget__title {
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.calendar-widget__nav {
  display: flex;
  gap: var(--gap-sm);
}

.calendar-widget__nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.calendar-widget__nav-btn:hover {
  background: rgba(255, 255, 255, 0.8);
}

.calendar-widget__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 13px;
}

.calendar-widget__day-header {
  color: var(--text-secondary);
  padding: 4px 0;
  font-weight: bold;
}

.calendar-widget__day {
  padding: 6px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.calendar-widget__day:hover {
  background: rgba(255, 255, 255, 0.4);
}

.calendar-widget__day--today {
  background: var(--accent-teal-dark);
  color: #fff;
}

.calendar-widget__day--other-month {
  color: var(--text-light);
}

/* ---- 时钟组件 ---- */
.clock-widget {
  background: var(--widget-dark);
  border-radius: var(--radius-xl);
  padding: var(--gap-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
  color: var(--text-on-dark);
}

.clock-widget__label {
  font-size: 14px;
  opacity: 0.6;
  margin-bottom: var(--gap-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
}

.clock-widget__time {
  font-size: 56px;
  font-weight: bold;
  letter-spacing: 4px;
  line-height: 1;
}

.clock-widget__date {
  font-size: 16px;
  opacity: 0.7;
  margin-top: var(--gap-sm);
}

/* ---- 图标占位 ---- */
.icon-placeholder {
  display: inline-block;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  position: relative;
  vertical-align: middle;
}

.icon-placeholder::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  height: 50%;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.12);
}

/* ---- 城市选择弹窗（替换原生 prompt） ---- */
.city-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.city-modal--open {
  display: flex;
}

.city-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  animation: modal-fade-in 0.2s ease;
}

.city-modal__dialog {
  position: relative;
  background: var(--bg-card-white);
  border-radius: var(--radius-xl);
  padding: var(--gap-lg);
  width: 90%;
  max-width: 360px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  animation: modal-slide-up 0.25s ease;
}

.city-modal__title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
}

.city-modal__hint {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: var(--gap-md);
  text-align: center;
}

.city-modal__input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 16px;
  background: var(--bg-page);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.city-modal__input:focus {
  border-color: var(--accent-teal);
}

.city-modal__actions {
  display: flex;
  gap: var(--gap-sm);
  margin-top: var(--gap-md);
}

.city-modal__btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 15px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.city-modal__btn--cancel {
  background: var(--bg-page);
  color: var(--text-secondary);
}

.city-modal__btn--cancel:hover {
  background: var(--bg-card);
}

.city-modal__btn--confirm {
  background: var(--accent-teal-dark);
  color: #fff;
}

.city-modal__btn--confirm:hover {
  background: var(--accent-teal);
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
