/* ==========================================================================
   Quick Review & Live In-Context Translator - Frontend Styling
   ========================================================================== */

/* 元素级整块悬停高亮 */
.qrt-element-hover {
  outline: 2px dashed #2271b1 !important;
  outline-offset: 3px !important;
  cursor: pointer !important;
  background-color: rgba(34, 113, 177, 0.08) !important;
  transition: outline 0.15s ease, background-color 0.15s ease !important;
}

/* 控制台悬浮徽章（默认左下角放置，支持自由拖拽与记忆） */
#qrtFloatingBadge {
  position: fixed;
  bottom: 96px;
  left: 28px;
  right: auto;
  z-index: 9999990;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(24, 29, 34, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f0f0f1;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 12.5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  user-select: none;
  transition: transform 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}
#qrtFloatingBadge.is-collapsed {
  padding: 6px 8px;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  justify-content: center;
  box-sizing: border-box;
}
#qrtFloatingBadge.is-collapsed .qrt-badge-expanded-content {
  display: none !important;
}
.qrt-collapse-trigger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
#qrtFloatingBadge.is-collapsed .qrt-collapse-trigger-btn {
  display: block;
}
.qrt-drag-handle {
  cursor: grab;
  font-size: 14px;
  color: #94a3b8;
  padding: 0 3px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  touch-action: none;
}
.qrt-drag-handle:hover {
  color: #38bdf8;
}
.qrt-drag-handle:active {
  cursor: grabbing;
}
.qrt-btn-minimize {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s ease;
}
.qrt-btn-minimize:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}
#qrtFloatingBadge.is-inactive {
  background: rgba(29, 35, 39, 0.85);
  opacity: 0.92;
}
#qrtFloatingBadge.is-inactive:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
}
.qrt-toggle-btn {
  background: #2271b1;
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s ease, transform 0.15s ease;
}
.qrt-toggle-btn:hover {
  background: #135e96;
}
.qrt-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.qrt-btn-exit {
  background: #dc2626;
  color: #ffffff;
  border: none;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.qrt-btn-exit:hover {
  background: #b91c1c;
  transform: scale(1.02);
}
#qrtFloatingBadge .qrt-count {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 11px;
}
.qrt-badge-link {
  color: #72aee6;
  text-decoration: none;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.qrt-badge-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

/* 核心弹出修改对话框模态层 */
#qrtModalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99999999;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif;
}
#qrtModalBox {
  background: #ffffff;
  color: #1d2327;
  width: 90%;
  max-width: 560px;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: qrtModalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}
@keyframes qrtModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.qrt-modal-header {
  padding: 14px 20px;
  background: #1e293b;
  color: #ffffff;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qrt-modal-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.qrt-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
}
.qrt-modal-close:hover {
  color: #ffffff;
}
.qrt-modal-body {
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}
.qrt-page-badge {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.qrt-page-badge strong {
  color: #0f172a;
}
.qrt-form-group {
  margin-bottom: 16px;
}
.qrt-form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.qrt-diff-en {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: #1e293b;
  font-style: italic;
  line-height: 1.5;
  word-break: break-word;
  max-height: 90px;
  overflow-y: auto;
}
.qrt-diff-old {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: #dc2626;
  line-height: 1.5;
  word-break: break-word;
  max-height: 90px;
  overflow-y: auto;
}
.qrt-input-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid #2563eb;
  border-radius: 6px;
  font-size: 14px;
  color: #0f172a;
  line-height: 1.5;
  resize: vertical;
  min-height: 85px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.qrt-input-textarea:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.qrt-modal-footer {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.qrt-btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.qrt-btn-cancel {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}
.qrt-btn-cancel:hover {
  background: #f1f5f9;
}
.qrt-btn-save {
  background: #2563eb;
  color: #ffffff;
}
.qrt-btn-save:hover {
  background: #1d4ed8;
}
.qrt-btn-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 浮窗台账抽屉 (In-Page Drawer) */
#qrtDrawerOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99999998;
  display: none;
  align-items: center;
  justify-content: flex-end;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif;
}
#qrtDrawerBox {
  background: #ffffff;
  width: 90%;
  max-width: 640px;
  height: 100vh;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  animation: qrtDrawerIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes qrtDrawerIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.qrt-drawer-header {
  padding: 16px 20px;
  background: #1e293b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qrt-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.qrt-drawer-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.qrt-drawer-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: #64748b;
  margin-bottom: 8px;
}
.qrt-drawer-card-en {
  font-size: 12.5px;
  color: #475569;
  font-style: italic;
  margin-bottom: 6px;
}
.qrt-drawer-card-diff {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.qrt-drawer-card-old {
  color: #dc2626;
  text-decoration: line-through;
}
.qrt-drawer-card-new {
  color: #16a34a;
  font-weight: 600;
}

/* 提示 Toast */
.qrt-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #16a34a;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  z-index: 999999999;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.qrt-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 作用范围单选组件 (Scope Selector) */
.qrt-scope-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.qrt-scope-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.qrt-scope-card:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}
.qrt-scope-card.is-selected-location {
  border-color: #16a34a;
  background: #f0fdf4;
}
.qrt-scope-card.is-selected-global {
  border-color: #2563eb;
  background: #eff6ff;
}
.qrt-scope-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}
.qrt-scope-card.is-selected-location .qrt-scope-header {
  color: #15803d;
}
.qrt-scope-card.is-selected-global .qrt-scope-header {
  color: #1d4ed8;
}
.qrt-scope-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}
.qrt-scope-radio {
  display: none;
}
.qrt-scope-badge-rec {
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 500;
}
.qrt-drawer-scope-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
}
.qrt-drawer-scope-badge.is-location {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.qrt-drawer-scope-badge.is-global {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
