/* 文章容器樣式 */
.articles-container {
  --container-max-width: 1400px;
  --container-padding: 20px;
  --hover-transform-distance: -5px;
  --hover-shadow-color: rgba(0, 0, 0, 0.2);
  --hover-shadow-size: 15px;
  --transition-duration: 0.2s;
  --hover-scale: 1.03; /* 移到這裡，確保全域可用 */
  --hover-transform-distance: -5px; /* 懸停時上移距離 */

  max-width: var(--container-max-width);
  padding: var(--container-padding);
  margin: 0 auto;
  width: 100%; /* 確保容器寬度完全填滿 */
  transition: all var(--transition-duration) ease; /* 添加過渡效果 */
}

/* 文章卡片基本樣式 */
.article-card {
  --card-width: 230px;
  --card-height: 280px;
  --card-spacing: 1px;

  width: var(--card-width);
  min-width: var(--card-width);
  max-width: var(--card-width);
  height: var(--card-height);
  margin: var(--card-spacing);
  flex: 0 0 var(--card-width); /* 防止 flex 壓縮 */
}

/* 卡片容器樣式 */
.article-card .card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 圖片容器 */
.card-img-wrapper {
  width: 100%;
  height: 220px; /* 固定高度 */
  background-color: #f8f9fa;
  overflow: hidden;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 確保圖片填滿且不變形 */
}

