/* ========================================
   AUDIOCENA - Estilos específicos
   v3 — com suporte a BLOCOS
   ======================================== */

/* ============================================
   IMAGEM DE FUNDO - SÓ OPACIDADE NA IMAGEM
   ============================================ */
.audiocena-mode .main-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--scene-bg, none);
  background-size: cover;
  background-position: center;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.audiocena-mode .main-panel.has-scene-bg::before {
  opacity: 0.8;
}

/* Links */
.back-link {
  display: inline-block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  margin-bottom: 8px;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
}

.title-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.title-link:hover {
  color: var(--accent);
}

.scene-name-display {
  color: var(--accent);
}

/* Progress indicator */
.progress-indicator {
  font-size: 12px;
  padding: 6px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
}

.progress-indicator .progress-current {
  color: var(--accent);
  font-weight: 600;
}

/* ========================================
   TABS DE BLOCOS
   ======================================== */

.bloco-tabs-container {
  display: flex;
  gap: 4px;
  padding: 8px 20px;
  background: rgba(14, 17, 23, 0.95);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.bloco-tabs-container::-webkit-scrollbar {
  height: 4px;
}

.bloco-tabs-container::-webkit-scrollbar-track {
  background: transparent;
}

.bloco-tabs-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.bloco-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-size: 11px;
  flex-shrink: 0;
}

.bloco-tab:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-panel-alt);
}

.bloco-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.bloco-tab-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.bloco-tab.active .bloco-tab-number {
  background: var(--accent);
  color: #fff;
}

.bloco-tab-title {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   SEPARADORES DE BLOCO (inline nos diálogos)
   ======================================== */

.bloco-separator {
  margin: 24px 0 16px 0;
  padding: 12px 20px;
  background: rgba(14, 17, 23, 0.9);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bloco-separator:first-child {
  margin-top: 0;
}

.bloco-separator-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.bloco-separator-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

/* ========================================
   ÁREA DE DIÁLOGOS
   ======================================== */

.dialogue-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  position: relative;
  z-index: 2;
  min-height: 0;
  background: rgba(10, 13, 18, 0.8);
}

/* Placeholder inicial */
.dialogue-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-secondary);
  opacity: 1;
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.dialogue-placeholder h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.dialogue-placeholder p {
  font-size: 14px;
  max-width: 400px;
  line-height: 1.6;
}

.placeholder-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ========================================
   ITEMS DE DIÁLOGO - TODOS 100% OPACOS
   ======================================== */

.dialogue-item {
  margin-bottom: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  opacity: 1;
  transition: all 0.3s ease;
}

/* Estados visuais */
.dialogue-item.played {
  opacity: 1;
  background: rgba(18, 22, 29, 0.9);
}

.dialogue-item.current {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(1.01);
  background: var(--bg-panel);
}

.dialogue-item.upcoming {
  opacity: 1;
  background: rgba(18, 22, 29, 0.7);
  border-color: rgba(255,255,255,0.03);
}

/* Narrador */
.dialogue-item.narrator {
  background: var(--bg-panel-alt);
  border-left: 3px solid var(--text-muted);
  font-style: italic;
  opacity: 1;
}

.dialogue-item.narrator .dialogue-speaker {
  color: var(--text-muted);
  font-style: normal;
}

.dialogue-item.narrator .dialogue-text {
  color: var(--text-secondary);
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  line-height: 1.7;
}

/* Diálogo de personagem */
.dialogue-item.character {
  border-left: 3px solid var(--accent);
}

.dialogue-speaker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.speaker-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s infinite;
  display: none;
}

.dialogue-item.current .speaker-indicator {
  display: block;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.dialogue-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  opacity: 1;
}

.dialogue-number {
  font-size: 10px;
  color: var(--text-muted);
  float: right;
  margin-left: 12px;
}

/* ========================================
   CONTROLOS DO PLAYER
   ======================================== */

.player-controls {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(18, 22, 29, 0.98);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  opacity: 1;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

.player-btn:hover:not(:disabled) {
  background: var(--bg-panel-alt);
  border-color: var(--accent);
  color: var(--accent);
}

.player-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.player-btn-main {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 18px;
}

.player-btn-main:hover:not(:disabled) {
  background: var(--accent);
  filter: brightness(1.1);
  color: #fff;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.now-speaking {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.speed-control select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}

.speed-control select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ========================================
   ÁREA DE PERGUNTAS
   ======================================== */

.question-area {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: rgba(22, 27, 36, 0.98);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  opacity: 1;
}

.question-input-row {
  display: flex;
  gap: 8px;
}

.question-input-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.2s ease;
}

.question-input-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.question-input-row input::placeholder {
  color: var(--text-muted);
}

.btn-ask {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-ask:hover {
  filter: brightness(1.1);
}

.btn-ask:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.question-response {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-panel);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  display: none;
}

.question-response.active {
  display: block;
}

.question-response .response-speaker {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 11px;
  text-transform: uppercase;
}

.question-response .response-text {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.question-response .response-loading {
  color: var(--text-muted);
  font-style: italic;
}

.interaction-area {
  display: none;
}

/* ========================================
   PAINEL DIREITO - PERSONAGENS
   ======================================== */

.characters-list {
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
}

.characters-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.character-card {
  padding: 10px 12px;
  background: var(--bg-panel-alt);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.character-card:hover {
  border-color: var(--border-hover);
}

.character-card.speaking {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.character-card .char-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.character-card .char-role {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.character-card .char-lines {
  font-size: 10px;
  color: var(--accent);
  margin-top: 4px;
}

/* ========================================
   LEGENDA
   ======================================== */

.legend-section {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}

.legend-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.narrator {
  background: var(--bg-panel-alt);
  border: 1px solid var(--text-muted);
}

.legend-color.dialogue {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}

.legend-color.current {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ========================================
   DICAS
   ======================================== */

.tips-section {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  flex: 1;
}

.tips-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.tips-content {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
}

.tips-content p {
  margin-bottom: 6px;
}

.tips-content strong {
  color: var(--text-secondary);
}

/* ========================================
   ANIMAÇÕES
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dialogue-item {
  animation: fadeIn 0.3s ease;
}

.bloco-separator {
  animation: fadeIn 0.4s ease;
}

/* ========================================
   RESPONSIVO
   ======================================== */

@media (max-width: 1000px) {
  .player-controls {
    flex-wrap: wrap;
  }

  .player-info {
    order: -1;
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
  }

  .speed-control {
    width: 100%;
    justify-content: center;
  }

  .bloco-tabs-container {
    padding: 6px 12px;
  }

  .bloco-tab-title {
    max-width: 120px;
  }
}

@media (max-width: 800px) {
  .audiocena-mode .sidebar-right {
    display: none;
  }

  .bloco-tab-title {
    max-width: 80px;
    font-size: 10px;
  }
}