/* 회사관리 > 구글시트 — 목록·등록 모달·뷰어 (2026-08-13) */

/* ── 페이지 헤더 ─────────────────────────────────────── */
.gsh-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.gsh-title { font-size: 1.25rem; font-weight: 700; color: #1f2937; margin: 0 0 4px; }
.gsh-desc { font-size: 0.85rem; color: #6b7280; margin: 0; }
.gsh-new-btn {
  flex-shrink: 0; padding: 8px 14px; border: none; border-radius: 8px;
  background: #3e6187; color: #fff; font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.gsh-new-btn:hover { background: #34526f; }

.gsh-warn {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px;
  background: #fef3c7; border: 1px solid #fcd34d;
}
.gsh-warn p { margin: 0; font-size: 0.85rem; color: #92400e; }

/* ── 목록 ────────────────────────────────────────────── */
.gsh-list { display: flex; flex-direction: column; gap: 8px; }
.gsh-empty {
  padding: 40px 16px; text-align: center; color: #9ca3af;
  border: 1px dashed #d1d5db; border-radius: 10px; background: #fff;
}
.gsh-empty p { margin: 0; font-size: 0.9rem; }
.gsh-empty-sub { margin-top: 6px !important; font-size: 0.8rem !important; }

.gsh-card {
  display: flex; align-items: stretch; gap: 8px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 6px;
}
.gsh-card-main {
  flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 8px 10px; border: none; border-radius: 8px; background: transparent;
  cursor: pointer; text-align: left;
}
.gsh-card-main:hover { background: #f3f7fa; }
.gsh-card-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: #e8f0e9; color: #1e7e46;
}
.gsh-card-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gsh-card-title {
  font-size: 0.95rem; font-weight: 600; color: #1f2937;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gsh-card-meta { font-size: 0.78rem; color: #9ca3af; }
.gsh-card-remove {
  flex-shrink: 0; align-self: center; padding: 6px 12px;
  border: 1px solid #fecaca; border-radius: 8px; background: #fff;
  color: #dc2626; font-size: 0.8rem; cursor: pointer;
}
.gsh-card-remove:hover { background: #fef2f2; }

/* ── 등록 모달 ───────────────────────────────────────── */
.gsh-reg { padding: 16px; }
.gsh-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 18px; }
.gsh-steps > li { font-size: 0.875rem; color: #374151; }
.gsh-step-sub { margin: 6px 0 0; font-size: 0.78rem; color: #9ca3af; }

.gsh-email-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.gsh-email {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px;
  background: #f3f4f6; color: #1f2937; font-size: 0.78rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gsh-copy-btn, .gsh-test-btn {
  flex-shrink: 0; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: #374151; font-size: 0.8rem; cursor: pointer; white-space: nowrap;
}
.gsh-copy-btn:hover, .gsh-test-btn:hover { background: #f9fafb; }
.gsh-copy-btn:disabled, .gsh-test-btn:disabled { opacity: 0.5; cursor: default; }

.gsh-url-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
/* 폼 컨트롤은 배경·글자색 함께 지정 (규칙 10 — 브라우저 강제 다크 대응) */
.gsh-input {
  flex: 1; min-width: 0; width: 100%; padding: 8px 10px; margin-top: 6px;
  border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: #1f2937; font-size: 0.85rem;
}
.gsh-url-row .gsh-input { margin-top: 0; }
.gsh-input:focus { outline: none; border-color: #3e6187; }

.gsh-test-result {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 0.8rem;
}
.gsh-test-result.gsh-test-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.gsh-test-result.gsh-test-fail { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── 뷰어 모달 ───────────────────────────────────────── */
.gsh-viewer { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.gsh-viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid #e5e7eb; background: #f9fafb;
}
.gsh-tabs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; }
.gsh-tab {
  flex-shrink: 0; padding: 6px 12px; border: 1px solid #e5e7eb; border-radius: 8px;
  background: #fff; color: #6b7280; font-size: 0.8rem; cursor: pointer; white-space: nowrap;
}
.gsh-tab:hover { background: #f3f4f6; }
.gsh-tab-active, .gsh-tab-active:hover {
  background: #3e6187; border-color: #3e6187; color: #fff; font-weight: 600;
}
.gsh-viewer-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.gsh-refresh-btn {
  width: 30px; height: 30px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: #374151; font-size: 0.95rem; cursor: pointer;
}
.gsh-refresh-btn:hover { background: #f9fafb; }


/* 배율 컨트롤 */
.gsh-zoom { display: flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; }
.gsh-zoom-btn {
  padding: 5px 9px; border: none; background: #fff; color: #374151;
  font-size: 0.8rem; cursor: pointer; white-space: nowrap;
}
.gsh-zoom-btn + .gsh-zoom-btn { border-left: 1px solid #d1d5db; }
.gsh-zoom-btn:hover { background: #f3f4f6; }
.gsh-zoom-fit { min-width: 52px; text-align: center; color: #6b7280; }

/* PDF 렌더 영역 — 좌측 페이지 썸네일 + 본문 캔버스 스택 (Ctrl+드래그 이동) */
.gsh-pdf-body { flex: 1; min-height: 0; display: flex; }
.gsh-pdf-thumbs {
  flex-shrink: 0; width: 132px; overflow-y: auto; background: #3c4043;
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0;
}
.gsh-pdf-thumbs:empty { display: none; }
.gsh-pdf-thumbs.gsh-thumbs-compact { width: 68px; }
.gsh-thumbs-compact .gsh-thumb canvas { width: 48px !important; height: auto !important; }
.gsh-thumbs-compact .gsh-thumb-home-tile { width: 48px; height: 34px; font-size: 0.62rem; }
.gsh-thumbs-toggle {
  align-self: stretch; margin: 0 10px; padding: 2px 0;
  border: 1px solid #5f6368; border-radius: 6px; background: transparent;
  color: #d1d5db; font-size: 0.8rem; line-height: 1; cursor: pointer;
}
.gsh-thumbs-toggle:hover { background: #5f6368; }
.gsh-thumb {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: none; background: transparent; cursor: pointer; padding: 0;
}
.gsh-thumb canvas {
  background: #fff; border: 2px solid transparent; border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.gsh-thumb:hover canvas { border-color: #9aa0a6; }
.gsh-thumb-active canvas { border-color: #8ab4f8; }
.gsh-thumb-home-tile {
  display: flex; align-items: center; justify-content: center;
  width: 104px; height: 56px; padding: 4px; box-sizing: border-box;
  background: #fff; border: 2px solid transparent; border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-size: 0.78rem; font-weight: 600; color: #1f2937;
  overflow: hidden; text-align: center; word-break: keep-all; line-height: 1.3;
}
.gsh-thumb:hover .gsh-thumb-home-tile { border-color: #9aa0a6; }
.gsh-thumb-num { font-size: 0.72rem; color: #d1d5db; }
.gsh-thumb-active .gsh-thumb-num { color: #8ab4f8; font-weight: 700; }
@media (max-width: 640px) { .gsh-pdf-thumbs { display: none; } }

.gsh-pdf-scroll { flex: 1; min-height: 0; overflow: auto; background: #525659; }
.gsh-pdf-scroll.gsh-panning { cursor: grabbing; user-select: none; }
.gsh-pdf-pages {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 12px; width: max-content; min-width: 100%;
}
.gsh-pdf-page {
  position: relative; background: #fff; flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.gsh-pdf-canvas { display: block; }

/* 투명 텍스트 레이어 (pdf.js TextLayer) — 드래그 선택·복사. 공식 viewer CSS 의 최소 이식 */
.gsh-text-layer {
  position: absolute; inset: 0; overflow: clip; line-height: 1;
  text-align: initial; text-size-adjust: none; forced-color-adjust: none;
  transform-origin: 0 0; caret-color: transparent; z-index: 2;
  pointer-events: none;   /* 컨테이너는 통과 — 아래 이미지 레이어 우클릭(이미지 복사) 허용 */
}
.gsh-text-layer span, .gsh-text-layer br {
  color: transparent; position: absolute; white-space: pre;
  cursor: text; transform-origin: 0% 0%; pointer-events: auto;
}
.gsh-text-layer ::selection { background: rgba(37, 99, 235, 0.3); color: transparent; }

/* 이미지 복사 레이어 — PDF 이미지 객체를 실제 <img> 로 겹침 (우클릭 「이미지 복사」·드래그) */
.gsh-img-copy { position: absolute; z-index: 1; }

/* 링크 핫스팟 — #gid=탭 전환 / 외부 URL=새 탭 */
.gsh-link-hotspot { position: absolute; z-index: 3; cursor: pointer; }
.gsh-link-hotspot:hover { background: rgba(37, 99, 235, 0.12); outline: 1px solid rgba(37, 99, 235, 0.35); }
.gsh-pdf-scroll .gsh-loading { color: #d1d5db; }
.gsh-pdf-scroll .gsh-viewer-error p { color: #fecaca; }
.gsh-loading { padding: 40px; text-align: center; color: #9ca3af; font-size: 0.85rem; }
.gsh-viewer-error { padding: 32px 20px; text-align: center; }
.gsh-viewer-error p { margin: 0 0 6px; font-size: 0.875rem; color: #b91c1c; }

/* 모바일 — 헤더 세로 적층 */
@media (max-width: 640px) {
  .gsh-head { flex-direction: column; }
  .gsh-new-btn { align-self: flex-start; }
}
