/**
 * P3-2 教学计划 · 样式表
 * 前缀: tp- (teaching-plans)
 */

/* ── 页面容器 ────────────────────────────────────────── */
.tp-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  font-family: inherit;
  color: #333;
}

/* ── 页面标题 ────────────────────────────────────────── */
.tp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.tp-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

/* ── 工具栏 ──────────────────────────────────────────── */
.tp-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
}
.tp-toolbar-left {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tp-toolbar-right {
  display: flex;
  gap: 8px;
}

/* ── 搜索/下拉 ──────────────────────────────────────── */
.tp-search {
  width: 240px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.tp-search:focus {
  border-color: #F18D24;
}
.tp-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  min-width: 140px;
  font-size: 14px;
  outline: none;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s;
}
.tp-select:focus {
  border-color: #F18D24;
}
.tp-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.tp-textarea:focus {
  border-color: #F18D24;
}

/* ── 按钮 ────────────────────────────────────────────── */
.tp-btn {
  padding: 8px 16px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.tp-btn:hover {
  border-color: #F18D24;
  color: #F18D24;
}
.tp-btn-primary {
  background: #F18D24;
  border-color: #F18D24;
  color: #fff;
}
.tp-btn-primary:hover {
  background: #e07d1a;
}
.tp-btn-sm {
  padding: 4px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.tp-btn-sm:hover {
  border-color: #F18D24;
  color: #F18D24;
}
.tp-btn-sm[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
/* 彩色操作按钮（小） */
.tp-btn-sm.tp-btn-danger {
  color: #e74c3c;
  border-color: #e74c3c;
  background: #fff;
}
.tp-btn-sm.tp-btn-danger:hover {
  background: #fff1f0;
  color: #e04343;
}
.tp-btn-sm.tp-btn-success {
  color: #27ae60;
  border-color: #27ae60;
  background: #fff;
}
.tp-btn-sm.tp-btn-success:hover {
  background: #f0fff4;
  color: #219a52;
}
.tp-btn-sm.tp-btn-info {
  color: #3498db;
  border-color: #3498db;
  background: #fff;
}
.tp-btn-sm.tp-btn-info:hover {
  background: #ebf5fb;
  color: #2980b9;
}

/* ── 表格 ────────────────────────────────────────────── */
.tp-table-wrapper {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.tp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tp-table th {
  background: #f1f3f5;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}
.tp-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.tp-table tbody tr:hover {
  background: #f8f9fa;
  cursor: pointer;
}
.tp-table tbody tr.expanded {
  background: #e8f4fd;
}
.tp-table .tp-cell-name {
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-table .tp-cell-actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ── 展开行 ──────────────────────────────────────────── */
.tp-expand-row td {
  padding: 0;
  background: #fafbfc;
}
.tp-expand-content {
  padding: 16px 24px;
}
.tp-expand-content h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: #333;
}
.tp-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}
.tp-items-table th {
  background: #f8f9fa;
  padding: 8px 10px;
  font-weight: 600;
  border-bottom: 1px solid #dee2e6;
  white-space: nowrap;
  font-size: 12px;
  color: #666;
}
.tp-items-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

/* ── 状态徽标 ────────────────────────────────────────── */
.tp-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tp-status-draft {
  background: #e9ecef;
  color: #6c757d;
}
.tp-status-active {
  background: #d4edda;
  color: #155724;
}
.tp-status-completed {
  background: #cce5ff;
  color: #004085;
}
.tp-status-archived {
  background: #e2e3e5;
  color: #383d41;
}

/* ── 类型徽标 ────────────────────────────────────────── */
.tp-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: #f0f0f0;
  color: #666;
}

/* ── 弹窗 ────────────────────────────────────────────── */
.tp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.tp-modal {
  background: #fff;
  border-radius: 12px;
  width: 900px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.tp-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: 12px 12px 0 0;
}
.tp-modal-header h3 {
  margin: 0;
  font-size: 18px;
}
.tp-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0 4px;
  line-height: 1;
}
.tp-modal-close:hover {
  color: #333;
}
.tp-modal-body {
  padding: 24px;
  display: flex;
  gap: 24px;
}
.tp-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: #fff;
}

/* ── 表单左右分区 ────────────────────────────────────── */
.tp-form-left {
  flex: 1;
  min-width: 0;
}
.tp-form-right {
  flex: 1;
  min-width: 0;
  border-left: 1px solid #eee;
  padding-left: 20px;
}
.tp-form-right h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #666;
}

/* ── 表单通用 ────────────────────────────────────────── */
.tp-form-group {
  margin-bottom: 16px;
}
.tp-form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 13px;
  color: #495057;
}
.tp-form-group input,
.tp-form-group select,
.tp-form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.tp-form-group input:focus,
.tp-form-group select:focus,
.tp-form-group textarea:focus {
  border-color: #F18D24;
}
.tp-form-group textarea {
  min-height: 80px;
  resize: vertical;
}
.tp-form-row {
  display: flex;
  gap: 12px;
}
.tp-form-row .tp-form-group {
  flex: 1;
}
.tp-required {
  color: #ff4d4f;
}

