/* 東海大學教師履歷 — 三欄瀏覽工作區。
   Mirrors the 東海聯絡簿 three-column language: paper sidebar, white list,
   quiet preview pane, flat rows and one navy accent. */

/* ── Layout ── */
.main-wrap {
  display: flex; width: 100%;
  height: calc(100dvh - var(--navbar-height));
  overflow: hidden;
}
.sidebar, .content, .preview { box-shadow: none; border: 0; min-height: 0; }
.sidebar { display: flex; flex-direction: column; flex: 0 0 var(--sidebar-width); background: var(--paper); overflow: hidden; }
/* 中欄預設窄一點（45% → 38%、上限 700 → 620），把空間讓給右邊的教師詳情欄；
   使用者仍可用欄間 resizer 自行拖寬。 */
.content { display: flex; flex-direction: column; flex: 0 1 38%; min-width: 310px; max-width: 620px; background: #fff; }
.preview { display: flex; flex-direction: column; flex: 1 1 0; min-width: 260px; background: #fafbfd; overflow: hidden; }
.preview.hidden { display: none; }

.col-resizer { width: 1px; background: var(--line); flex: 0 0 1px; cursor: col-resize; position: relative; z-index: 10; }
.col-resizer::after { content: ""; position: absolute; inset: 0 -4px; }
.col-resizer:hover, .col-resizer.dragging { background: #7a9dc8; }

/* ── Sidebar ── */
.sidebar-header { padding: 29px 20px 20px; border: 0; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.sidebar-heading > i { color: #6b83a3; font-size: 18px; }
.sidebar-title { margin: 0; font-size: 17px; font-weight: 650; color: var(--ink); letter-spacing: .02em; }
.sidebar-intro { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.sidebar-search { position: relative; }
.sidebar-search > i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.sidebar-search input {
  width: 100%; height: 42px; padding: 0 12px 0 36px;
  background: #fff; border: 1px solid #d9e1eb; border-radius: 7px;
  font-family: inherit; font-size: 13px; color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.sidebar-search input::placeholder { color: var(--muted); opacity: 1; }
.sidebar-search input:focus { outline: none; border-color: #b9d0ef; box-shadow: 0 0 0 3px rgba(26,61,110,.10); }
.dept-tree { flex: 1; overflow-y: auto; padding: 4px 12px 20px; }

.college-header {
  display: flex; align-items: center; gap: 9px; min-height: 43px;
  padding: 10px 11px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: #43546d;
  transition: background .16s, color .16s;
}
.college-header:hover { background: #e6edf7; color: var(--thu-navy); }
.college-header .arrow {
  width: 14px; font-size: 10px; color: #71839a; text-align: center;
  transition: transform .15s;
}
.college-header .arrow.open { transform: rotate(90deg); }
.college-header .college-name { flex: 1; overflow-wrap: anywhere; color: inherit; text-decoration: none; }
.college-header .college-name:hover { text-decoration: underline; color: var(--thu-navy); }
.college-header .count, .dept-item .count {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.dept-children { display: none; margin: 4px 0 10px 17px; padding-left: 12px; border-left: 1px solid #c8d5e6; }
.dept-children.open { display: block; }
.dept-item {
  display: flex; align-items: center; gap: 9px; min-height: 43px;
  padding: 10px 11px; border-radius: 6px; cursor: pointer;
  font-size: 13px; line-height: 1.6; color: #43546d; text-decoration: none;
  transition: background .16s, color .16s;
}
.dept-item:hover { text-decoration: none; color: var(--thu-navy); }
.dept-item:hover { background: #e6edf7; color: var(--thu-navy); }
.dept-item.active { background: #dfeafb; color: var(--thu-navy); font-weight: 650; }
.dept-item .dept-name { flex: 1; white-space: normal; overflow-wrap: anywhere; }
.dept-item .count { margin-left: auto; }
.sidebar-footer {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding: 18px 22px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
.sidebar-footer a { color: var(--muted); text-decoration: none; }
.sidebar-footer a:hover { color: var(--thu-navy); text-decoration: underline; }
.sidebar-loading, .sidebar-empty { padding: 22px 11px; color: var(--muted); font-size: 13px; }

/* ── Content column ── */
.content-header { padding: 30px 28px 23px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.department-heading { display: flex; align-items: center; gap: 8px; }
.dep-title { margin: 0; font-size: 23px; font-weight: 650; line-height: 1.5; letter-spacing: .01em; color: var(--thu-navy); overflow-wrap: anywhere; }
.dep-count { color: var(--muted); font-size: 12px; line-height: 1.9; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dep-count:empty { display: none; }
.content-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

/* Teacher list: continuous white rows like the directory person list */
.teacher-list-compact { list-style: none; margin: 0; padding: 0; }
.teacher-list-compact li, .teacher-list-compact .list-group-item {
  display: block; min-height: 0; padding: 0;
  background: #fff; border: 0 !important; border-bottom: 1px solid #edf0f5 !important;
  border-radius: 0 !important; margin: 0 !important;
  color: var(--ink); font-size: 13px;
  transition: background .16s;
}
.teacher-list-compact .t-row-link {
  display: flex; align-items: center; gap: 14px;
  min-height: 93px; padding: 20px 26px;
  color: inherit; text-decoration: none; cursor: pointer;
}
.teacher-list-compact .t-row-link:hover { text-decoration: none; color: inherit; }
.teacher-list-compact li:hover { background: #f5f8fd; }
.teacher-list-compact li.active { background: var(--selected); }
.t-avatar {
  position: relative; display: grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 12px; overflow: hidden;
  background: #edf2f9 !important; color: #526d91; font-size: 16px; font-weight: 500;
}
.teacher-list-compact li.active .t-avatar { background: #d1e1f7 !important; color: var(--thu-navy); }
.t-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.t-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.t-name { font-size: 16px; font-weight: 600; line-height: 1.6; color: var(--ink); }
.t-role { font-size: 12px; line-height: 1.65; color: var(--muted); overflow-wrap: anywhere; }
.t-view-btn {
  display: grid; place-items: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 7px;
  color: #8c9db3; font-size: 13px;
  transition: background .16s, color .16s;
}
.teacher-list-compact li:hover .t-view-btn { background: var(--selected); color: var(--thu-navy); }
.teacher-list-compact li.active .t-view-btn { color: var(--accent); }

/* Specialty tags inside rows and results */
.sr-spec-tag, .tag {
  display: inline-block; margin: 4px 4px 0 0; padding: 2px 8px;
  border-radius: 5px; background: #edf3fb; color: var(--accent);
  font-size: 12px; line-height: 1.7; cursor: pointer;
}
.sr-spec-tag:hover { background: #dfeafb; color: var(--thu-navy); }
.t-spec-more { font-size: 11px; color: var(--muted); font-weight: 600; }

/* Welcome / empty state (mirrors phone's directory-welcome) */
.welcome { padding: 76px 28px 40px; text-align: center; color: var(--muted); }
.welcome-symbol {
  display: grid; place-items: center; width: 80px; height: 80px;
  margin: 0 auto 28px; border-radius: 24px;
  background: #edf3fc; color: #5078ab; font-size: 34px;
}
.welcome h3 { margin: 0 0 15px; color: var(--ink); font-size: 23px; font-weight: 600; }
.welcome p { margin: 0; font-size: 13px; line-height: 1.95; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.9; }
.empty-state i { display: block; margin-bottom: 14px; font-size: 31px; color: #7890af; }

/* ── Preview pane ── */
.preview-caption {
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
  padding: 33px 26px 27px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.preview-caption i { color: #6981a1; font-size: 16px; }
.preview.has-detail .preview-caption { display: none; }
.preview-header {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  min-height: 70px; padding: 12px 26px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.preview:not(.has-detail) .preview-header { display: none; }
.preview-header .icon { color: #6981a1; }
.preview-header [id="previewTitle"] { color: var(--muted); }
/* 標題列：關閉鈕靠右（原本靠 .pv-btns 的 ms-auto 撐，按鈕搬走後改成標題自己吃掉剩餘空間） */
.preview-header [id="previewTitle"] { margin-right: auto; }

/* ── 完整履歷 CTA ──
   從標題列搬到標題列下方：預覽欄只有 260–380px 寬，塞在標題列裡「完整履歷」會被折成兩行、
   而且和「返回列表」「X」搶空間，最需要點的動作反而最不顯眼。改成整欄寬的實心主要按鈕。 */
.preview-cta { flex-shrink: 0; padding: 16px 26px 0; }
.pv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 12px; border-radius: 7px;
  border: 1px solid #cfdced; background: #fff; color: var(--thu-navy);
  font-size: 12px; text-decoration: none; white-space: nowrap;
  transition: background .16s, border-color .16s;
}
.pv-btn:hover { background: #edf3fc; border-color: #88a6ce; color: var(--thu-navy); text-decoration: none; }
.pv-btn-primary {
  width: 100%; min-height: 44px; padding: 11px 16px; border-radius: 8px;
  border: 1px solid var(--thu-navy); background: var(--thu-navy); color: #fff;
  font-size: 14px; font-weight: 600;
}
.pv-btn-primary:hover { background: #143259; border-color: #143259; color: #fff; }
/* 關閉鈕：X 圖示原本由 Bootstrap 的 .btn-close 提供（移除 Bootstrap 後變成一顆空白方塊，
   只剩瀏覽器預設的灰底＋外框）。這裡自己畫：透明底、無邊框、SVG 的 X，尺寸沿用原本 30×30。 */
.preview-header .btn-close {
  width: 30px; height: 30px; border-radius: 7px; font-size: 11px;
  margin-left: .5rem;              /* 原本是 Bootstrap 的 .ms-2 */
  padding: 0; border: 0; background-color: transparent;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2343546d'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414 1.707 15.707a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px;
  cursor: pointer;
}
/* 注意用 background-color：寫成 background 會把上面的 background-image 洗掉，X 就消失 */
.preview-header .btn-close:hover { background-color: #e8eef6; }
.preview-body { flex: 1; overflow-y: auto; padding: 32px 30px; overscroll-behavior: contain; }
.preview-empty { display: grid; place-content: center; gap: 9px; min-height: 340px; padding: 40px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.preview-empty > i, .preview-empty > .bi { font-size: 31px; color: #7890af; }

/* Word cloud */
#wordCloudContainer { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; }
.wc-tag {
  display: inline-block; padding: 3px 9px; border-radius: 6px; border: 1px solid transparent;
  line-height: 1.6; cursor: pointer; transition: background .15s, border-color .15s;
}
.wc-tag:hover { border-color: #b9d0ef; background: var(--selected) !important; color: var(--thu-navy) !important; }

/* Teacher detail (detail-card pattern from the directory) */
.detail-card { max-width: 430px; margin: 0 auto; animation: detail-in .24s ease-out; }
@keyframes detail-in { from { transform: translateY(6px); } to { transform: none; } }
.tv-photo {
  position: relative; display: grid; place-items: center; overflow: hidden;
  width: 64px; height: 64px; margin: 0 0 22px; border: 0; border-radius: 18px;
  background: #e4edf9 !important; color: var(--thu-navy); font-size: 26px; font-weight: 500;
}
.tv-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tv-name { margin: 0 0 7px; text-align: left; font-size: 28px; font-weight: 600; color: var(--ink); }
.tv-titles { margin-bottom: 22px; text-align: left; color: var(--muted); font-size: 13px; line-height: 1.7; }
.tv-contacts { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin-bottom: 28px; }
.tv-contact-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 5px 10px; border-radius: 6px;
  background: #edf3fa; color: var(--accent); font-size: 13px;
  text-decoration: none; overflow-wrap: anywhere;
}
.tv-contact-chip:hover { background: #dfeafb; color: var(--thu-navy); text-decoration: none; }
.tv-section { margin: 0 0 32px; }
.tv-section-title {
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 600; color: var(--thu-navy);
}
.tv-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tv-table th {
  padding: 8px 8px 8px 0; text-align: left; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tv-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid #edf0f5; vertical-align: top; overflow-wrap: anywhere; }
.tv-table tr:last-child td { border-bottom: 0; }
.tv-spec-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-spec-tag {
  display: inline-block; padding: 5px 10px; border-radius: 6px;
  background: #edf3fb; color: var(--accent); font-size: 13px; cursor: pointer;
  transition: background .15s, color .15s;
}
.tv-spec-tag:hover { background: #dfeafb; color: var(--thu-navy); }
.tv-locked {
  display: flex; align-items: center; gap: 12px;
  padding: 20px; border-radius: 8px; background: var(--paper);
  color: var(--muted); font-size: 13px;
}
.tv-locked .lock-icon { font-size: 18px; }
.tv-loading { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 1100px) and (min-width: 769px) {
  :root { --sidebar-width: 224px; }
  .thu-navbar { padding: 0 20px; gap: 20px; }
  .content { flex-basis: 42%; min-width: 280px; }
  .content-header { padding: 26px 20px 20px; }
  .teacher-list-compact .t-row-link { padding: 18px; gap: 10px; }
  .t-avatar { width: 36px; height: 36px; border-radius: 10px; }
  .preview-body { padding: 28px 20px; }
  .preview-header { padding-inline: 18px; }
  .preview-cta { padding: 14px 18px 0; }
}

.mobile-dept-toggle, .mobile-sidebar-close, .mobile-backdrop, .mobile-back { display: none; }

@media (max-width: 768px) {
  :root { --navbar-height: 112px; }
  .thu-navbar { height: auto; min-height: var(--navbar-height); padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .thu-navbar .navbar-brand { font-size: 18px; gap: 8px; min-height: 44px; }
  .brand-mark { width: 35px; height: 39px; border-radius: 8px; }
  .brand-mark i { font-size: 20px; }
  .brand-subtitle { font-size: 9px; letter-spacing: .02em; }
  .thu-navbar .nav-links { display: none; }
  .thu-navbar .nav-global-search { order: 3; flex: 0 0 100%; max-width: none; }
  .thu-navbar .nav-global-search input { height: 44px; font-size: 16px; }
  .mobile-dept-toggle {
    display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
    min-height: 42px; padding: 7px 11px; border-radius: 7px;
    border: 1px solid #8198b5; background: transparent; color: #fff;
    font-family: inherit; font-size: 13px;
  }
  .mobile-dept-toggle:hover { background: #fff; color: var(--thu-navy); border-color: #fff; }

  .main-wrap { height: auto; min-height: calc(100dvh - var(--navbar-height)); overflow: visible; }
  .col-resizer { display: none; }
  .content { flex: 1 1 auto; min-width: 0; max-width: none; }
  .content-body { overflow: visible; }
  .preview { display: none; }
  .preview.mobile-visible { display: flex; position: fixed; inset: 0; z-index: 1050; width: 100%; height: 100dvh; }
  .preview-caption { display: none; }
  .preview-header { padding: 10px 16px; min-height: 0; gap: 10px; flex-wrap: wrap; }
  .preview-header .btn-close { display: none !important; }
  .preview-header .icon { display: none; }
  .mobile-back {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 0; border: 0; background: transparent;
    color: var(--thu-navy); font-family: inherit; font-size: 13px; cursor: pointer;
  }
  .preview-body { padding: 22px 20px; }
  .preview-cta { padding: 12px 16px 0; }
  .tv-name { font-size: 23px; }
  .tv-photo { display: none; }
  .tv-titles { margin-bottom: 18px; }
  .tv-contacts { margin-bottom: 24px; }
  .tv-table { font-size: 12px; }
  .tv-table th, .tv-table td { padding: 8px 6px 8px 0; white-space: normal !important; }

  .sidebar {
    display: flex; position: fixed; inset: 0 auto 0 0; z-index: 1100;
    width: min(320px, 88vw); height: 100dvh; background: var(--paper);
    transform: translateX(-100%); transition: transform .2s ease-out;
    box-shadow: 8px 0 30px #142b4b30;
  }
  .sidebar.mobile-open { transform: none; }
  .sidebar-header { padding: 20px 16px 14px; }
  .sidebar-search input { height: 44px; font-size: 16px; }
  .dept-item, .college-header { min-height: 49px; font-size: 15px; padding: 12px; }
  .mobile-sidebar-close {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted); font-size: 18px; cursor: pointer;
  }
  .mobile-sidebar-close:hover { background: #e6edf7; color: var(--thu-navy); }
  .mobile-backdrop {
    display: none; position: fixed; inset: 0; z-index: 1090; background: #142b4b80;
  }
  .mobile-backdrop.visible { display: block; }

  .content-header { padding: 18px 20px 16px; }
  .dep-title { font-size: 22px; }
  .teacher-list-compact .t-row-link { padding: 19px 20px; }
  .welcome { padding: 44px 20px 32px; }
  .welcome-symbol { width: 64px; height: 64px; border-radius: 20px; font-size: 28px; margin-bottom: 20px; }
  .welcome h3 { font-size: 20px; }
}
