/* =========================================
   BV SIDE ASSIST SKELETON
   ========================================= */
.bv-side-launchers {
  position: fixed; top: 50%; right: 0; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px; z-index: 1200; align-items: flex-end;
  transition: opacity 0.2s ease, transform 0.25s ease;
}
.bv-side-launchers.is-hidden { opacity: 0; pointer-events: none; transform: translateY(-50%) translateX(18px); }

.bv-side-launcher {
  writing-mode: vertical-rl; text-orientation: mixed; letter-spacing: 2px;
  border-radius: 12px 0 0 12px; padding: 24px 12px;
}
.bv-side-launcher:hover { padding: 24px 28px 24px 12px; transform: translateX(-2px); }

.bv-side-assist {
  position: fixed; top: 0; right: -500px; width: 430px; max-width: calc(100vw - 20px); height: 100vh;
  background: var(--bv-bg-panel); color: var(--bv-text-main);
  display: flex; flex-direction: column; z-index: 1210;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 1px solid var(--bv-border-main);
}
.bv-side-assist.is-open { right: 0; box-shadow: -10px 0 40px rgba(0,0,0,0.15); }
.bv-side-assist.is-expanded { width: min(760px, 62vw); right: -830px; }
.bv-side-assist.is-open.is-expanded { right: 0; }

.bv-side-assist__header {
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--bv-border-main); background: var(--bv-bg-main);
}

.bv-side-assist__switcher { flex: 1; display: flex; background: var(--bv-bg-input); padding: 4px; border-radius: 8px; gap: 4px; }
.bv-side-assist__tab {
  flex: 1; text-align: center; padding: 8px 12px; font-size: 13px; font-weight: 700;
  color: var(--bv-text-subtle); cursor: pointer; border-radius: 6px; border: none; background: transparent;
}
.bv-side-assist__tab.is-active { background: var(--bv-bg-card); color: var(--bv-accent-primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

.bv-side-assist__close {
  position: relative;
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex: 0 0 38px;
  border: 1px solid var(--bv-border-main);
  border-radius: 999px;
  background: var(--bv-bg-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  /* Hide literal text like CLOSE */
  color: transparent;
  font-size: 0;
  line-height: 0;
  text-indent: -9999px;
  overflow: hidden;
  white-space: nowrap;
}
.bv-side-assist__close::before,
.bv-side-assist__close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--bv-text-main);
  border-radius: 999px;
  transform-origin: center;
}

.bv-side-assist__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.bv-side-assist__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.bv-side-assist__close:hover { background: var(--bv-accent-primary); }
.bv-side-assist__close:hover::before, .bv-side-assist__close:hover::after { background: var(--bv-bg-main); }

.bv-side-assist__view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.bv-side-assist__view.is-active { display: flex; }

.bv-ai-toolbar { padding: 14px 16px 12px; background: var(--bv-bg-panel); border-bottom: 1px solid var(--bv-border-main); display: flex; flex-direction: column; gap: 12px; }
.bv-ai-toolbar__top { display: flex; gap: 10px; align-items: center; }
.bv-ai-mode { display: flex; width: 100%; background: var(--bv-bg-input); padding: 3px; border-radius: 10px; border: 1px solid var(--bv-border-main); }
.bv-ai-mode button { flex: 1; font-size: 11px; font-weight: 800; color: var(--bv-text-subtle); background: transparent; border: none; border-radius: 8px; cursor: pointer; min-height: 30px; }
.bv-ai-mode button.is-active { background: var(--bv-bg-card); color: var(--bv-accent-primary); border: 1px solid var(--bv-border-main); }
.bv-ai-toolbar__label { font-size: 11px; font-weight: 800; color: var(--bv-text-subtle); text-transform: uppercase; }

.bv-ai-chat { flex: 1; padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; background: var(--bv-bg-panel); scroll-behavior: smooth; }
.bv-ai-typing { padding: 0 18px 10px; font-size: 12px; color: var(--bv-text-subtle); font-style: italic; }

.bv-notes-topbar, .bv-notes-list { background: var(--bv-bg-panel); }
.bv-notes-list { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.bv-notes-empty { text-align: center; color: var(--bv-text-subtle); font-size: 13px; margin-top: 40px; }

.bv-note-card { background: var(--bv-bg-card); border: 1px solid var(--bv-border-main); border-radius: 10px; padding: 16px; border-left: 4px solid var(--bv-accent-primary); }
.bv-note-meta { display: flex; gap: 10px; font-size: 10px; font-weight: 700; color: var(--bv-text-subtle); text-transform: uppercase; margin-bottom: 10px; }
.bv-note-meta-tag { background: var(--bv-bg-input); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--bv-border-main); }
.bv-note-title { font-weight: 800; color: var(--bv-text-main); font-size: 14px; margin-bottom: 6px; outline: none; }
.bv-note-body { font-size: 13px; color: var(--bv-text-main); line-height: 1.6; outline: none; white-space: pre-wrap; }
.bv-note-card.is-editing .bv-note-title, .bv-note-card.is-editing .bv-note-body { background: var(--bv-bg-input); padding: 8px; border: 1px dashed var(--bv-accent-primary); }

#cropBox { overflow: hidden; }
.bv-crop-tint, .bv-crop-laser, .bv-crop-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.bv-crop-tint { background: rgba(14, 165, 233, 0.15); }
.bv-crop-laser { top: -10%; left: -10%; width: 120%; height: 4px; background: #ffffff; box-shadow: 0 0 10px 4px var(--bv-accent-primary); }
.bv-crop-flash { background: #ffffff; }

#cropBox.is-scanning { box-shadow: 0 0 0 1px var(--bv-accent-primary); }
#cropBox.is-scanning .bv-crop-laser { animation: bvSweepSweep 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
#cropBox.is-scanning .bv-crop-tint { animation: bvTintPulse 0.8s ease-in-out forwards; }
#cropBox.flash-active .bv-crop-flash { animation: bvCaptureFlash 0.2s ease-out forwards; }

@keyframes bvSweepSweep { 0% { top: -10%; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: 110%; opacity: 0; } }
@keyframes bvTintPulse { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bvCaptureFlash { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* =========================================
   SIDE ASSIST DOCKING
   Move Microfiche slightly, but do not crush it.
========================================= */

body.bv-side-open #viewer.terminal-plate {
  transform: translateX(-60px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

body.bv-side-open.bv-side-expanded #viewer.terminal-plate {
  transform: translateX(-120px);
}

/* Keep the shift smaller on medium screens */
@media (max-width: 1450px) {
  body.bv-side-open #viewer.terminal-plate {
    transform: translateX(-35px);
  }

  body.bv-side-open.bv-side-expanded #viewer.terminal-plate {
    transform: translateX(-70px);
  }
}

/* On smaller screens, assistant overlays instead of pushing */
@media (max-width: 1200px) {
  body.bv-side-open #viewer.terminal-plate,
  body.bv-side-open.bv-side-expanded #viewer.terminal-plate {
    transform: none;
  }

  .bv-side-assist {
    width: min(100vw, 520px);
  }
}
.bv-side-assist__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.bv-side-assist__switcher {
  min-width: 0;
}