/* ==========================================
   攻略预览交互样式 (Strategy Preview)
   ========================================== */

/* 基础过渡 */
.cell {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 样式 A: 聚焦高亮 (默认) */
/* 请假的日子 - 轻微高亮 */
.cell.preview-leave {
  background: rgba(240, 77, 35, 0.12) !important;
  border: 1px solid rgba(240, 77, 35, 0.15) !important;
  z-index: 5;
}

/* 连休的日子 - 连贯显示 (浅底色) */
.cell.preview-rest {
  background: rgba(76, 201, 240, 0.08) !important;
  border: 1px solid rgba(76, 201, 240, 0.15) !important;
  z-index: 4;
}

/* 非高峰期预览样式 */
.cell.preview-leave.offpeak-highlight {
  background: rgba(139, 92, 246, 0.18) !important;
  border-color: rgba(168, 85, 247, 0.35) !important;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.cell.preview-rest.offpeak-highlight {
  background: rgba(168, 85, 247, 0.12) !important;
  border-color: rgba(192, 132, 252, 0.3) !important;
  box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.18);
}

/* 暗色模式适配 */
[data-theme="dark"] .cell.preview-leave {
  background: rgba(240, 77, 35, 0.15) !important;
  border-color: rgba(240, 77, 35, 0.25) !important;
}

[data-theme="dark"] .cell.preview-rest {
  background: rgba(76, 201, 240, 0.12) !important;
  border-color: rgba(76, 201, 240, 0.25) !important;
}

[data-theme="dark"] .cell.preview-leave.offpeak-highlight {
  background: rgba(139, 92, 246, 0.25) !important;
  border-color: rgba(168, 85, 247, 0.45) !important;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35);
}

[data-theme="dark"] .cell.preview-rest.offpeak-highlight {
  background: rgba(168, 85, 247, 0.2) !important;
  border-color: rgba(192, 132, 252, 0.4) !important;
  box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.25);
}

