/* ===== 周计划视图专用样式 ===== */

/* --- 整体容器 --- */
.week-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg);
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- 周导航头部 --- */
.week-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding: var(--space-md) 0;
  position: relative;
}

.week-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.week-title {
  font-size: 1.6rem;
  color: var(--color-text);
  position: relative;
}

.week-title::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
  opacity: 0.6;
}

.week-subtitle {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--color-text);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-nav:hover {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  transform: scale(1.05);
}

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

.btn-nav.btn-today {
  width: auto;
  padding: 0 var(--space-lg);
  font-size: 13px;
  font-family: var(--font-body);
  position: absolute;
  right: 0;
}

/* --- 主体布局 --- */
.week-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-xl);
  align-items: start;
}

/* --- 左侧：7天卡片 --- */
.week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-md);
}

/* 日期卡片 */
.day-card {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.day-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.day-card.today {
  border: 2px solid var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-light), var(--shadow-lg);
}

/* 日期头部 */
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px dashed var(--color-border-light);
  background: linear-gradient(135deg, transparent 0%, rgba(232, 180, 184, 0.08) 100%);
}

.day-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
}

.day-date {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

.today-badge {
  background: var(--color-accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 1px;
}

/* 每日备注 */
.day-note-area {
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.day-note-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  min-height: 32px;
  resize: none;
  background: transparent;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.day-note-input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
}

.day-note-input::placeholder {
  color: var(--color-border);
}

/* 时段区域 */
.day-periods {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-sm);
  gap: var(--space-sm);
}

.period-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 80px;
}

.period-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: rgba(0,0,0,0.5);
  font-weight: 500;
}

[data-theme="dark"] .period-bar {
  color: rgba(255,255,255,0.6);
}

.period-icon {
  font-size: 12px;
}

.period-label {
  flex: 1;
}

.period-count {
  font-size: 10px;
  background: rgba(255,255,255,0.4);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.period-items {
  flex: 1;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 40px;
  background: var(--color-surface);
  transition: background var(--transition-fast);
}

.period-items.drag-over {
  background: var(--color-accent-light);
  box-shadow: inset 0 0 0 2px var(--color-accent);
  border-radius: var(--radius-sm);
}

.period-empty {
  text-align: center;
  color: var(--color-border);
  font-size: 11px;
  padding: 8px;
  pointer-events: none;
}

/* 添加按钮 */
.btn-add-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 4px;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  opacity: 0;
  transition: all var(--transition-fast);
}

.period-block:hover .btn-add-item {
  opacity: 1;
}

.btn-add-item:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* 计划事项 */
.plan-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: all var(--transition-fast);
  font-size: 12px;
  position: relative;
}

.plan-item:hover {
  background: var(--color-surface-hover);
  box-shadow: var(--shadow-sm);
}

.plan-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.plan-item.completed {
  opacity: 0.5;
}

.plan-item.completed .item-text {
  text-decoration: line-through;
  color: var(--color-text-secondary);
}

.plan-item.priority-high {
  border-left: 3px solid var(--color-error);
}

.plan-item-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.item-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.item-emoji {
  font-size: 14px;
  flex-shrink: 0;
}

.item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
}

.plan-item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.plan-item:hover .plan-item-actions {
  opacity: 1;
}

.item-tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.btn-item-edit,
.btn-item-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 0;
}

.btn-item-edit:hover {
  background: var(--color-warning-light);
  color: var(--color-warning);
}

.btn-item-delete:hover {
  background: var(--color-error-light);
  color: var(--color-error);
}

/* --- 右侧边栏 --- */
.week-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  position: sticky;
  top: var(--space-lg);
}

.sidebar-card {
  padding: var(--space-lg);
}

/* 胶带装饰 */
.tape {
  display: inline-block;
  width: 40px;
  height: 14px;
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  opacity: 0.7;
  border-radius: 2px;
}

.tape-pink {
  background: linear-gradient(90deg, #f5c6cb 0%, #e8b4b8 50%, #f5c6cb 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tape-yellow {
  background: linear-gradient(90deg, #f5d491 0%, #e8c96a 50%, #f5d491 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  position: relative;
  padding-top: var(--space-sm);
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 15px;
  position: relative;
  display: inline-block;
}

.sidebar-count {
  font-size: 11px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* 侧边栏清单 */
.sidebar-todo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) 0;
  color: var(--color-text-secondary);
  text-align: center;
}

.sidebar-empty p {
  font-size: 13px;
  margin-top: var(--space-sm);
  color: var(--color-text-secondary);
}

.sidebar-empty span {
  font-size: 11px;
  color: var(--color-border);
}

.sidebar-all-done p {
  color: var(--color-success);
}

.sidebar-todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  cursor: grab;
  transition: all var(--transition-fast);
  font-size: 12px;
  border: 1px solid transparent;
}

.sidebar-todo-item:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border);
  transform: translateX(2px);
}

.sidebar-todo-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.sidebar-todo-item.high {
  border-left: 3px solid var(--color-error);
}

.todo-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.todo-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
}

.todo-item-cat {
  font-size: 10px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.sidebar-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px dashed var(--color-border-light);
  font-size: 11px;
  color: var(--color-text-secondary);
}

/* 便签 */
.sticky-note {
  background: linear-gradient(135deg, #fef9e7 0%, #fdf5d7 100%);
  position: relative;
  border: none;
  box-shadow: var(--shadow-md), 2px 2px 0 rgba(0,0,0,0.04);
}

[data-theme="dark"] .sticky-note {
  background: linear-gradient(135deg, #3a3520 0%, #2a2518 100%);
}

.sticky-header {
  position: relative;
  margin-bottom: var(--space-md);
  padding-top: var(--space-sm);
}

.sticky-header h3 {
  font-family: var(--font-display);
  font-size: 15px;
  text-align: center;
}

.sticky-content {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 28px;
  color: var(--color-text);
  resize: vertical;
  outline: none;
}

.sticky-content::placeholder {
  color: var(--color-border);
}

/* 统计卡片 */
.stats-card {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

.stats-title {
  font-family: var(--font-display);
  font-size: 14px;
  margin-bottom: var(--space-md);
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-accent-dark);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success) 0%, var(--color-accent) 100%);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}

/* --- 模态框表单 --- */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row .form-group {
  flex: 1;
}

.priority-selector {
  display: flex;
  gap: var(--space-sm);
}

.priority-btn {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.priority-btn:hover {
  border-color: var(--color-accent);
}

.priority-btn.active {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
  font-weight: 500;
}

/* --- 响应式适配 --- */
@media (max-width: 1200px) {
  .week-layout {
    grid-template-columns: 1fr 240px;
  }
}

@media (max-width: 992px) {
  .week-layout {
    grid-template-columns: 1fr;
  }

  .week-sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    position: static;
  }

  .sticky-note {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .week-days {
    grid-template-columns: 1fr;
  }

  .day-card {
    min-height: auto;
  }

  .week-sidebar {
    grid-template-columns: 1fr;
  }

  .sticky-note {
    grid-column: span 1;
  }

  .week-header {
    gap: var(--space-sm);
  }

  .week-title {
    font-size: 1.2rem;
  }

  .btn-nav.btn-today {
    position: static;
    padding: 0 var(--space-md);
    font-size: 12px;
  }
}

/* 横屏手机适配 */
@media (max-width: 768px) and (orientation: landscape) {
  .week-days {
    grid-template-columns: repeat(2, 1fr);
  }
}
