/* ========================================
   calendar.css - 日历页面样式
   ======================================== */

.calendar-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.calendar-screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* 顶部导航 */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 8px 0 4px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.calendar-nav__back {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #222;
  cursor: pointer;
}

.calendar-nav__back svg {
  width: 24px;
  height: 24px;
}

.calendar-nav__title {
  font-size: 17px;
  font-weight: 600;
  color: #222;
}

.calendar-nav__right {
  width: 48px;
}

/* 内容区 */
.calendar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 200px 16px; /* 底部留出足够空间，避免内容被截断 */
}

/* 月份导航 */
.calendar-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-month-nav__btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border: none;
  border-radius: 8px;
  color: #222;
  cursor: pointer;
}

.calendar-month-nav__btn svg {
  width: 20px;
  height: 20px;
}

.calendar-month-nav__title {
  font-size: 18px;
  font-weight: 600;
  color: #222;
}

/* 回到今天按钮 */
.calendar-today-btn {
  display: block;
  margin: 0 auto 16px;
  padding: 8px 16px;
  background: #f5f5f5;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
}

/* 日历网格 */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px;
  background: #f8f8f8;
  border-radius: 8px;
  font-size: 14px;
  color: #222;
  cursor: pointer;
  position: relative;
}

.calendar-day__number {
  font-size: 14px;
  margin-bottom: 2px;
}

.calendar-day__avatars {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: auto;
  max-width: 100%;
}

.calendar-day__avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #ddd;
  background-size: cover;
  background-position: center;
  border: 1px solid #fff;
  flex-shrink: 0;
}

.calendar-day__avatar-more {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #666;
  color: #fff;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fff;
  flex-shrink: 0;
}

.calendar-day--header {
  background: transparent;
  font-weight: 600;
  color: #999;
  cursor: default;
}

.calendar-day--other-month {
  color: #ccc;
}

.calendar-day--today {
  background: #007aff;
  color: #fff;
  font-weight: 600;
}

.calendar-day--selected {
  background: #34c759;
  color: #fff;
}

.calendar-day--has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  background: #ff3b30;
  border-radius: 50%;
}

.calendar-day--holiday::before {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: #ff9500;
  border-radius: 50%;
}

/* 详情区 */
.calendar-detail {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  min-height: 120px;
  max-height: none; /* 确保不限制最大高度 */
}

.calendar-detail__date {
  font-size: 16px;
  font-weight: 600;
  color: #222;
  margin-bottom: 12px;
}

.calendar-detail__content {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* 角色行程分组 */
.calendar-schedule-group {
  margin-bottom: 8px;
  background: #f8f8f8;
  border-radius: 8px;
  overflow: hidden;
}

.calendar-schedule-group__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.calendar-schedule-group__header:hover {
  background: #f0f0f0;
}

.calendar-schedule-item__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ddd;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.calendar-schedule-item__character {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  flex: 1;
}

.calendar-schedule-group__count {
  font-size: 12px;
  color: #999;
}

.calendar-schedule-group__arrow {
  font-size: 18px;
  color: #999;
  transition: transform 0.3s;
}

.calendar-schedule-group.is-expanded .calendar-schedule-group__arrow {
  transform: rotate(90deg);
}

/* 行程内容区域 - 默认隐藏 */
.calendar-schedule-group__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.calendar-schedule-group.is-expanded .calendar-schedule-group__content {
  max-height: 2000px; /* 增加最大高度以容纳更多内容 */
}

/* 单条行程详情 */
.calendar-schedule-detail {
  padding: 8px 12px 8px 52px;
  border-top: 1px solid #e8e8e8;
}

.calendar-schedule-detail__time {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.calendar-schedule-detail__title {
  font-size: 13px;
  color: #333;
  font-weight: 500;
  margin-bottom: 2px;
}

.calendar-schedule-detail__desc {
  font-size: 12px;
  color: #999;
  line-height: 1.4;
}

/* 旧样式保留兼容 */
.calendar-schedule-item {
  padding: 12px;
  background: #f8f8f8;
  border-radius: 8px;
  margin-bottom: 8px;
}

.calendar-schedule-item__content {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  padding-left: 40px;
}

.calendar-schedule-item__content {
  color: #666;
  font-size: 13px;
  line-height: 1.5;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.calendar-schedule-item.is-expanded .calendar-schedule-item__content {
  max-height: 500px;
  opacity: 1;
  margin-top: 4px;
}

/* 默认展开行程内容 */
.calendar-schedule-item .calendar-schedule-item__content {
  max-height: 500px;
  opacity: 1;
}

/* 经期管理 */
.calendar-period {
  background: #fff0f5;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 0; /* 确保底部没有额外的margin */
}

.calendar-period__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-period__title {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}

.calendar-period__stats-btn {
  padding: 6px 12px;
  background: #ff69b4;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-period__stats-btn:hover {
  background: #ff1493;
  transform: scale(1.05);
}

.calendar-period__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calendar-period__info {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.calendar-period__btn {
  padding: 10px 16px;
  background: #ff69b4;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
}