/* ==========================================================================
   AuraBily — Darkroom / Inspect Lightbox Styles (Layer 07)
   Full-bleed canvas, contained floating toolbar, one-tap pipeline routing,
   swipeable metadata bottom sheet on mobile -> side panel on desktop.
   Zero !important, zero #id selectors.
   ========================================================================== */

.lightbox-content {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: 1360px;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  overflow: hidden;
}

.lightbox-img-box {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a09;
  overflow: hidden;
}

.lightbox-img-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}

/* Contained Floating Inspection Toolbar */
.lightbox-img-toolbar {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  right: 64px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: fit-content;
  max-width: calc(100% - 76px);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(17, 17, 16, 0.86);
  border: 1px solid var(--accent-border);
  box-shadow: var(--shadow-md);
}

.lightbox-img-toolbar::-webkit-scrollbar {
  display: none;
}

.lightbox-img-toolbar > * {
  flex-shrink: 0;
}

.loupe-btn-text {
  display: none;
}

.btn-magnifier-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--ctrl-h-md);
  min-height: var(--ctrl-h-md);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
}

.btn-loupe-zoom {
  min-width: var(--ctrl-h-md);
  min-height: var(--ctrl-h-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-magnifier-toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.lightbox-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(17, 17, 16, 0.72);
  border: 1px solid var(--border-structural);
  color: var(--text-primary);
  font-size: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-carousel-prev {
  left: var(--space-2);
}

.btn-carousel-next {
  right: var(--space-2);
}

.lightbox-carousel-badge {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: rgba(17, 17, 16, 0.8);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.mobile-sheet-pullup-hint {
  position: absolute;
  bottom: var(--space-2);
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--ctrl-h-md);
  min-height: var(--ctrl-h-md);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-overlay);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Metadata Panel (Mobile Bottom Sheet -> Desktop Side Panel) */
.lightbox-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + var(--safe-bottom));
  background: var(--surface-primary);
  border-top: 1px solid var(--border-subtle);
  max-height: 46dvh;
  overflow-y: auto;
}

.lightbox-details.sheet-collapsed {
  max-height: 152px;
  overflow: hidden;
}

.lightbox-sheet-handle-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.lightbox-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

.lightbox-sheet-drag-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.lightbox-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  color: var(--accent);
}

.lightbox-prompt-container {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
}

.lightbox-prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.lightbox-prompt {
  font-size: var(--text-xs);
  color: var(--text-primary);
  line-height: 1.45;
}

.lightbox-prompt.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prompt-expand-btn {
  min-width: var(--ctrl-h-md);
  min-height: var(--ctrl-h-md);
  display: inline-flex;
  align-items: center;
}

.rating-picker span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--ctrl-h-md);
  min-height: var(--ctrl-h-md);
}

.masterpiece-specs-card {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
}

.specs-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.spec-fullwidth {
  grid-column: 1 / -1;
}

.spec-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.spec-val {
  font-size: var(--text-xs);
  color: var(--text-primary);
  word-break: break-word;
}

.rating-section {
  margin-top: var(--space-2);
}

.stars-picker {
  display: flex;
  gap: 6px;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.stars-picker span.active,
.stars-picker span:hover {
  color: var(--accent);
}

/* One-Tap Pipeline Routing & Action Dock */
.lightbox-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.lightbox-actions .btn-danger-link {
  grid-column: 1 / -1;
}

/* 20-Page Assignment Grid inside Page Picker Bottom Sheet */
.page-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.page-picker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
}

.page-picker-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.page-picker-btn small {
  font-size: 0.64rem;
  color: var(--text-muted);
  font-weight: 400;
}

@media (min-width: 1024px) {
  .lightbox-content {
    height: 90dvh;
    max-height: 90dvh;
    flex-direction: row;
    border-radius: var(--radius-lg);
  }

  .loupe-btn-text {
    display: inline;
  }

  .mobile-sheet-pullup-hint,
  .lightbox-sheet-handle-bar {
    display: none;
  }

  .lightbox-details,
  .lightbox-details.sheet-collapsed {
    width: 390px;
    max-height: none;
    height: 100%;
    border-top: none;
    border-left: 1px solid var(--border-subtle);
    padding: var(--space-5);
    overflow-y: auto;
  }
}