/* ── 明细编辑器中的表单项 ────────────────────────────── */
.tp-items-table input,
.tp-items-table textarea {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
}
.tp-items-table input:focus,
.tp-items-table textarea:focus {
  border-color: #F18D24;
}
.tp-items-table textarea {
  resize: vertical;
  min-height: 36px;
}

/* ── 空状态 / 加载 ───────────────────────────────────── */
.tp-empty {
  text-align: center;
  padding: 60px 20px;
  color: #adb5bd;
  font-size: 15px;
}
.tp-loading {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 15px;
}

/* ── 分页 ────────────────────────────────────────────── */
.tp-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}
.tp-page-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.tp-page-btn:hover:not([disabled]) {
  border-color: #F18D24;
  color: #F18D24;
}
.tp-page-btn.active {
  background: #F18D24;
  color: #fff;
  border-color: #F18D24;
}
.tp-page-info {
  color: #6c757d;
  font-size: 13px;
}

/* ── 隐藏 ────────────────────────────────────────────── */
.tp-hidden {
  display: none !important;
}

/* ── 响应式 ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .tp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .tp-toolbar-left {
    flex-direction: column;
  }
  .tp-toolbar-right {
    flex-direction: column;
  }
  .tp-search {
    width: 100%;
  }
  .tp-modal {
    width: 95vw;
  }
  .tp-modal-body {
    flex-direction: column;
  }
  .tp-form-right {
    border-left: none;
    border-top: 1px solid #eee;
    padding-left: 0;
    padding-top: 16px;
  }
}

/* ── 补充：教研计划页专用 ──────────────────────────────── */
.tp-page { padding: 20px; font-family: inherit; color: #333; }
.tp-cell-meta { font-size: 12px; color: #999; }
.tp-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.tp-badge-draft { background: #f5f5f5; color: #999; border: 1px solid #e8e8e8; }
.tp-badge-active { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.tp-badge-done { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tp-badge-archived { background: #fafafa; color: #bfbfbf; border: 1px solid #d9d9d9; }

/* 详情弹窗内 */
.tp-detail { padding: 4px 0; }
.tp-detail-fields { margin-bottom: 12px; }
.tp-detail-row { display: flex; padding: 8px 0; border-bottom: 1px solid #f5f5f5; font-size: 14px; }
.tp-detail-label { width: 80px; flex-shrink: 0; color: #999; }
.tp-detail-desc { font-size: 14px; color: #555; padding: 8px 0; }

/* 超小按钮 */
.tp-btn-xs { padding: 2px 8px; border: 1px solid #d9d9d9; border-radius: 3px; background: #fff; cursor: pointer; font-size: 11px; }
.tp-btn-xs:hover { border-color: #F18D24; color: #F18D24; }

/* 纯文字危险操作 */
.tp-danger-text { color: #ff4d4f; border-color: transparent; background: none; }
.tp-danger-text:hover { color: #e04343; background: #fff1f0; }

/* 紧凑表格 */
.tp-table-sm { font-size: 13px; }
.tp-table-sm th { padding: 6px 10px; font-size: 12px; }
.tp-table-sm td { padding: 6px 10px; }