/* 样式 B: 霓虹脉冲 (备选) 
   如果喜欢这个效果，可以将 JS 中的类名改为 'style-neon'
*/
.cell.preview-leave.style-neon {
  animation: neon-pulse 1s infinite alternate;
  border: 2px solid #f04d23 !important;
  background: rgba(240, 77, 35, 0.2) !important;
}
@keyframes neon-pulse {
  from { box-shadow: 0 0 4px #f04d23; }
  to { box-shadow: 0 0 12px #f04d23; }
}


/* 根据 Figma 设计的颜色定义 */
:root {
  --calendar-gap: 8px;
}

/* 月份容器 - 浅色模式（默认） */
.month {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
  width: fit-content;
  box-sizing: border-box;
}

/* 深色模式 - 使用 data-theme 属性 */
[data-theme="dark"] .month {
  background: rgba(26, 31, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* 深色模式 - 使用 prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  .month {
    background: rgba(26, 31, 46, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }
}

/* 月份标题区域 */
.month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.month-header-title {
  font-family: "Avenir Next LT Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 14px;
  color: #4a5660;
  text-align: center;
  flex: 1;
}

[data-theme="dark"] .month-header-title {
  color: #e0e7ff;
}

@media (prefers-color-scheme: dark) {
  .month-header-title {
    color: #e0e7ff;
  }
}

.month-header-btn {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: #4a5660;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  opacity: 0.8;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.month-header-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
  transform: scale(1.05);
}

.month-header-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

[data-theme="dark"] .month-header-btn {
  color: #e0e7ff;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .month-header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
  .month-header-btn {
    color: #e0e7ff;
  }
}

/* 星期标题行 */
.weekday-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--calendar-gap);
  width: 100%;
}

.weekday-label {
  text-align: center;
  font-family: "Avenir Next LT Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 600;
  line-height: 12px;
  letter-spacing: 1.5px;
  color: #b5bec6;
  text-transform: uppercase;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .weekday-label {
  color: #8892a6;
}

@media (prefers-color-scheme: dark) {
  .weekday-label {
    color: #8892a6;
  }
}

/* 日期网格 */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--calendar-gap);
  width: 100%;
}

/* 日期单元格 */
.cell {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-family: "Avenir Next LT Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 18px;
  color: #4a5660;
  background: #fafbfc;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  flex-shrink: 0;
}

[data-theme="dark"] .cell {
  color: #e0e7ff;
  background: #0f1418;
}

@media (prefers-color-scheme: dark) {
  .cell {
    color: #e0e7ff;
    background: #0f1418;
  }
}

.cell:hover:not(.muted) {
  background: rgba(240, 77, 35, 0.1);
  border-color: rgba(240, 77, 35, 0.2);
}

/* 跨月日期（灰显） */
.cell.muted {
  color: #b5bec6;
  opacity: 0.5;
  cursor: default;
  background: transparent;
}

.cell.muted:hover {
  background: transparent;
  border-color: transparent;
}

[data-theme="dark"] .cell.muted {
  color: #8892a6;
}

@media (prefers-color-scheme: dark) {
  .cell.muted {
    color: #8892a6;
  }
}

/* 周末样式 */
.cell.weekend {
  color: var(--calendar-light-text);
}

@media (prefers-color-scheme: dark) {
  .cell.weekend {
    color: var(--calendar-dark-text);
  }
}

/* 假期样式 */
.cell.holiday {
  background: rgba(240, 77, 35, 0.15);
  color: #f04d23;
  font-weight: 600;
  border-color: rgba(240, 77, 35, 0.3);
}

/* 调休上班样式 - 灰色背景+角标 */
.cell.workday {
  background: #f1f5f9;
  color: #64748b;
  font-weight: 500;
  border: 1px solid transparent;
  position: relative;
}

[data-theme="dark"] .cell.workday {
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
}

.cell.workday::after {
  content: '班';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  line-height: 1;
  transform: scale(0.8);
  transform-origin: top right;
  opacity: 0.7;
}

/* 调休上班时不显示默认的tip气泡，因为有角标了，或者保留tip显示具体名字 */
.cell.workday .tip {
  display: none; /* 暂时隐藏tip，避免遮挡，因为“班”字已经足够说明 */
}

/* 请假日期样式 */
.cell.leave-plan {
  background: rgba(240, 77, 35, 0.15);
  color: #f04d23;
  font-weight: 600;
  border-color: rgba(240, 77, 35, 0.3);
  animation: pulsing 1.5s ease-in-out infinite;
}

/* 连休日期样式 */
.cell.rest-day {
  background: rgba(240, 77, 35, 0.1);
  color: #f04d23;
  border-color: rgba(240, 77, 35, 0.2);
}

/* 今天样式 - 增强质感和光影 */
.cell.today {
  background: linear-gradient(135deg, #f04d23 0%, #ff7e5f 100%) !important;
  color: #ffffff !important;
  font-weight: 700;
  border: none !important;
  border-radius: 12px !important; /* 方圆角更符合现代感，或者保持圆形 */
  border-radius: 50% !important;
  font-size: 16px;
  box-shadow: 0 6px 16px rgba(240, 77, 35, 0.4);
  z-index: 2;
  outline: none !important;
  position: relative;
}

.cell.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  display: none; /* 暂时不加点 */
}

.cell.today:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(240, 77, 35, 0.5);
}

/* 闪烁动画 */
@keyframes pulsing {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(240, 77, 35, 0.4);
  }
  50% {
    opacity: 0.85;
    box-shadow: 0 0 8px 2px rgba(240, 77, 35, 0.2);
  }
}

/* 提示气泡 */
.tip {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  color: #4a5660;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e6edf5;
  font-weight: 500;
}

