/* sidebar.css — shared visual styling for the unified sidebar (Info / PDF /
   Camera). Used by both /viewer/ (3D) and /viewer2d/ (2D).

   Scope: visual rules only (colors, typography, borders, spacing) for
   sidebar-tab chrome, camera panel internals, and PDF panel internals. The
   panel *layout* (fixed-position slide-in in 3D vs CSS grid in 2D) stays in
   each viewer's own stylesheet — this file intentionally does NOT touch
   #panel / #pdf-panel / #camera-panel / #side-panel / #sidebar positioning.

   Link order rule: load this file LAST (after the viewer's own stylesheet)
   so shared rules win any conflict. Two viewers = one source of truth. */

/* ─── Tab bar (Info / PDF / Camera / ✕) ─────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  background: rgba(10, 12, 28, 0.98);
  border-bottom: 1px solid rgba(255,255,255, 0.2);
  flex-shrink: 0;
  gap: 2px;
}
.sidebar-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #a8acb5;
  font-size: 11px;
  font-weight: 500;
  padding: 7px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, color .12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.sidebar-tab:hover  { background: rgba(255,255,255, 0.12); color: #e6e7ea; }
.sidebar-tab.active { background: rgba(211,32,39, 0.15); color: #d32027; }

.sidebar-close {
  background: transparent;
  border: none;
  color: #7c818a;
  font-size: 14px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  transition: background .12s, color .12s;
}
.sidebar-close:hover { background: rgba(232, 70, 70, 0.18); color: #ff8866; }

/* ─── Camera panel internals ────────────────────────────────────────────── */
/* The container is `#camera-body` in 3D and `.camera-body` in 2D — both
   shapes are covered so either markup works. */
#camera-body,
.camera-body {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.camera-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.camera-row select {
  flex: 1;
  padding: 6px 8px;
  background: rgba(22,24,30, 0.9);
  color: #e6e7ea;
  border: 1px solid rgba(255,255,255, 0.25);
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.camera-row select:focus { border-color: rgba(211,32,39, 0.55); }
.camera-row select option { background: #16181d; color: #e6e7ea; }
.camera-row label {
  font-size: 10px;
  color: #7c818a;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}
#camera-aspect { max-width: 110px; }

#camera-video-wrap {
  flex: 1;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 180px;
}
/* Auto mode — native source aspect, letterboxed if needed. */
#camera-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
/* Forced aspect — element sized to the chosen ratio, source cropped via
   object-fit:cover. No stretching — true framing change. */
#camera-video-wrap.forced-aspect { background: rgba(0, 0, 0, 0.55); }
#camera-video-wrap.forced-aspect #camera-video {
  width: auto; height: auto;
  max-width: 100%; max-height: 100%;
  aspect-ratio: var(--cam-aspect, 16/9);
  object-fit: cover;
}

#camera-status {
  position: absolute;
  color: #7c818a;
  font-size: 11px;
  text-align: center;
  padding: 12px;
  line-height: 1.5;
}
#camera-status.error { color: #ff8866; }

#camera-controls { display: flex; gap: 6px; }
#camera-controls button {
  flex: 1;
  background: rgba(255,255,255, 0.1);
  border: 1px solid rgba(255,255,255, 0.25);
  color: #a8acb5;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  transition: background .12s, color .12s;
}
#camera-controls button:hover { background: rgba(255,255,255, 0.22); color: #d32027; }

/* ─── PDF panel internals ───────────────────────────────────────────────── */
#pdf-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255, 0.15);
  flex-shrink: 0;
  gap: 8px;
}
#pdf-header span:first-of-type {
  font-size: 11px;
  color: #d32027;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-right: auto;
}
#pdf-header button {
  background: rgba(255,255,255, 0.1);
  border: 1px solid rgba(255,255,255, 0.2);
  color: #a8acb5;
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  padding: 0;
}
#pdf-header button:hover { background: rgba(255,255,255, 0.2); color: #d32027; }

#pdf-nav {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255, 0.1);
  flex-shrink: 0;
  gap: 6px;
}
#pdf-nav button {
  background: rgba(255,255,255, 0.1);
  border: 1px solid rgba(255,255,255, 0.2);
  color: #a8acb5;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: background .15s, color .15s;
}
#pdf-nav button:hover { background: rgba(255,255,255, 0.2); color: #d32027; }

#pdf-page-info {
  font-size: 11px;
  color: #7c818a;
  min-width: 50px;
  text-align: center;
}
#pdf-page-input {
  width: 44px;
  padding: 3px 4px;
  background: rgba(22,24,30, 0.9);
  color: #e6e7ea;
  border: 1px solid rgba(255,255,255, 0.2);
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
#pdf-page-input::-webkit-outer-spin-button,
#pdf-page-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#pdf-page-input:focus { border-color: rgba(211,32,39, 0.5); }
#pdf-page-total {
  font-size: 11px;
  color: #7c818a;
  min-width: 36px;
}
#pdf-nav input:not(#pdf-page-input) {
  flex: 1;
  padding: 4px 8px;
  background: rgba(22,24,30, 0.9);
  color: #e6e7ea;
  border: 1px solid rgba(255,255,255, 0.2);
  border-radius: 4px;
  font-size: 10px;
  font-family: inherit;
  outline: none;
}
#pdf-nav input:focus { border-color: rgba(211,32,39, 0.5); }

#pdf-zoom-level {
  font-size: 10px;
  color: #7c818a;
  min-width: 35px;
  text-align: center;
}
.pdf-nav-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255, 0.2);
  margin: 0 2px;
}

#pdf-results-bar {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255, 200, 50, 0.2);
  flex-shrink: 0;
  gap: 6px;
  background: rgba(255, 200, 50, 0.05);
}
#pdf-results-bar button {
  background: rgba(255, 200, 50, 0.15);
  border: 1px solid rgba(255, 200, 50, 0.3);
  color: #e8a44a;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: background .15s;
}
#pdf-results-bar button:hover { background: rgba(255, 200, 50, 0.25); }
#pdf-result-info {
  font-size: 11px;
  color: #e8a44a;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}
#pdf-result-ref {
  font-size: 10px;
  color: #d32027;
  font-weight: 600;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pdf-container {
  flex: 1;
  overflow: auto;
  padding: 8px;
  overscroll-behavior: contain;
}
#pdf-container canvas { display: block; margin: 0 auto; }
#pdf-panel.asset-image-mode #pdf-nav,
#pdf-panel.asset-image-mode #pdf-results-bar {
  display: none !important;
}
#asset-image-viewer {
  display: block;
  max-width: none;
  max-height: none;
  margin: 12px auto;
  user-select: none;
  -webkit-user-drag: none;
  border: 1px solid rgba(255,255,255,0.08);
  background: #0c0f14;
}

#pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
}
#pdf-loading .sp,
#pdf-loading .spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(211,32,39, 0.15);
  border-top-color: #d32027;
  border-radius: 50%;
  animation: pdf-spin .7s linear infinite;
}
@keyframes pdf-spin { to { transform: rotate(360deg); } }
#pdf-loading p { color: #7c818a; font-size: 11px; }
#pdf-pct { color: #d32027; font-size: 13px; font-weight: 600; }

#pdf-search-hl {
  position: absolute;
  background: rgba(255, 200, 50, 0.35);
  border: 2px solid rgba(255, 200, 50, 0.8);
  border-radius: 2px;
  pointer-events: none;
  display: none;
}
