/* =========================
   基礎版面
========================= */

html,
body {
  height: 100%;
  overflow: hidden;
}

#sv {
  height: calc(100vh - 64px);
}

@media (max-width: 1024px) {
  #sv {
    height: calc(100vh - 56px);
  }
}

/* =========================
   狀態切換顯示控制
========================= */

.is_logout .is_login,
.is_login .is_logout,
.light #set_dark_mode,
.dark #set_light_mode {
  display: none;
}

/* tab 切換 */
.tab_password > .tab_cookie_content,
.tab_password > .tab_google_content,
.tab_cookie > .tab_password_content,
.tab_cookie > .tab_google_content,
.tab_google > .tab_password_content,
.tab_google > .tab_cookie_content {
  display: none;
}

/* icon 切換 */
s-icon.visibility_off svg.visibility,
s-icon.visibility svg.visibility_off {
  display: none;
}

/* =========================
   搜尋區塊
========================= */

.search_row {
  margin: 0;
  margin-right: auto;
  width: -webkit-fill-available;
}

.search_row > :first-child {
  margin-bottom: 10px;
}

.search_row > *:not(:first-child) {
  margin-left: 20px;
}

.search_result {
  border-collapse: separate;
  border-spacing: 0;
  justify-self: center;
}

.item_row td s-tooltip a {
  border-bottom: 1px dotted;
  color: inherit;
  text-decoration: none;
}

s-text-field {
  display: grid;
  width: -webkit-fill-available;
}

/* =========================
   浮動按鈕
========================= */

.back_icon {
  position: fixed;
  bottom: 30px;
  right: 30px;
}

@media (max-width: 1024px) {
  .back_icon {
    bottom: 10px;
    right: 10px;
  }
}

/* =========================
   邀請碼
========================= */

#invite_code_display {
  background-color: var(--surface-container-highest);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.invite_code {
  user-select: all;
  cursor: pointer;
  font-family: monospace;
  letter-spacing: 2px;
}

#invite_history_table {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
}

#invite_history_table th,
#invite_history_table td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid var(--outline-variant);
}

/* =========================
   Changelog 時間軸
========================= */

.changelog-container {
  padding: 10px 10px 10px 20px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--s-color-outline-variant, #555);
}

.timeline li {
  position: relative;
  padding-left: 24px;
  padding-bottom: 24px;
}

.timeline li:last-child {
  padding-bottom: 0;
}

/* 圓點 */
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--s-color-primary, #009688);
  box-shadow: 0 0 0 4px var(--s-color-surface, #1e1e1e);
}

/* 年份標記 */
.timeline li.year-marker::before {
  background-color: transparent;
  border: 2px solid var(--s-color-primary, #009688);
  left: -8px;
  width: 14px;
  height: 14px;
}

.year-marker .year-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--s-color-primary, #009688);
  margin: -4px 0 12px;
}

.timeline .date-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: bold;
  color: var(--s-color-on-surface);
}

.timeline .content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--s-color-on-surface-variant);
}

/* =========================
   按鈕
========================= */

.btns {
  margin: 2px;
  padding: 6px 12px;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}

.btn-container {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  justify-content: center;
}

/* =========================
   折疊標題
========================= */

.fold-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
}

/* =========================
   表格（桌面）
========================= */

.class_table {
  width: 100%;
  margin: 8px 0;
  border: 1px solid var(--s-color-outline-variant);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  color: var(--s-color-on-surface);
}

.class_table th,
.class_table td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--s-color-outline-variant);
}

.class_table th {
  background-color: var(--s-color-surface-container-high);
}

.class_table tr:last-child td {
  border-bottom: none;
}

/* =========================
   表格（手機版）
========================= */

@media (max-width: 768px) {

  .class_table {
    width: 100% !important;
    margin: 0 auto !important;
    border: none !important;
    border-radius: 0;
    box-sizing: border-box;
  }

  .class_table thead {
    display: none !important;
  }

  .class_table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 8px 8px;
  }

  .class_table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 8px;
    border: 1px solid var(--s-color-outline-variant);
    border-radius: 8px;
    background-color: var(--s-color-surface-container-lowest);
  }

  .class_table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    text-align: right;
    border-bottom: none !important;
  }

  /* 前三欄滿寬 */
  .class_table td:nth-child(1),
  .class_table td:nth-child(2),
  .class_table td:nth-child(3) {
    grid-column: 1 / -1;
  }

  .class_table.has-test-ques td:nth-child(3) {
    border-bottom: 1px dashed var(--s-color-outline-variant) !important;
  }

  /* 測驗 / 問卷 */
  .class_table td:nth-child(4) {
    grid-column: 1 / 2;
    border-right: 1px dashed var(--s-color-outline-variant);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-right: 8px;
  }

  .class_table td:nth-child(5) {
    grid-column: 2 / 3;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-left: 8px;
  }

  .class_table td::before {
    content: attr(data-label);
    font-weight: bold;
    margin-right: 12px;
    opacity: 0.8;
    text-align: left;
    flex-shrink: 0;
  }

  .class_table td:nth-child(4)::before,
  .class_table td:nth-child(5)::before {
    margin: 0 0 8px;
    text-align: center;
  }

  .td-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
    word-break: break-word;
  }

  .class_table td:nth-child(4) .td-content,
  .class_table td:nth-child(5) .td-content {
    align-items: center;
    text-align: center;
  }

  .btns {
    padding: 12px 20px;
    font-size: 1rem;
  }
}