/* ================================
   全局基础
================================ */

body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

/* ================================
   自定义卡片
================================ */

.section-card {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-body-color);

  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;

  padding: 1rem;
}

/* ================================
   成绩单信息行
================================ */

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;

  gap: 0.5rem;
}

/* ================================
   成绩单整体尺寸控制
================================ */

.transcript-parts {
  /* 独立控制三种行高 */
  --toolbar-height: 30px;
  --header-height: 30px;
  --data-row-height: 42px;

  display: flex;
  align-items: flex-start;

  gap: 0;

  width: 100%;
  min-width: 0;

  overflow-x: auto;
  overflow-y: hidden;
}

/* ================================
   每个 Part 独立布局
================================ */

.transcript-part,
.transcript-part * {
  box-sizing: border-box;
}

.transcript-part {
  flex: 0 0 auto;
  width: max-content;

  --part-columns: 80px 185px 50px 50px 250px 55px 70px 70px 70px 70px 70px 70px;
}

/* Part 2 */
.transcript-part[data-group="part2"] {
  --part-columns: 85px 300px 150px 100px;
}

/* Part 3 */
.transcript-part[data-group="part3"] {
  --part-columns: 55px 55px 55px;
}

/* Part 4 */
.transcript-part[data-group="part4"] {
  --part-columns: 55px 55px 55px 55px 55px 55px 55px 55px 55px;
}

/* ================================
   第一行：工具行
================================ */

.part-toolbar {
  display: grid;
  grid-template-columns: var(--part-columns);

  width: max-content;
  height: var(--toolbar-height);

  background-color: var(--bs-tertiary-bg);

  border-top: 1px solid var(--bs-border-color);
  border-left: 1px solid var(--bs-border-color);
  border-right: 1px solid var(--bs-border-color);

  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  overflow: hidden;
}

.part-toolbar input{
   border-radius: 0;
}
.part-toolbar-input-height{
  font-size: 0.7rem;
  height: 20px;
  min-height: 20px;
}

/* 工具栏的启用 checkbox 样式 */
.part-toolbar-priority-checkbox{
  margin-right: 0;
  white-space: nowrap;
}



/* 工具行单元格 */

.focus-cell {
  display: flex;
  align-items: center;
  justify-content: center;

  min-width: 0;
  height: 100%;

  padding: 0.35rem;

  /* border-right: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color); */
  overflow: hidden;
}

/* ================================
   第二行：文字表头
================================ */

.part-header {
  display: grid;
  grid-template-columns: var(--part-columns);

  width: max-content;
  height: var(--header-height);

  background-color: var(--bs-secondary-bg);

  border-top: 1px solid var(--bs-border-color);
  border-left: 1px solid var(--bs-border-color);
}

/* 表头单元格 */

.part-header-cell {
  display: flex;
  align-items: center;
  justify-content: center;

  min-width: 0;
  height: 100%;

  padding: 0.4rem;

  font-weight: 600;
  text-align: center;

  white-space: nowrap;

  background-color: var(--bs-secondary-bg);

  border-right: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
  overflow: hidden;
}

.part-header-cell > span{
   font-size: 0.75rem;
}

.part-header-cell > div > span{
   font-size: 0.75rem;
}

.part-header-2-line span{
  font-size: 0.55rem;
  display: flex;
  flex-direction: column;
}

/* 第一个 span */
.part-header-2-line span:first-child {
  font-size: 0.75rem;
  padding-bottom: 0;
  margin-bottom: 0;
  line-height: 1;
}
/* 第二个 span */
.part-header-2-line span:nth-child(2) {
  font-size: 0.75rem;
  padding-top: 0;
  margin-top: 0;
  line-height: 1;
}

.part-header-tool-box{
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}



/* ================================
   第三行开始：数据区域
================================ */

.part-rows {
  display: flex;
  flex-direction: column;

  width: max-content;
}

/* 每一条成绩数据 */

.part-data-row {
  display: grid;
  grid-template-columns: var(--part-columns);

  width: max-content;
  height: var(--data-row-height);

  border-left: 1px solid var(--bs-border-color);
}

/* 数据单元格 */

.transcript-data-cell {
  display: flex;
  align-items: center;

  min-width: 0;
  height: 100%;

  padding: 0.25rem;

  border-right: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
  overflow: hidden;
}