/* 卡片內容區域 */
.card-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 卡片標題 */
.card-title {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  color: #202124;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 卡片內文 */
.card-text {
  font-size: 14px;
  line-height: 1.5;
  color: #5f6368;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 元資訊區域 */
.card-meta {
  margin-top: auto;
  padding-top: 12px;
  font-size: 14px;
  color: #5f6368;
  border-top: 1px solid #f1f3f4;
}

/* 懸停效果 */
.article-card .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Google 風格的歡迎介面 */
.welcome-section {
  --welcome-spacing: 4rem;
  padding-top: var(--welcome-spacing);
  padding-bottom: calc(var(--welcome-spacing) / 3);
}

.welcome-content {
  margin-bottom: 1rem;
}

.welcome-content h1 {
  color: #202124;
  font-weight: 400;
}

.welcome-content .lead {
  color: #5f6368;
  font-size: 1.25rem;
}

.welcome-actions .btn {
  padding: 0.8rem 2rem;
  border-radius: 2rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.welcome-actions .btn-primary {
  background-color: #1a73e8;
  border-color: #1a73e8;
}

.welcome-actions .btn-primary:hover {
  background-color: #1557b0;
  border-color: #1557b0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.welcome-actions .btn-outline-secondary {
  color: #5f6368;
  border-color: #dadce0;
}

.welcome-actions .btn-outline-secondary:hover {
  background-color: #f8f9fa;
  border-color: #dadce0;
  color: #202124;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* 響應式布局 */
/* 基本樣式 */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px; /* 縮小基本間距 */
  padding: 0 8px;
  transition: all var(--transition-duration) ease;
}

/* 小型手機螢幕 (576px 以下) */
@media (max-width: 576px) {
  .row {
    justify-content: center;
  }
  .article-card {
    flex: 0 0 100%; /* 一行顯示 1 個卡片 */
  }
}

/* 大型手機到平板 (576px - 768px) */
@media (min-width: 577px) and (max-width: 768px) {
  .row {
    justify-content: flex-start;
  }
  .article-card {
    flex: 0 0 calc(50% - 10px); /* 一行顯示 2 個卡片 */
  }
}

/* 平板到小型螢幕 (769px - 992px) */
@media (min-width: 769px) and (max-width: 992px) {
  .row {
    justify-content: flex-start;
  }
  .article-card {
    flex: 0 0 calc(33.333% - 14px); /* 一行顯示 3 個卡片 */
  }
}

/* 中型螢幕 (993px - 1200px) */
@media (min-width: 993px) and (max-width: 1200px) {
  .row {
    justify-content: flex-start;
  }
  .article-card {
    flex: 0 0 calc(25% - 15px); /* 一行顯示 4 個卡片 */
  }
}

/* 大型螢幕 (1200px 以上) */
@media (min-width: 1201px) {
  .row {
    justify-content: flex-start;
  }
  .article-card {
    flex: 0 0 calc(20% - 16px); /* 一行顯示 5 個卡片 */
  }
}
.deadline-card { display: flex; flex-direction: column; gap: .4rem; height: 100%; padding: 1rem; border: 1px solid #dee2e6; border-left: 5px solid #0d6efd; border-radius: .5rem; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.deadline-card-overdue, .deadline-card-late { border-left-color: #dc3545; }
.deadline-card-submitted { border-left-color: #198754; }
.deadline-badge { align-self: flex-start; padding: .2rem .55rem; border-radius: 1rem; color: #fff; background: #0d6efd; font-size: .75rem; }
.deadline-card-overdue .deadline-badge, .deadline-card-late .deadline-badge { background: #dc3545; }
.deadline-card-submitted .deadline-badge { background: #198754; }
.progress-dashboard-card {
  overflow: hidden;
  border: 1px solid #e4e8f0;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 45, 79, 0.08);
}

.progress-dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem;
  color: #fff;
  background: linear-gradient(120deg, #162a5c 0%, #3157d5 65%, #5277e7 100%);
}

.section-eyebrow { color: #c9d5ff; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; }
.progress-dashboard-header h2 { margin: 0.2rem 0; font-size: 1.55rem; font-weight: 650; }
.progress-dashboard-header p { margin: 0; color: rgba(255,255,255,.76); font-size: 0.88rem; }

.completion-ring {
  position: relative;
  display: grid;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#7ee2b8 var(--progress), rgba(255,255,255,.18) 0);
}

.completion-ring::before { position: absolute; width: 72px; height: 72px; border-radius: 50%; background: #3157d5; content: ""; }
.completion-ring div { position: relative; z-index: 1; display: flex; align-items: center; flex-direction: column; line-height: 1.1; }
.completion-ring strong { font-size: 1.25rem; }
.completion-ring span { margin-top: 0.2rem; color: #dce4ff; font-size: 0.65rem; text-transform: uppercase; }

.accomplishment-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border-bottom: 1px solid #e8ebf1; background: #e8ebf1; }
.accomplishment-item { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; background: #fff; }
.accomplishment-item > div { display: flex; flex-direction: column; }
.accomplishment-item strong { color: #24324a; font-size: 1.15rem; line-height: 1.15; }
.accomplishment-item span:last-child { color: #7d8797; font-size: 0.75rem; }
.metric-icon { display: inline-flex; flex: 0 0 2.2rem; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 0.6rem; font-size: 0.8rem; }
.accomplishment-completed .metric-icon { color: #087a52; background: #e4f7ef; }
.accomplishment-progress .metric-icon { color: #2c5bd4; background: #e9efff; }
.accomplishment-overdue .metric-icon, .accomplishment-late .metric-icon { color: #b42318; background: #feeceb; }

.task-timeline-heading { display: flex; align-items: center; justify-content: space-between; padding: 1.4rem 1.6rem 0.8rem; }
.task-timeline-heading h3 { margin: 0 0 0.2rem; color: #24324a; font-size: 1rem; font-weight: 700; }
.task-timeline-heading p { margin: 0; color: #8791a2; font-size: 0.78rem; }
.task-timeline-heading > span { padding: 0.35rem 0.7rem; border-radius: 1rem; color: #3157d5; background: #edf1ff; font-size: 0.72rem; font-weight: 650; }

.task-timeline { display: grid; grid-template-columns: repeat(4, 1fr); padding: 1rem 1.6rem 1.7rem; }
.timeline-step { position: relative; min-width: 0; padding-right: 1rem; }
.timeline-marker { position: relative; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 2.15rem; height: 2.15rem; border: 3px solid #fff; border-radius: 50%; color: #8490a4; background: #e9edf3; box-shadow: 0 0 0 1px #dce1e9; font-size: 0.68rem; }
.timeline-connector { position: absolute; z-index: 1; top: 1.05rem; right: -0.1rem; left: 2rem; height: 2px; background: #dfe4eb; }
.timeline-content { margin-top: 0.75rem; }
.timeline-order { color: #98a1b0; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.timeline-content h4 { overflow: hidden; margin: 0.2rem 0 0.4rem; color: #29374d; font-size: 0.9rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.task-status { display: inline-flex; padding: 0.22rem 0.55rem; border-radius: 1rem; color: #667085; background: #f0f2f5; font-size: 0.68rem; font-weight: 700; }
.timeline-dates { display: flex; margin-top: 0.6rem; flex-direction: column; gap: 0.25rem; color: #7d8797; font-size: 0.68rem; line-height: 1.4; }
.timeline-dates i { width: 0.9rem; margin-right: 0.2rem; text-align: center; }
.timeline-dates .no-deadline { color: #a0a8b5; }

.timeline-completed .timeline-marker { color: #fff; background: #16a574; box-shadow: 0 0 0 1px #16a574; }
.timeline-completed .timeline-connector { background: #65c8a7; }
.timeline-completed .task-status { color: #087a52; background: #e4f7ef; }
.timeline-in-progress .timeline-marker { color: #fff; background: #3157d5; box-shadow: 0 0 0 1px #3157d5; }
.timeline-in-progress .task-status { color: #2455ca; background: #e9efff; }
.timeline-overdue .timeline-marker, .timeline-late .timeline-marker { color: #fff; background: #d92d20; box-shadow: 0 0 0 1px #d92d20; }
.timeline-overdue .task-status, .timeline-late .task-status { color: #b42318; background: #feeceb; }
.timeline-late .timeline-connector { background: #efa49e; }

@media (max-width: 991.98px) {
  .accomplishment-grid { grid-template-columns: repeat(2, 1fr); }
  .task-timeline { grid-template-columns: 1fr; gap: 0; padding-left: 1.75rem; }
  .timeline-step { min-height: 120px; padding: 0 0 1.25rem 3.2rem; }
  .timeline-marker { position: absolute; top: 0; left: 0; }
  .timeline-connector { top: 2rem; bottom: 0; left: 1.05rem; width: 2px; height: auto; }
  .timeline-content { margin-top: 0; }
}

@media (max-width: 575.98px) {
  .dashboard-tabs .nav-link { min-height: 58px; padding: 0.55rem; gap: 0.45rem; }
  .dashboard-tabs .nav-link small { display: none; }
  .dashboard-tabs .nav-link strong { font-size: 0.78rem; }
  .tab-icon { width: 1.8rem; height: 1.8rem; flex-basis: 1.8rem; }
  .progress-dashboard-header { align-items: flex-start; padding: 1.2rem; }
  .completion-ring { width: 76px; height: 76px; }
  .completion-ring::before { width: 60px; height: 60px; }
  .completion-ring strong { font-size: 1rem; }
  .accomplishment-grid { grid-template-columns: 1fr 1fr; }
  .accomplishment-item { padding: 0.85rem; }
  .task-timeline-heading { align-items: flex-start; flex-direction: column; gap: 0.6rem; padding: 1.2rem; }
}
.history-section-heading { margin: 1.75rem 0 1rem; }
.history-section-heading h2 { margin: 0.15rem 0 0.2rem; color: #24324a; font-size: 1.35rem; font-weight: 650; }
.history-section-heading p { margin: 0; color: #7d8797; font-size: 0.85rem; }
.empty-history-card { display: flex; align-items: center; gap: 1rem; padding: 1.35rem; border: 1px dashed #cfd6e2; border-radius: 0.85rem; background: #f9fafc; }
.empty-history-icon { display: inline-flex; flex: 0 0 3rem; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: 0.75rem; color: #3157d5; background: #e9eeff; font-size: 1.2rem; }
.empty-history-card h3 { margin: 0 0 0.2rem; color: #29374d; font-size: 0.95rem; font-weight: 700; }
.empty-history-card p { margin: 0; color: #7d8797; font-size: 0.8rem; }
.dashboard-tabs-shell { margin-bottom: 2rem; }
.dashboard-tabs { margin-bottom: 1rem; padding: 0.35rem; border: 1px solid #e1e6ef; border-radius: 0.9rem; background: #f3f5f9; box-shadow: 0 4px 14px rgba(31,45,79,.05); }
.dashboard-tabs .nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem; padding: 0; }
.dashboard-tabs .nav-link { display: flex; align-items: center; justify-content: center; gap: 0.75rem; min-height: 66px; padding: 0.7rem 1rem; border-radius: 0.68rem; color: #657084; text-align: left; transition: all .18s ease; }
.dashboard-tabs .nav-link:hover:not(.active) { color: #3157d5; background: rgba(255,255,255,.65); }
.dashboard-tabs .nav-link.active { color: #20376f; background: #fff; box-shadow: 0 4px 14px rgba(31,45,79,.1); }
.dashboard-tabs .nav-link > span:last-child { display: flex; flex-direction: column; }
.dashboard-tabs .nav-link strong { font-size: 0.88rem; font-weight: 700; }
.dashboard-tabs .nav-link small { margin-top: 0.1rem; color: #8c96a7; font-size: 0.68rem; }
.dashboard-tabs .nav-link.active small { color: #6f7d98; }
.tab-icon { display: inline-flex; flex: 0 0 2.1rem; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border-radius: 0.6rem; color: #657084; background: #e5e9f0; }
.dashboard-tabs .nav-link.active .tab-icon { color: #fff; background: linear-gradient(135deg, #3157d5, #5277e7); box-shadow: 0 5px 12px rgba(49,87,213,.22); }

.daily-essay-demo { color: #24324a; }
.daily-essay-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding: 1.7rem 1.8rem; border-radius: 1rem 1rem 0 0; color: #fff; background: linear-gradient(115deg, #173152, #285e67 58%, #39927d); }
.daily-essay-kicker { margin-bottom: .55rem; color: #bce5d8; font-size: .68rem; font-weight: 800; letter-spacing: .13em; }
.daily-essay-kicker span { margin-right: .45rem; padding: .2rem .42rem; border-radius: .3rem; color: #173f3a; background: #9ee5cb; letter-spacing: .08em; }
.daily-essay-header h2 { margin: 0 0 .35rem; font-size: clamp(1.35rem, 2.5vw, 2rem); font-weight: 700; }
.daily-essay-header p { max-width: 650px; margin: 0; color: rgba(255,255,255,.74); font-size: .88rem; }
.daily-essay-progress { display: flex; flex: 0 0 auto; align-items: baseline; gap: .35rem; }
.daily-essay-progress strong { font-size: 2rem; line-height: 1; }
.daily-essay-progress span { color: #cbe4df; font-size: .75rem; }
.daily-reminder-banner { display: flex; align-items: center; gap: .8rem; padding: .75rem 1.1rem; border: 1px solid #cfe5df; border-top: 0; color: #285f52; background: #eff8f5; }
.daily-reminder-banner.due { border-color: #f0d5a6; color: #785311; background: #fff8e8; }
.daily-reminder-icon { display: inline-grid; flex: 0 0 2rem; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; color: #fff; background: #3b967e; }
.daily-reminder-banner.due .daily-reminder-icon { background: #e3a62e; }
.daily-reminder-banner > div { min-width: 0; flex: 1; }
.daily-reminder-banner strong { display: block; font-size: .8rem; }
.daily-reminder-banner p { margin: .08rem 0 0; color: #6f817c; font-size: .7rem; }
.daily-reminder-banner time { flex: 0 0 auto; padding: .3rem .55rem; border-radius: 1rem; background: rgba(255,255,255,.7); font-size: .72rem; font-weight: 750; }
.daily-reminder-banner button { display: grid; width: 1.7rem; height: 1.7rem; padding: 0; place-items: center; border: 0; border-radius: 50%; color: #8a7755; background: transparent; }
.daily-reminder-banner button:hover { background: rgba(120,83,17,.08); }
.daily-essay-workspace { display: grid; grid-template-columns: minmax(250px, 31%) 1fr; min-height: 560px; overflow: hidden; border: 1px solid #dfe6e5; border-top: 0; border-radius: 0 0 1rem 1rem; background: #fff; box-shadow: 0 12px 32px rgba(25,55,67,.09); }
.daily-essay-schedule { padding: 1.4rem; border-right: 1px solid #e4eae9; background: #f7faf9; }
.daily-essay-schedule-title { display: flex; align-items: center; justify-content: space-between; }
.daily-essay-schedule-title h3 { margin: 0; font-size: .98rem; font-weight: 750; }
.daily-essay-schedule-title span { color: #2d806e; font-size: .75rem; font-weight: 750; }
.daily-essay-progress-track { height: 5px; margin: .7rem 0 1.35rem; overflow: hidden; border-radius: 1rem; background: #dce8e5; }
.daily-essay-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #3ca083; transition: width .25s ease; }
.daily-essay-week + .daily-essay-week { margin-top: 1.25rem; }
.daily-essay-week h4 { margin: 0 0 .55rem; color: #778580; font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.daily-essay-days { display: grid; grid-template-columns: repeat(7, minmax(28px, 1fr)); gap: .35rem; }
.daily-essay-day { position: relative; display: grid; min-height: 38px; padding: 0; place-items: center; border: 1px solid #dce4e2; border-radius: .5rem; color: #64716d; background: #fff; font-size: .75rem; font-weight: 700; }
.daily-essay-day:hover { border-color: #55a590; color: #247663; }
.daily-essay-day.active { border-color: #2f8b74; color: #fff; background: #2f8b74; box-shadow: 0 4px 10px rgba(47,139,116,.2); }
.daily-essay-day.complete:not(.active) { border-color: #b6dbd0; color: #25735f; background: #e8f5f1; }
.daily-essay-day i { position: absolute; top: 2px; right: 2px; font-size: .48rem; }
.daily-essay-editor { padding: 1.7rem clamp(1.3rem, 4vw, 3rem); }
.daily-essay-editor-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #edf0ef; }
.daily-essay-editor-heading > div > span { color: #33846f; font-size: .65rem; font-weight: 800; letter-spacing: .13em; }
.daily-essay-editor-heading h3 { margin: .18rem 0 0; font-size: 1.25rem; font-weight: 750; }
.daily-essay-state { padding: .28rem .65rem; border-radius: 2rem; color: #7b8582; background: #edf1f0; font-size: .68rem; font-weight: 700; }
.daily-essay-state.complete { color: #1f6f5b; background: #dff2ec; }
.daily-essay-field { position: relative; margin-bottom: 1.15rem; }
.daily-essay-field label { display: block; margin-bottom: .42rem; color: #42514d; font-size: .76rem; font-weight: 750; }
.daily-essay-field input, .daily-essay-field textarea { width: 100%; padding: .78rem .9rem; border: 1px solid #d8e0de; border-radius: .6rem; color: #24324a; background: #fbfcfc; font: inherit; font-size: .86rem; outline: none; transition: border-color .15s, box-shadow .15s; }
.daily-essay-field textarea { min-height: 260px; padding-bottom: 2rem; line-height: 1.65; resize: vertical; }
.daily-essay-field input:focus, .daily-essay-field textarea:focus { border-color: #3b9a81; background: #fff; box-shadow: 0 0 0 3px rgba(59,154,129,.12); }
.daily-essay-word-count { position: absolute; right: .8rem; bottom: .65rem; color: #89938f; font-size: .65rem; }
.daily-essay-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.daily-essay-actions > span { color: #87918e; font-size: .68rem; }
.daily-essay-actions > span i { margin-right: .3rem; }
.daily-essay-actions button { padding: .68rem 1rem; border: 0; border-radius: .55rem; color: #fff; background: #2f8b74; font-size: .78rem; font-weight: 750; box-shadow: 0 5px 12px rgba(47,139,116,.2); }
.daily-essay-actions button:hover { background: #267761; }
.daily-essay-actions button i { margin-right: .35rem; }

@media (max-width: 768px) {
  .daily-essay-header { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .daily-essay-workspace { grid-template-columns: 1fr; }
  .daily-essay-schedule { border-right: 0; border-bottom: 1px solid #e4eae9; }
  .daily-essay-editor { padding: 1.3rem; }
  .daily-reminder-banner { align-items: flex-start; flex-wrap: wrap; }
}
.dashboard-tab-content > .tab-pane > .container-fluid { padding-right: 0 !important; padding-left: 0 !important; }
.dashboard-tab-content .student-progress-section { margin-bottom: 0 !important; }
