/**
 * 市场工作台优化模块样式 - P1更新
 * 修复最近查看面板响应式问题 + 新增P1功能样式
 */

/* ========== 基础优化样式（保留） ========== */

/* 1. 星标行高亮 */
.starred-row {
  background: linear-gradient(90deg, #fff9e6 0%, #ffffff 100%) !important;
  border-left: 3px solid #ffc107 !important;
}

.starred-row:hover {
  background: linear-gradient(90deg, #fff4d6 0%, #f8f9fa 100%) !important;
}

/* 2. 必填项标记 */
.required-mark {
  color: #ff3b30;
  font-weight: 600;
  margin-left: 2px;
}

/* 3. 周报弹窗 */
.weekly-report-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weekly-report-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.weekly-report-dialog {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.weekly-report-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weekly-report-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.weekly-report-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.weekly-report-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.weekly-report-body {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

.weekly-report-body pre {
  margin: 0;
  font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}

.weekly-report-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.weekly-report-footer button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.weekly-report-copy {
  background: #007aff;
  color: white;
}

.weekly-report-copy:hover {
  background: #0051d5;
}

.weekly-report-close-btn {
  background: #f3f4f6;
  color: #6b7280;
}

.weekly-report-close-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

/* 4. 最近查看面板 - 修复：始终显示，不响应式隐藏 */
.recent-views-panel {
  position: fixed;
  right: 0;
  top: 140px;
  width: 280px;
  background: white;
  border-left: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 8px 0 0 8px;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.05);
  z-index: 100;
  max-height: 400px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.recent-views-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-views-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.recent-views-empty {
  padding: 32px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

.recent-view-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.recent-view-item:hover {
  background: #f3f4f6;
}

.recent-view-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.recent-view-info {
  flex: 1;
  min-width: 0;
}

.recent-view-name {
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-view-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

/* 5. 高亮闪烁动画 */
@keyframes highlight-flash {
  0% {
    background: #fff9e6;
    transform: scale(1);
  }
  50% {
    background: #fff4cc;
    transform: scale(1.01);
  }
  100% {
    background: transparent;
    transform: scale(1);
  }
}

.highlight-flash {
  animation: highlight-flash 2s ease-out;
}

/* 6. 保存并新增按钮 */
.save-and-new-btn {
  padding: 8px 16px;
  background: #34c759;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.save-and-new-btn:hover {
  background: #28a745;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

.save-and-new-btn:active {
  transform: translateY(0);
}

/* 7. 筛选器记忆提示 */
.filter-memory-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 8px;
}

.filter-memory-badge::before {
  content: '✓';
  font-weight: 600;
}

/* 8. 增强的工具栏按钮 */
.apple-command.primary {
  background: linear-gradient(180deg, #007aff 0%, #0051d5 100%);
  color: white;
  font-weight: 600;
  padding: 0 16px;
  height: 32px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.2);
}

.apple-command.primary:hover {
  background: linear-gradient(180deg, #0051d5 0%, #003d99 100%);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
  transform: translateY(-1px);
}

.apple-command.primary:active {
  transform: translateY(0);
}

/* 9. 全字段搜索增强提示 */
.apple-search input::placeholder {
  color: #9ca3af;
  font-size: 13px;
}

/* ========== P1新增功能样式 ========== */

/* 10. Excel导出按钮 */
.apple-command.export {
  background: linear-gradient(180deg, #34c759 0%, #28a745 100%);
  color: white;
  font-weight: 600;
  padding: 0 16px;
  height: 32px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(52, 199, 89, 0.2);
}

.apple-command.export:hover {
  background: linear-gradient(180deg, #28a745 0%, #1e7e34 100%);
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
  transform: translateY(-1px);
}

/* 11. 待办提醒面板 */
.todo-reminder-panel {
  position: fixed;
  right: 300px;
  top: 140px;
  width: 320px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.08);
  z-index: 99;
  max-height: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.todo-reminder-header {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.todo-reminder-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.todo-add-btn {
  width: 28px;
  height: 28px;
  background: #007aff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.todo-add-btn:hover {
  background: #0051d5;
  transform: scale(1.05);
}

.todo-reminder-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.todo-item {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid #007aff;
  cursor: pointer;
  transition: all 0.2s;
}

.todo-item:hover {
  background: #f3f4f6;
  transform: translateX(-2px);
}

.todo-item.overdue {
  border-left-color: #ff3b30;
  background: #fff5f5;
}

.todo-item.today {
  border-left-color: #ff9500;
  background: #fff9f0;
}

.todo-item.completed {
  border-left-color: #34c759;
  background: #f0fff4;
  opacity: 0.7;
}

.todo-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.todo-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.todo-checkbox.checked {
  background: #34c759;
  border-color: #34c759;
  position: relative;
}

.todo-checkbox.checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.todo-item-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
}

.todo-item-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.todo-item-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.todo-item-date.overdue {
  color: #ff3b30;
  font-weight: 500;
}

.todo-item-date.today {
  color: #ff9500;
  font-weight: 500;
}

/* 12. 渠道关联标记 */
.channel-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #e3f2fd;
  color: #1976d2;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.channel-link-badge:hover {
  background: #bbdefb;
  transform: scale(1.05);
}

.channel-link-badge::before {
  content: '🔗';
  font-size: 10px;
}

/* 13. 待办提醒输入表单 */
.todo-form-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.todo-form-dialog {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.todo-form-dialog h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.todo-form-field {
  margin-bottom: 16px;
}

.todo-form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.todo-form-field input,
.todo-form-field textarea,
.todo-form-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}

.todo-form-field input:focus,
.todo-form-field textarea:focus,
.todo-form-field select:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.todo-form-field textarea {
  resize: vertical;
  min-height: 80px;
}

.todo-form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.todo-form-actions button {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.todo-form-save {
  background: #007aff;
  color: white;
}

.todo-form-save:hover {
  background: #0051d5;
}

.todo-form-cancel {
  background: #f3f4f6;
  color: #6b7280;
}

.todo-form-cancel:hover {
  background: #e5e7eb;
  color: #374151;
}

/* 14. 响应式：小屏幕时折叠面板，但不完全隐藏 */
@media (max-width: 1400px) {
  .recent-views-panel {
    width: 60px;
  }
  
  .recent-views-header,
  .recent-view-name,
  .recent-view-meta {
    display: none;
  }
  
  .recent-view-icon {
    font-size: 24px;
    margin: 0 auto;
  }
  
  .recent-view-item {
    justify-content: center;
  }
  
  .todo-reminder-panel {
    right: 80px;
    width: 280px;
  }
}

@media (max-width: 1200px) {
  .todo-reminder-panel {
    display: none; /* 小屏幕隐藏待办面板，但保留最近查看 */
  }
}

/* 15. 深色模式适配 */
@media (prefers-color-scheme: dark) {
  .weekly-report-dialog,
  .recent-views-panel,
  .todo-reminder-panel,
  .todo-form-dialog {
    background: #1f2937;
  }
  
  .weekly-report-header,
  .recent-views-header,
  .todo-reminder-header {
    border-bottom-color: #374151;
  }
  
  .weekly-report-header h3,
  .recent-views-header,
  .todo-reminder-header h4,
  .todo-form-dialog h3 {
    color: #f9fafb;
  }
  
  .weekly-report-body pre {
    color: #e5e7eb;
  }
  
  .weekly-report-footer,
  .todo-form-actions {
    border-top-color: #374151;
  }
  
  .recent-view-item:hover,
  .todo-item:hover {
    background: #374151;
  }
  
  .recent-view-name,
  .todo-item-title {
    color: #f9fafb;
  }
  
  .todo-item {
    background: #374151;
  }
  
  .todo-form-field input,
  .todo-form-field textarea,
  .todo-form-field select {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
}
