/* Controles */
.controls-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spacer {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Seções de conteúdo */
.content-section {
  margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-header.header {
  flex-wrap: wrap;
}

/* Transcrição */
#transcript {
  max-height: 48vh;
  overflow-y: auto;
  white-space: pre-wrap;
  scrollbar-width: thin;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 150px;
}

.line.partial {
  opacity: 0.8;
  font-style: italic;
}
.line.final {
  opacity: 1;
  font-weight: 500;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  margin-right: 8px;
  background: #eaeef2;
  color: #24292f;
  border: 1px solid var(--border);
}
.badge.partial {
  background: #dde3ea;
}
.badge.complete {
  background: #dafbe1;
  color: #1f2328;
  border-color: #a6e3b5;
}
.badge.edited {
  background: #ddf4ff;
  color: #0969da;
  border-color: #addcff;
}

/* Edição */
.content-editable {
  width: 100%;
  min-height: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.35;
}

.edit-hint {
  font-size: .86rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Histórico */
.history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  transition: background .15s;
}
.history-item:hover {
  background: #f3f4f6;
}

/* Cards do histórico - Nova estrutura */
.hist-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow .2s;
}

.hist-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.hist-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}

.hist-head:hover {
  background: #f6f8fa;
}

.hist-head.open {
  background: #f0f3f6;
  border-bottom: 1px solid var(--border);
}

.hist-arrow {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform .2s;
  display: inline-block;
  min-width: 12px;
}

.hist-head.open .hist-arrow {
  transform: rotate(90deg);
}

.hist-title {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.hist-body {
  display: none;
  padding: 16px;
  background: #fafbfc;
}

.hist-section {
  margin-bottom: 20px;
}

.hist-section:last-child {
  margin-bottom: 0;
}

.hist-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.hist-section .block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  max-height: 300px;
  overflow-y: auto;
}

.hist-section .block.muted {
  color: var(--muted);
  font-style: italic;
}

.hist-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}

.hist-textarea:focus {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.hist-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.hist-actions button {
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}

.hist-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hist-actions button.primary {
  background: var(--accent);
  color: #fff;
}

.hist-actions button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.hist-actions button.secondary {
  background: var(--danger);
  color: #fff;
}

.hist-actions button.secondary:hover:not(:disabled) {
  background: var(--danger-hover);
}

.hist-actions button.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.hist-actions button.ghost:hover:not(:disabled) {
  background: #f3f4f6;
}

.hist-actions button.sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

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

/* Responsividade */
@media (max-width: 768px) {
  .controls-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .control-group {
    width: 100%;
  }
  
  .select-input {
    width: 100%;
    min-width: auto;
  }
  
  .action-buttons {
    width: 100%;
    justify-content: stretch;
  }
  
  .action-buttons .btn {
    flex: 1;
    min-width: 0;
  }
  
  .status-text {
    width: 100%;
    text-align: center;
    margin-left: 0;
  }
  
  .section-header.header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .spacer {
    margin-left: 0;
    width: 100%;
    justify-content: stretch;
  }
  
  .spacer .btn {
    flex: 1;
  }
  
  /* Histórico */
  .hist-head {
    padding: 12px;
  }
  
  .hist-title {
    font-size: 0.85rem;
  }
  
  .hist-body {
    padding: 12px;
  }
  
  .hist-actions {
    flex-direction: column;
  }
  
  .hist-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .action-buttons {
    flex-direction: column;
  }
  
  .action-buttons .btn {
    width: 100%;
  }
  
  .spacer {
    flex-direction: column;
  }
  
  .spacer .btn {
    width: 100%;
  }
  
  #transcript {
    max-height: 300px;
  }
  
  .hist-head {
    padding: 10px;
    gap: 8px;
  }
  
  .hist-title {
    font-size: 0.8rem;
    line-height: 1.3;
  }
  
  .hist-body {
    padding: 10px;
  }
  
  .hist-section .block {
    font-size: 0.85rem;
    max-height: 200px;
  }
  
  .hist-textarea {
    min-height: 150px;
    font-size: 0.85rem;
  }

}