.transcript-data-cell input{
   border-radius: 0;
}

/* 数据输入框 */

.transcript-data-cell .form-control,
.transcript-data-cell .form-select {
  width: 100%;
  min-width: 0;
}

/* 数据单元格内自定义样式 */
/* 1. 操作栏 */
.row-actions {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.row-actions .btn {
  padding: 2px 5px;
  line-height: 1.2;
}

/* 行号 */
.row-number {
    min-width: 20px;
    text-align: right;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    user-select: none;
}

.move-action-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.move-action-box button {
  border: none;
  background: transparent;
  padding: 0 4px;
  color: var(--bs-secondary-color);
  line-height: 1;
  font-size: 10px;
}
.move-action-box button:hover {
  color: var(--bs-primary);
}

.type-toggle {
  display: flex;
  flex-direction: row;
  width: max-content;
}
.type-toggle > label {
  font-size: 0.7rem;
  padding: 0.2rem 0.35rem;
  white-space: nowrap;
  min-width: 1.5rem;
}

/* ================================
   Part 内容隐藏
================================ */

.part-body.d-none {
  display: none !important;
}

/* ================================
   次要文字
================================ */

.muted-note {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

/* ================================
   表格说明文字
================================ */
.gird-note {
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
}

/* 分数类型 预览 */
.score-type-field {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.score-type-preview {
    font-size: 0.75rem;
    line-height: 1;
    color: #6c757d;
    white-space: pre-line;
}

/* 数据行删除按钮 hover */
[data-action="remove-row"]:hover {
    border-color: rgba(220, 53, 69, 1);
}

/* 单列导入 模态框 行号 */
.import-textarea-wrapper {
    display: flex;
    gap: 8px;
}

.line-num {
    text-align: right;
    white-space: pre-line;
    overflow: hidden;

    padding-top: 0.5rem;

    font-family: monospace;
    line-height: 1.5;
    color: var(--bs-secondary-color);

    user-select: none;
    background: var(--bs-tertiary-bg);
    border-radius: 4px;
    padding: 0.375rem 5px 0 0;
}

#importModalTextarea {
    flex: 1;
    min-width: 0;
    font-family: monospace;
    line-height: 1.5;
}


.form-control-underline {
    border: none;
    border-bottom: 1px solid var(--bs-border-color);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
}

.form-control-underline:focus {
    border-bottom: 2px solid var(--bs-primary);
    box-shadow: none;
}

/* 所有日期input 下拉自定义样式 */
.dropdown-menu-all-date-box{
  width: 290px;
  overflow: hidden;
}

.dropdown-menu-all-date-box > .meta-row > div {
    width: 120px;
}


/* 验证错误：红色边框闪烁 */
.validation-error-flash {
    animation: validationErrorFlash 0.7s ease-in-out 4;
}

@keyframes validationErrorFlash {
    0%, 100% {
        border-color: var(--bs-border-color);
        box-shadow: none;
    }

    50% {
        border-color: var(--bs-danger);
        box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    }
}

/* 验证错误：红色边框整行闪烁 */
.validation-row-flash {
    animation: validationRowFlash 0.7s ease-in-out 4;
}

@keyframes validationRowFlash {

    0%, 100% {
        outline: 2px solid transparent;
        background-color: transparent;
    }

    50% {
        outline: 2px solid var(--bs-danger);
        background-color: rgba(220, 53, 69, 0.12);
    }
}

/* 右侧悬浮工具栏 */
#floating-toolbar {
    z-index: 1030;
    padding: 6px !important;
    gap: 10px !important;
    border-radius: 8px 0 0 8px !important;

    opacity: 0.4;
    transition: opacity 0.2s ease;
}

/* 鼠标悬停时恢复不透明 */
#floating-toolbar:hover,
#floating-toolbar:focus-within {
    opacity: 1;
}

/* 工具栏按钮 */
#floating-toolbar .btn {
    width: 36px;
    height: 36px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 6px;
}

/* Bootstrap Icons */
#floating-toolbar .btn i {
    font-size: 14px;
    line-height: 1;
}

/* 分隔线 */
#floating-toolbar hr {
    margin: 2px 0;
    opacity: 0.2;
}
