/* Exams, Handouts, and Score Table Styles - Eye-Care Soft Palette */

/* ================= Year Selector Tabs ================= */
.year-tabs-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.year-tabs {
  display: flex;
  background: #e5e9f0;
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 5px;
  overflow-x: auto;
}

.year-tab {
  border: none;
  background: transparent;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--slate);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.year-tab:hover {
  color: var(--dark);
}

.year-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(36, 51, 66, 0.08);
}

.year-badge-pill {
  font-size: 0.72rem;
  background: #faefe4;
  color: #a05a18;
  border: 1px solid #ebd3bf;
  padding: 1px 7px;
  border-radius: 12px;
  font-weight: 700;
}

/* ================= Exam Subject Cards Grid ================= */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.exam-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.exam-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.exam-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.exam-subject-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.exam-icon {
  font-size: 1.8rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.exam-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--dark);
}

.exam-meta {
  font-size: 0.82rem;
  color: var(--gray);
  margin-top: 2px;
}

.exam-cutoff-badge {
  background: #faefe4;
  color: #9c5517;
  border: 1px solid #ebd3bf;
  padding: 3px 9px;
  border-radius: 16px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Resource Action Buttons inside Exam Card */
.exam-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.btn-group-row {
  display: flex;
  gap: 7px;
}

.btn-resource {
  flex: 1;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-paper {
  background: #edf3fa;
  color: #2b4c7e;
  border-color: #cbd8ea;
}

.btn-paper:hover {
  background: #e2ecf7;
  color: #1f3b64;
}

.btn-ans {
  background: #ecf5f0;
  color: #246a48;
  border-color: #bfe1ce;
}

.btn-ans:hover {
  background: #e0f0e6;
  color: #1a5236;
}

.btn-analysis {
  background: #f4eef8;
  color: #5d3b88;
  border-color: #dccdeb;
}

.btn-analysis:hover {
  background: #ebe3f3;
  color: #492a6f;
}

.btn-handout {
  background: linear-gradient(135deg, #c07d32, #d4883b);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(192, 125, 50, 0.2);
}

.btn-handout:hover {
  background: linear-gradient(135deg, #b06e25, #c07d32);
  color: #ffffff;
  box-shadow: 0 3px 6px rgba(192, 125, 50, 0.3);
}

/* ================= 5B衝A 講義展示卡片 ================= */
.handouts-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.handout-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  border-top: 4px solid var(--primary);
}

.handout-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.handout-card.chinese { border-top-color: #3b5998; }
.handout-card.english { border-top-color: #2e7d5a; }
.handout-card.math    { border-top-color: #b93838; }
.handout-card.nature  { border-top-color: #2b7a78; }
.handout-card.society { border-top-color: #b46927; }
.handout-card.writing { border-top-color: #6943a5; }

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

.handout-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--dark);
}

.handout-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--slate);
  border: 1px solid #e2e8f0;
}

.handout-desc {
  font-size: 0.85rem;
  color: var(--slate);
  margin-bottom: 14px;
  line-height: 1.55;
}

.handout-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f4f6f8;
  color: var(--slate);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.handout-link-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ================= Score Cutoff Tables ================= */
.table-responsive {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-top: 14px;
}

.cutoff-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.88rem;
  min-width: 680px;
}

.cutoff-table th {
  background: #2b3b4e;
  color: #f8fafc;
  font-weight: 700;
  padding: 11px 14px;
  border-right: 1px solid #3c4f64;
}

.cutoff-table th:last-child {
  border-right: none;
}

.cutoff-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid #f5f6f8;
  color: var(--dark);
}

.cutoff-table tr:hover {
  background: #f8f9fa;
}

.grade-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.78rem;
}

/* 柔和護眼等級標籤 */
.grade-app { background: #fae6e6; color: #8e2a2a; border: 1px solid #f2cccc; }
.grade-ap  { background: #faede4; color: #8e4420; border: 1px solid #f0d5c4; }
.grade-a   { background: #faf2dc; color: #7d5b1b; border: 1px solid #f0e1b8; }
.grade-bpp { background: #e8f1f7; color: #23577d; border: 1px solid #cbe0ef; }
.grade-bp  { background: #eaf3ec; color: #256641; border: 1px solid #cce5d2; }
.grade-b   { background: #f1f3f5; color: #475569; border: 1px solid #e1e4e8; }
.grade-c   { background: #edeef0; color: #64748b; border: 1px solid #dcdfe3; }

/* ================= Download Center Cards ================= */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.download-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}

.download-item:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow-md);
}

.download-info h5 {
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 3px;
}

.download-info p {
  font-size: 0.78rem;
  color: var(--gray);
}

.btn-icon-download {
  background: #f4f6f8;
  color: var(--slate);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all 0.15s;
}

.btn-icon-download:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ================= Schedule Widget on Homepage ================= */
.schedule-preview-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: center;
}

.schedule-preview-info h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 8px;
}

.schedule-preview-info p {
  font-size: 0.9rem;
  color: var(--slate);
  margin-bottom: 14px;
  line-height: 1.6;
}

.schedule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.schedule-tag {
  background: #f4f6f8;
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.schedule-preview-action {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.btn-main-action {
  background: var(--primary);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(43, 76, 126, 0.2);
  transition: all 0.2s;
}

.btn-main-action:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  color: #ffffff;
}

@media (max-width: 800px) {
  .schedule-preview-box {
    grid-template-columns: 1fr;
  }
  .exam-grid {
    grid-template-columns: 1fr;
  }
}

/* Handout Year Pills */
.year-pills {
  display: flex;
  gap: 8px;
}
.year-pill {
  padding: 6px 15px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--slate);
  cursor: pointer;
  transition: all 0.2s ease;
}
.year-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.year-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(43, 76, 126, 0.2);
}
