/**
 * Zone 3 : Right Viewer (public/studio/zones/right-viewer/right-viewer.css)
 * Styles CSS Niveau 3 : Viewport adaptatif, ratios dynamiques, châssis smartphone 9:16 (notch),
 * mode-json-view 16:9 étendu, rideau cinématique, karaoké et stickers néon.
 * Plafond strict < 300 lignes.
 */

.workspace-preview-column {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  position: relative;
  padding: 0;
  margin-left: auto;
  box-sizing: border-box;
}

/* Viewport dynamique (Châssis) */
.workspace-square-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 9 / 16;
  max-height: 100%;
  max-width: 100%;
  height: 100%;
  background: #04060b;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
  transition: aspect-ratio 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

/* Ratios dynamiques */
.workspace-square-viewport.ratio-9-16:not(.mode-json-view),
.workspace-square-viewport.ratio-portrait:not(.mode-json-view) {
  aspect-ratio: 9 / 16;
  height: 100%;
  width: auto;
}

.workspace-square-viewport.ratio-16-9:not(.mode-json-view),
.workspace-square-viewport.ratio-landscape:not(.mode-json-view) {
  aspect-ratio: 16 / 9;
  height: auto;
  width: clamp(420px, 46vw, 720px);
  max-height: 100%;
}

.workspace-square-viewport.ratio-1-1:not(.mode-json-view),
.workspace-square-viewport.ratio-square:not(.mode-json-view) {
  aspect-ratio: 1 / 1;
  height: min(100%, 560px);
  width: auto;
}

.workspace-square-viewport.ratio-4-5:not(.mode-json-view) {
  aspect-ratio: 4 / 5;
  height: 100%;
  width: auto;
}

/* En mode code JSON, le conteneur s'étend en 16:9 pour une lisibilité maximale */
.workspace-square-viewport.mode-json-view {
  aspect-ratio: 16 / 9 !important;
  height: 100% !important;
  width: auto !important;
  max-width: calc(100vw - 680px) !important;
}

/* Encoche smartphone pour format vertical 9:16 */
.image-preview-phone-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  z-index: 35;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Panneaux alternatifs : JSON ou Preview */
.square-content-pane {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.square-content-pane.active {
  display: flex;
  flex-direction: column;
}

/* Mode Éditeur JSON */
.json-editor-viewport {
  width: 100%;
  height: 100%;
  background: #060911;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.json-textarea {
  width: 100%;
  height: 100%;
  flex: 1;
  background: transparent;
  color: #f8fafc;
  border: none;
  resize: none;
  outline: none;
  font-family: var(--font-family-mono, monospace);
  font-size: 0.8rem;
  line-height: 1.55;
  padding: 1rem;
  box-sizing: border-box;
}

.json-blocks-viewport {
  width: 100%;
  height: 100%;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #070b14;
}

/* Canvas Média */
.viewer-media-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020408;
}

/* Lecteur Vidéo MP4 */
.timeline-video-element {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000000;
}

/* Scène de prévisualisation directe (Fallback dynamique) */
.viewer-preview-fallback {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Fond flouté d'ambiance dynamique */
.viewer-backdrop-blur {
  position: absolute;
  inset: -20px;
  filter: blur(28px) brightness(0.4);
  background-size: cover;
  background-position: center;
  pointer-events: none;
  z-index: 5;
  transition: background-image 0.25s ease;
}

/* Scène Visuelle (Rushs vidéos & Images HD) */
.preview-visual-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 10;
}

.viewer-live-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.viewer-live-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: auto;
}

/* Watermark de scène discrètement affiché en haut à droite */
.preview-scene-watermark {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--font-family-display, 'Outfit', sans-serif);
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 25;
  pointer-events: none;
  letter-spacing: 0.05em;
}

/* Couche de Sous-Titres Karaoké */
.preview-subtitles-overlay {
  position: absolute;
  bottom: 12%;
  left: 5%;
  right: 5%;
  text-align: center;
  z-index: 28;
  pointer-events: none;
  font-family: var(--font-family-display, 'Montserrat', sans-serif);
  line-height: 1.25;
}

.karaoke-word {
  display: inline-block;
  margin: 0 2px;
  transition: filter 0.12s ease;
}

.karaoke-word-active {
  filter: brightness(1.25);
}

.subtitle-highlight {
  color: #f23a90;
  -webkit-text-fill-color: #f23a90;
}

/* Couche Overlays & Stickers */
.preview-overlays-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 22;
}

.studio-preview-overlay-item {
  position: absolute;
  display: inline-flex;
  align-items: center;
  translate: 0px;
  rotate: 0deg;
  scale: 1;
  animation: overlayInnerPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes overlayInnerPop {
  0% {
    scale: 0.7;
    opacity: 0;
  }

  100% {
    scale: 1;
    opacity: 1;
  }
}

/* Sticker vert "OK" universel */
.sticker-ok-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(0, 229, 153, 0.16);
  border: 2px solid #00e599;
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(0, 229, 153, 0.45);
  color: #00e599;
  font-family: var(--font-family-display, 'Outfit', sans-serif);
  font-weight: 900;
}

.sticker-ok-icon {
  font-size: 1.1rem;
}

.sticker-ok-text {
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

/* Rideau de transition cinématique (dip-to-black) */
.preview-transition-curtain {
  position: absolute;
  inset: 0;
  background: #000000;
  pointer-events: none;
  z-index: 38;
  opacity: 0;
}

/* Carton État Version Non Générée */
.viewer-unrendered-card {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.96) 0%, rgba(3, 7, 18, 0.99) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 2rem;
  text-align: center;
  z-index: 45;
}

.unrendered-card-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.2);
}

.unrendered-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
}

.unrendered-card-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  max-width: 320px;
  line-height: 1.45;
}

/* Interdiction de boutons flottants par-dessus le viewer */
.viewer-center-play-overlay {
  display: none !important;
}