[data-theme="dark"] .tip {
  background: #1a1f2e;
  color: #e0e7ff;
  border-color: #2d3748;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  .tip {
    background: #1a1f2e;
    color: #e0e7ff;
    border-color: #2d3748;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

.cell:hover .tip,
.cell.tip-open .tip {
  opacity: 1;
  pointer-events: auto;
}

/* 浅色模式 - 使用 data-theme */
.month {
  background: #ffffff;
  box-shadow: 2px 16px 19px rgba(0, 0, 0, 0.09);
}

.month-header-title {
  color: #4a5660;
}

.month-header-btn {
  color: #4a5660;
}

.weekday-label {
  color: #b5bec6;
}

.cell {
  color: #4a5660;
  background: #fafbfc;
}

.cell.muted {
  color: #b5bec6;
}

.tip {
  background: #ffffff;
  color: #4a5660;
  border-color: #e6edf5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .month {
  background: #0f1418;
  box-shadow: 2px 16px 19px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .month-header-title {
  color: #e0e7ff;
}

[data-theme="dark"] .month-header-btn {
  color: #e0e7ff;
}

[data-theme="dark"] .weekday-label {
  color: #8892a6;
}

[data-theme="dark"] .cell {
  color: #e0e7ff;
  background: #0f1418;
}

[data-theme="dark"] .cell.muted {
  color: #8892a6;
}

[data-theme="dark"] .tip {
  background: #1a1f2e;
  color: #e0e7ff;
  border-color: #2d3748;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .month {
    padding: 16px;
    gap: 16px;
  }

  .month-header-title {
    font-size: 12px;
  }

  .cell {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .tip {
    bottom: -24px;
    padding: 4px 8px;
    font-size: 9px;
  }
}

/* 布局容器 */
.calendar-body {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: visible; /* 允许阴影显示 */
  position: relative;
  gap: 24px; /* 增加间距，让左右分离 */
}

/* 请假攻略面板 - 升级为独立玻璃卡片 */
.leave-strategy-panel {
  flex: 1;
  /* 移除旧的分割线 */
  border-left: none;
  
  /* 统一卡片风格 */
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
  
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 260px;
  height: fit-content; /* 高度自适应 */
  max-height: 500px; /* 防止过长 */
}

[data-theme="dark"] .leave-strategy-panel {
  /* 深色模式卡片风格 */
  background: rgba(26, 31, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.leave-strategy-panel.hidden {
  display: none;
}

.strategy-empty {
  color: #8892a6;
  text-align: center;
  margin-top: 40px;
  font-size: 14px;
  font-weight: 500;
}

/* 策略卡片样式 */
.strategy-card {
  border: 1px solid rgba(230, 237, 245, 0.6);
  border-radius: 12px;
  padding: 18px;
  background: rgba(250, 251, 252, 0.5); /* 稍微通透 */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.strategy-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(240, 77, 35, 0.3);
  background: #ffffff;
}

[data-theme="dark"] .strategy-card {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .strategy-card:hover {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  border-color: rgba(240, 77, 35, 0.5);
}

.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.strategy-name {
  font-weight: 600;
  color: #4a5660;
  font-size: 15px;
}

[data-theme="dark"] .strategy-name {
  color: #e0e7ff;
}

.strategy-cp {
  font-size: 12px;
  color: #f04d23;
  font-weight: 700;
  background: rgba(240, 77, 35, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
}

.strategy-dates {
  font-size: 13px;
  color: #8892a6;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.strategy-desc {
  font-size: 13px;
  color: #4a5660;
  line-height: 1.5;
}

[data-theme="dark"] .strategy-desc {
  color: #b5bec6;
}

/* 移动端适配 */
@media (max-width: 768px) {
  /* 月份容器 */
  .month {
    padding: 16px;
    gap: 12px;
    border-radius: 12px;
  }

  /* 月份标题 */
  .month-header-title {
    font-size: 13px;
  }

  .month-header-nav {
    gap: 8px;
  }

  .month-header-nav button {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  /* 星期标题 */
  .weekday-header {
    gap: 4px;
  }

  .weekday {
    font-size: 11px;
    width: 36px;
    height: 20px;
  }

  /* 日期网格 */
  .month-grid {
    gap: 4px;
  }

  /* 日期单元格 - 手机端优化 */
  .cell {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: 14px;
    border-radius: 6px;
  }

  .cell.today {
    border-radius: 50% !important;
    font-size: 14px;
  }

  .cell.workday::after {
    font-size: 7px;
    top: 1px;
    right: 1px;
  }

  /* 提示气泡 - 手机端优化 */
  .cell .tip {
    display: none;
  }

  .cell.tip-open .tip {
    display: block;
    font-size: 11px;
    padding: 4px 6px;
    min-width: 60px;
    white-space: nowrap;
  }

  .calendar-body {
    flex-direction: column;
  }

  /* 移动端显示攻略面板，改为上下布局 */
  .leave-strategy-panel {
    display: flex !important;
    border-left: none;
    border-top: 1px solid #e6edf5;
    padding: 12px 0 0 0;
    margin-top: 12px;
    min-width: 100%;
    max-height: auto;
    overflow-y: visible;
  }

  [data-theme="dark"] .leave-strategy-panel {
    border-top-color: #2d3748;
  }

  /* 移动端卡片样式微调 */
  .strategy-card {
    padding: 12px;
  }
}
