:root {
  --c-primary:     #0F172A;
  --c-secondary:   #334155;
  --c-accent:      #0369A1;
  --c-accent-h:    #0284C7;
  --c-bg:          #F8FAFC;
  --c-surface:     #FFFFFF;
  --c-muted:       #E8ECF1;
  --c-border:      #E2E8F0;
  --c-text:        #020617;
  --c-text-muted:  #475569;
  --c-text-subtle: #64748B;
  --c-blue-light:  #EFF6FF;
  --font:          'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --radius:        12px;
  --radius-sm:     8px;
  --t:             150ms ease;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font);
  margin: 0;
  color: var(--c-text);
  background: var(--c-bg);
}

/* ---- Header del sitio (mismo patrón que aqespaciodigital.xyz) ---- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--c-surface);
  border-bottom: 1.5px solid var(--c-border);
  flex-wrap: wrap;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--c-primary);
}

.logo-wrap img {
  height: 32px;
  width: auto;
  display: block;
}

.logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--c-primary);
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
}

.site-header nav a {
  color: var(--c-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--t);
}

.site-header nav a:hover {
  color: var(--c-accent);
}

/* ---- Toggle de idioma ES/EN ---- */

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--c-text-subtle);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.35rem;
  cursor: pointer;
  transition: color var(--t);
}

.lang-btn:hover { color: var(--c-accent); }

.lang-btn.active {
  font-weight: 700;
  color: var(--c-accent);
}

.page-intro {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.page-intro h1 {
  margin: 0 0 0.5rem;
  color: var(--c-primary);
  font-weight: 800;
}

.page-intro p {
  color: var(--c-text-muted);
  margin: 0;
}

/* ---- Ad slots ----
   Ocultos hasta activar AdSense real (atributo `hidden` en el HTML) — la regla de abajo
   es necesaria porque `.ad-slot { display: flex }` tiene la misma especificidad que el
   `[hidden] { display: none }` del stylesheet del navegador y, al venir después en la
   cascada, lo pisaría si no se refuerza acá explícitamente. */

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-muted);
  color: var(--c-text-subtle);
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--c-border);
}

.ad-slot[hidden] {
  display: none;
}

.ad-slot-top, .ad-slot-bottom {
  min-height: 90px;
  margin: 1rem auto;
  max-width: 728px;
}

.ad-slot-sidebar {
  min-height: 250px;
  width: 300px;
  margin: 1rem auto;
}

@media (max-width: 900px) {
  .ad-slot-sidebar { display: none; }
}

main {
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem;
}

/* ---- Drop zone ---- */

.drop-zone {
  border: 1.5px dashed var(--c-accent);
  border-radius: var(--radius);
  padding: 3rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--c-surface);
  transition: background var(--t), border-color var(--t);
}

.drop-zone.dragover {
  background: var(--c-blue-light);
  border-color: var(--c-accent-h);
}

