/* =========================================================
 * TSGH LTx Manual — Citation Chip + Drawer Styles
 * ========================================================= */

/* ----- Chip ----- */
.cite-chip {
  display: inline-block;
  padding: 0 .35em;
  margin: 0 .1em;
  border-radius: 4px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: .88em;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #bfdbfe;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  user-select: none;
  white-space: nowrap;
}
.cite-chip:hover,
.cite-chip:focus {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
  outline: none;
  transform: translateY(-1px);
}

/* ----- Backdrop ----- */
#cite-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0);
  pointer-events: none;
  transition: background .25s ease;
  z-index: 9000;
}
#cite-backdrop.cite-open {
  background: rgba(15, 23, 42, .45);
  pointer-events: auto;
}

/* ----- Drawer ----- */
#cite-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(440px, 90vw);
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(15, 23, 42, .18);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  z-index: 9100;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}
#cite-drawer.cite-open {
  transform: translateX(0);
}
#cite-drawer[aria-hidden="true"] { visibility: hidden; }
#cite-drawer.cite-open[aria-hidden="false"] { visibility: visible; }

.cite-drawer-header {
  flex: 0 0 auto;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #f8fafc, #ffffff);
}
.cite-drawer-code {
  font-weight: 700;
  font-size: 1rem;
  color: #1d4ed8;
  letter-spacing: .02em;
}
.cite-drawer-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0 .4rem;
  border-radius: 4px;
  transition: background .15s, color .15s;
}
.cite-drawer-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.cite-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 1rem;
  line-height: 1.6;
  color: #1f2937;
  font-size: .95rem;
}

.cite-drawer-title {
  margin: 0 0 .3rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.45;
}
.cite-drawer-subtitle {
  font-size: .86rem;
  color: #64748b;
  margin-bottom: .6rem;
  line-height: 1.4;
}
.cite-drawer-meta {
  font-size: .85rem;
  color: #475569;
  margin-bottom: 1rem;
  padding: .35rem .6rem;
  background: #f1f5f9;
  border-radius: 4px;
  display: inline-block;
}
.cite-drawer-section-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  margin: 1rem 0 .35rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid #e5e7eb;
}
.cite-drawer-summary {
  margin: 0;
  color: #334155;
}
.cite-drawer-doi a {
  color: #1d4ed8;
  text-decoration: none;
  word-break: break-all;
}
.cite-drawer-doi a:hover { text-decoration: underline; }
.cite-drawer-file {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: .82rem;
  color: #475569;
  background: #f8fafc;
  padding: .5rem .7rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  word-break: break-all;
  line-height: 1.4;
}
.cite-drawer-empty {
  padding: 2rem 0;
  text-align: center;
  color: #94a3b8;
  font-size: .92rem;
}

/* ----- Footer 按鈕 ----- */
.cite-drawer-footer {
  flex: 0 0 auto;
  padding: .9rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.cite-btn {
  display: block;
  padding: .65rem 1rem;
  border-radius: 6px;
  font-size: .93rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.cite-btn-open {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
}
.cite-btn-open:hover {
  background: #1e40af;
  color: #fff;
  text-decoration: none;
}
.cite-btn-local {
  background: #fff;
  color: #1d4ed8;
  border-color: #1d4ed8;
}
.cite-btn-local:hover {
  background: #eff6ff;
  color: #1e40af;
  text-decoration: none;
}
.cite-btn-disabled {
  background: #e5e7eb;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  font-weight: 500;
}

/* ----- 手機適配 ----- */
@media (max-width: 640px) {
  #cite-drawer { width: 100vw; }
  .cite-drawer-body { font-size: .9rem; }
}

/* 抽屜開啟時禁止 body 捲動 */
body.cite-drawer-active { overflow: hidden; }
