/* 时间日记 V2.0 - 自定义样式 */

/* ===================== 基础 ===================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; min-height: 100vh; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  background: #f1f5f9;
}

/* ===================== 动画 ===================== */
.fade-in {
  animation: fadeIn 0.25s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================== 应用容器 ===================== */
.app-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
}

/* ===================== 头部玻璃效果 ===================== */
.glass {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226,232,240,0.6);
}

/* ===================== 自适应布局 ===================== */
@media (min-width: 1024px) {
  .app-container { box-shadow: 0 0 40px rgba(0,0,0,0.06); }
  .main-layout { display: grid; grid-template-columns: 1fr 380px; gap: 0; }
  .main-left { border-right: 1px solid #f1f5f9; min-height: calc(100vh - 56px); }
  .main-right { background: #fafbfb; min-height: calc(100vh - 56px); }
  .review-section { position: sticky; top: 56px; max-height: calc(100vh - 56px); overflow-y: auto; }
}
@media (max-width: 1023px) {
  .main-layout { display: flex; flex-direction: column; }
  .main-left, .main-right { width: 100%; }
}

/* ===================== 时间轴 ===================== */
.timeline-block {
  position: absolute;
  top: 0;
  height: 100%;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
  border-radius: 3px;
  opacity: 0.65; /* V2: 半透明，刻度可见 */
}
.timeline-block:hover {
  filter: brightness(1.12);
  z-index: 10;
  opacity: 1;
}
.timeline-block.selected {
  outline: 2px solid #1e293b;
  outline-offset: -2px;
  z-index: 20;
  opacity: 1;
}

/* 时间刻度层 — V2: 始终在色块之上 */
.day-bar-markers {
  z-index: 30;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0 0 6px 6px;
}

/* ===================== 时间段卡片 ===================== */
.block-card {
  transition: all 0.15s;
}
.block-card:hover {
  transform: translateX(2px);
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.block-card.selected {
  border-color: #1e293b;
  background: #f8fafc;
}

/* ===================== 选择框 ===================== */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
}

/* ===================== 滚动条 ===================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 复选框 ===================== */
.tag-checkbox {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  vertical-align: middle;
}
.tag-checkbox:checked {
  background: #1e293b;
  border-color: #1e293b;
}
.tag-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* ===================== 心情按钮 ===================== */
.mood-btn {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.mood-btn[data-selected="true"] {
  background: #1e293b !important;
  color: #fff !important;
  border-color: #1e293b !important;
}

/* ===================== 标签选择按钮 ===================== */
.tag-select-btn {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.tag-select-btn[data-selected="true"] {
  color: #fff !important;
}

/* ===================== 周视图 ===================== */
.week-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 1024px) {
  .week-grid { grid-template-columns: 1fr 380px; }
}

/* 热力图 */
.heatmap-cell {
  width: 28px;
  height: 18px;
  border-radius: 3px;
  transition: transform 0.1s;
}
.heatmap-cell:hover {
  transform: scale(1.2);
}

/* ===================== Toast ===================== */
#toast {
  z-index: 200;
}

/* ===================== WebRTC 面板 ===================== */
.webrtc-panel {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
}
.webrtc-panel input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
}
.webrtc-panel input:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(129,140,248,0.15);
}
.webrtc-status {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
}

/* ===================== 打印样式 ===================== */
@media print {
  .glass { position: static; }
  .review-section { position: static !important; }
}