#browse-btn {
  background: none;
  border: none;
  color: var(--c-accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

#browse-btn:hover { color: var(--c-accent-h); }

.hint { color: var(--c-text-subtle); font-size: 0.85rem; }

.error-box {
  background: #FEE2E2;
  color: #B91C1C;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  border: 1.5px solid #FCA5A5;
}

/* ---- Waveform + reproductor ---- */

#waveform {
  margin: 1.5rem 0 0.75rem;
  position: relative;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.play-pause-btn {
  background: var(--c-accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.play-pause-btn:hover:not(:disabled) { background: var(--c-accent-h); }
.play-pause-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.player-time {
  color: var(--c-text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ---- Controles ---- */

.controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mode-select {
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  background: var(--c-surface);
}

.mode-select legend {
  color: var(--c-secondary);
  font-weight: 600;
  padding: 0 0.4rem;
}

.mode-select label {
  margin-right: 1.25rem;
  color: var(--c-text);
}

.mode-controls[hidden] { display: none; }

.mode-controls label {
  color: var(--c-text-muted);
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

select, input[type="number"], .time-input {
  font-family: inherit;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  background: var(--c-surface);
  color: var(--c-text);
}

select:focus, input[type="number"]:focus, .time-input:focus {
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
}

.output-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

/* ---- Modo personalizado ---- */

.secondary-btn {
  background: var(--c-blue-light);
  color: var(--c-accent);
  border: 1.5px solid var(--c-accent);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t), color var(--t);
}

.secondary-btn:hover { background: var(--c-accent); color: white; }

.custom-parts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 0;
}

.custom-parts-table th,
.custom-parts-table td {
  text-align: left;
  padding: 0.5rem 0.6rem 0.5rem 0;
  border: none;
  font-size: 0.9rem;
}

.custom-parts-table thead th {
  color: var(--c-text-subtle);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 1.5px solid var(--c-border);
}

.custom-parts-table tbody tr {
  border-bottom: 1px solid var(--c-border);
}

.custom-parts-table tbody tr:last-child {
  border-bottom: none;
}

.custom-parts-table td.custom-part-cell {
  color: var(--c-text-muted);
  font-weight: 600;
}

.custom-parts-table td.custom-start-cell {
  color: var(--c-text-subtle);
}

.custom-parts-table td.custom-size-cell {
  color: var(--c-text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.custom-parts-table .time-input {
  width: 8rem;
  font-variant-numeric: tabular-nums;
}

.merge-btn {
  background: none;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text-subtle);
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t);
}

.merge-btn:hover {
  color: var(--c-accent);
  border-color: var(--c-accent);
}

#split-btn {
  background: var(--c-accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
}

#split-btn:hover:not(:disabled) { background: var(--c-accent-h); }
#split-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.progress-container {
  margin: 1rem 0;
  background: var(--c-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  height: 24px;
  border: 1.5px solid var(--c-border);
}

.progress-bar {
  background: var(--c-accent);
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}

/* Estado indeterminado: cuando ningún archivo de la descarga trae Content-Length y no hay
   forma de calcular un % real — franjas animadas en vez de quedar pegada en 0%. */
.progress-bar--indeterminate {
  background-image: repeating-linear-gradient(
    45deg,
    var(--c-accent) 0,
    var(--c-accent) 10px,
    var(--c-accent-h) 10px,
    var(--c-accent-h) 20px
  );
  background-size: 40px 40px;
  transition: none;
  animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
  from { background-position: 0 0; }
  to { background-position: 40px 0; }
}

#progress-label, #model-progress-label, #transcribe-progress-label {
  position: absolute;
  top: 0; left: 0; right: 0;
  text-align: center;
  line-height: 24px;
  font-size: 0.85rem;
  color: var(--c-primary);
}

.results {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.results ul { list-style: none; padding: 0; margin: 0.5rem 0 0; }

.results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--c-border);
}

.results li:last-child { border-bottom: none; }

.results li a {
  color: var(--c-accent);
  text-decoration: none;
  font-weight: 500;
}

.results li a:hover { color: var(--c-accent-h); text-decoration: underline; }

.results li.error { color: #B91C1C; }

#download-all-btn {
  background: var(--c-surface);
  color: var(--c-accent);
  border: 1.5px solid var(--c-accent);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--t), color var(--t);
}

#download-all-btn:hover { background: var(--c-accent); color: white; }

/* ---- Secciones de contenido (Cómo funciona / Features / FAQ) ---- */

.section {
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.section-label {
  text-align: center;
  color: var(--c-accent);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.4rem;
}

.section-title {
  text-align: center;
  color: var(--c-primary);
  font-weight: 800;
  font-size: 1.5rem;
  margin: 0 0 2rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 700px) {
  .steps-grid { grid-template-columns: 1fr; }
}

.step-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--c-accent);
  color: white;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.step-card h3 {
  color: var(--c-primary);
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.step-card p {
  color: var(--c-text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .features-grid { grid-template-columns: 1fr; }
}

.feature-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.feature-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.6rem;
}

.feature-card h3 {
  color: var(--c-primary);
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

.feature-card p {
  color: var(--c-text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--c-primary);
  padding: 0.5rem 0;
  list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::before {
  content: '+';
  display: inline-block;
  width: 1rem;
  color: var(--c-accent);
  font-weight: 700;
}

.faq-item[open] summary::before {
  content: '−';
}

.faq-item p {
  color: var(--c-text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.75rem 1rem;
}

/* ---- Footer ---- */

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--c-text-subtle);
  font-size: 0.85rem;
  border-top: 1.5px solid var(--c-border);
  margin-top: 2rem;
}

.site-footer p {
  color: var(--c-text-muted);
  margin: 0 0 0.35rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

.footer-links a {
  color: var(--c-accent);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--c-accent-h);
  text-decoration: underline;
}

/* --- Transcript: componentes propios --- */
.record-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.live-status {
  font-size: 0.9rem;
  color: var(--c-text-muted);
}

.live-status::before {
  content: "●";
  color: #ef4444;
  margin-right: 6px;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.lang-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.transcript-output {
  width: 100%;
  min-height: 240px;
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  resize: vertical;
}

.export-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.export-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Transcript: toolbar (copiar/editar/borrar) + editor con formato --- */

.transcript-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.transcript-toolbar .secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.transcript-toolbar .secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--c-blue-light);
  color: var(--c-accent);
}

.secondary-btn.danger {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #DC2626;
}

.secondary-btn.danger:hover { background: #DC2626; color: white; }

.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--c-border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--c-muted);
}

.rich-editor-toolbar button {
  min-width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--c-primary);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}

.rich-editor-toolbar button:hover { background: var(--c-surface); }

.rich-editor-toolbar button.active {
  background: var(--c-surface);
  border-color: var(--c-accent);
  color: var(--c-accent);
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--c-border);
  margin: 0 4px;
}

.rich-editor {
  width: 100%;
  min-height: 240px;
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  border: 1px solid var(--c-border);
  border-radius: 0 0 8px 8px;
  overflow-y: auto;
}

.rich-editor:focus {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}

.rich-editor ul, .rich-editor ol {
  margin: 0 0 0 1.4rem;
  padding: 0;
}

/* --- Transcript: pills de exportar (más estéticos que texto plano) --- */

.export-controls {
  gap: 10px;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-surface);
  color: var(--c-primary);
  border: 1.5px solid var(--c-border);
  border-radius: 100px;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), transform var(--t);
}

.export-btn:hover:not(:disabled) {
  background: var(--c-blue-light);
  border-color: var(--c-accent);
  color: var(--c-accent);
  transform: translateY(-1px);
}

.export-btn:disabled {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text-subtle);
}

.export-icon { font-size: 1.05rem; }
