/* ==========================================================================
   SIMULADOR OFICIAL SIELE - PRUEBA 4: EXPRESIÓN E INTERACCIÓN ORALES (EIO)
   Hoja de Estilos 100% Responsiva (Móvil, Tablet, Portátil, Escritorio)
   ========================================================================== */

:root {
  --siele-burgundy: #8b1538;
  --siele-burgundy-dark: #680d27;
  --siele-burgundy-light: #ad1e49;
  --siele-gold: #e5a93b;
  --siele-dark: #22262e;
  --siele-darker: #171920;
  --siele-grey-bg: #f4f6f9;
  --siele-card-bg: #ffffff;
  --siele-border: #dce1e8;
  --siele-text: #2c323f;
  --siele-text-muted: #647087;
  --siele-success: #1b8a5a;
  --siele-danger: #d90429;
  --siele-warning: #d97706;
  --siele-info: #0284c7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--siele-grey-bg);
  color: var(--siele-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   CABECERA SUPERIOR SIELE (ADAPTABLE)
   ========================================================================== */
.siele-topbar {
  background-color: var(--siele-darker);
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--siele-burgundy);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  width: 100%;
}

.siele-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.siele-logo-pill {
  background: var(--siele-burgundy);
  color: #fff;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.siele-exam-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.siele-exam-title .main-name {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.siele-exam-title .sub-name {
  font-size: 0.75rem;
  color: #a0aec0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.siele-top-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.candidate-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.08);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  border: 1px solid rgba(255,255,255,0.12);
  max-width: 180px;
  min-width: 0;
}

.candidate-badge strong {
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(139, 21, 56, 0.4);
  border: 1px solid var(--siele-burgundy-light);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fce7ef;
  white-space: nowrap;
  flex-shrink: 0;
}

.timer-box.warning {
  background: rgba(217, 4, 41, 0.5);
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(217, 4, 41, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(217, 4, 41, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 4, 41, 0); }
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN DE TAREAS (SCROLL TÁCTIL SUAVE)
   ========================================================================== */
.siele-nav-tabs {
  background: #ffffff;
  border-bottom: 1px solid var(--siele-border);
  display: flex;
  justify-content: flex-start;
  padding: 0 8px;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  width: 100%;
}

.siele-nav-tabs::-webkit-scrollbar {
  height: 4px;
}
.siele-nav-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.task-tab-btn {
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--siele-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.task-tab-btn:hover {
  color: var(--siele-burgundy);
  background: #fdf2f4;
}

.task-tab-btn.active {
  color: var(--siele-burgundy);
  font-weight: 700;
}

.task-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--siele-burgundy);
}

.task-tab-btn.completed .tab-status-icon {
  color: var(--siele-success);
}

.tab-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: #edf2f7;
  color: var(--siele-text-muted);
}

.task-tab-btn.active .tab-badge {
  background: var(--siele-burgundy);
  color: #fff;
}

/* ==========================================================================
   CONTENIDO PRINCIPAL
   ========================================================================== */
.main-wrapper {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 16px auto;
  padding: 0 12px;
}

.siele-card {
  background: var(--siele-card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--siele-border);
  padding: 24px;
  margin-bottom: 20px;
  width: 100%;
}

.card-header-banner {
  border-bottom: 1px solid var(--siele-border);
  padding-bottom: 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.task-meta-title {
  min-width: 0;
  flex: 1;
}

.task-meta-title h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--siele-burgundy);
  margin-bottom: 4px;
  line-height: 1.3;
  word-break: break-word;
}

.task-meta-title .task-code {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--siele-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.task-time-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fdf2f4;
  color: var(--siele-burgundy);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.82rem;
  border: 1px solid #f9d2dc;
  flex-shrink: 0;
}

.instructions-callout {
  background: #f8fafc;
  border-left: 4px solid var(--siele-burgundy);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 18px;
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.5;
  word-break: break-word;
}

/* ==========================================================================
   GRIDS RESPONSIVOS
   ========================================================================== */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  margin: 18px 0;
  width: 100%;
}

.task2-prep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  width: 100%;
}

.intro-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 14px;
  width: 100%;
}

.intro-config-grid > div {
  min-width: 0;
}

.option-card {
  background: #ffffff;
  border: 2px solid var(--siele-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  min-width: 0;
  width: 100%;
}

.option-card:hover {
  border-color: var(--siele-burgundy-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.option-card.selected {
  border-color: var(--siele-burgundy);
  background: #fffbfa;
  box-shadow: 0 0 0 2px var(--siele-burgundy);
}

.option-badge {
  display: inline-block;
  background: var(--siele-burgundy);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
  margin-bottom: 10px;
  align-self: flex-start;
}

.option-img-preview {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
}

.option-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--siele-dark);
  margin-bottom: 6px;
  line-height: 1.35;
  word-break: break-word;
}

.option-desc {
  font-size: 0.88rem;
  color: var(--siele-text-muted);
  margin-bottom: 12px;
  word-break: break-word;
}

.option-checklist {
  list-style: none;
  margin: 8px 0;
  font-size: 0.85rem;
}

.option-checklist li {
  padding: 4px 0 4px 20px;
  position: relative;
  color: #475569;
  word-break: break-word;
}

.option-checklist li::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: var(--siele-burgundy);
  font-weight: bold;
}

/* ==========================================================================
   ESTACIÓN DE GRABACIÓN Y CONTROLES RESPONSIVOS
   ========================================================================== */
.recording-station {
  background: #fafbfc;
  border: 1px solid var(--siele-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
  width: 100%;
}

.audio-prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.audio-prompt-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.prompt-num-pill {
  background: var(--siele-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.prompt-transcription {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--siele-dark);
  word-break: break-word;
}

.btn-play-prompt {
  background: #edf2f7;
  color: var(--siele-text);
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-play-prompt:hover {
  background: #e2e8f0;
  color: var(--siele-burgundy);
}

.btn-play-prompt.playing {
  background: #fdf2f4;
  border-color: var(--siele-burgundy);
  color: var(--siele-burgundy);
}

/* Fila de controles de grabación */
.record-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
  width: 100%;
}

.record-buttons-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.btn-record {
  background: var(--siele-burgundy);
  color: #ffffff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(139, 21, 56, 0.2);
  white-space: nowrap;
}

.btn-record:hover {
  background: var(--siele-burgundy-light);
  transform: translateY(-1px);
}

.btn-record.recording {
  background: var(--siele-danger);
  animation: pulse-btn 1.2s infinite alternate;
}

@keyframes pulse-btn {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.85; transform: scale(1.02); }
}

.btn-stop {
  background: #475569;
  color: #ffffff;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-stop:hover {
  background: #334155;
}

.btn-stop:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.countdown-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: #e2e8f0;
  color: #334155;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.countdown-badge.urgent {
  background: #fee2e2;
  color: var(--siele-danger);
}

/* Visualizador de ondas en tiempo real */
.visualizer-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  max-width: 100%;
}

.wave-canvas {
  width: 120px;
  height: 24px;
}

/* ==========================================================================
   RESULTADO DE GRABACIÓN & BOTÓN DE DESCARGA MP4
   ========================================================================== */
.recorded-result-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.recorded-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #166534;
  min-width: 0;
  word-break: break-word;
}

.recorded-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.recorded-actions audio {
  height: 32px;
  max-width: 180px;
}

.btn-download-mp4 {
  background: #15803d;
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(21, 128, 61, 0.2);
  white-space: nowrap;
}

.btn-download-mp4:hover {
  background: #166534;
  transform: translateY(-1px);
}

/* ==========================================================================
   BLOC DE NOTAS PARA PREPARACIÓN (TAREAS 2 Y 5)
   ========================================================================== */
.notes-container {
  margin-top: 14px;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: var(--radius-md);
  padding: 14px;
  width: 100%;
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.notes-header h4 {
  font-size: 0.92rem;
  color: #92400e;
  font-weight: 700;
}

.notes-textarea {
  width: 100%;
  max-width: 100%;
  height: 110px;
  padding: 10px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  background: #ffffff;
  color: #1e293b;
}

.notes-textarea:focus {
  outline: none;
  border-color: var(--siele-gold);
  box-shadow: 0 0 0 2px rgba(229, 169, 59, 0.2);
}

/* ==========================================================================
   TABLA DE RESUMEN FINAL Y DESCARGAS (ADAPTABLE)
   ========================================================================== */
.summary-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border: 1px solid var(--siele-border);
  border-radius: var(--radius-sm);
  width: 100%;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
  min-width: 600px;
}

.summary-table th {
  background: #f1f5f9;
  color: #475569;
  padding: 10px 12px;
  font-weight: 700;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}

.summary-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.summary-table tr:hover {
  background: #f8fafc;
}

.file-name-code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  word-break: break-all;
  display: inline-block;
  max-width: 200px;
}

.btn-zip-all {
  background: var(--siele-burgundy);
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 440px;
}

.btn-zip-all:hover {
  background: var(--siele-burgundy-dark);
  transform: translateY(-1px);
}

/* ==========================================================================
   BOTONES DE NAVEGACIÓN Y PIE
   ========================================================================== */
.nav-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--siele-border);
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.btn-secondary {
  background: #ffffff;
  color: var(--siele-text);
  border: 1px solid #cbd5e1;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-primary {
  background: var(--siele-burgundy);
  color: #ffffff;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--siele-burgundy-light);
}

.siele-footer {
  background: var(--siele-darker);
  color: #94a3b8;
  padding: 14px 16px;
  font-size: 0.78rem;
  text-align: center;
  margin-top: auto;
  border-top: 1px solid #334155;
  width: 100%;
}

/* ==========================================================================
   MEDIA QUERIES ESPECÍFICAS (MÓVIL Y TABLET)
   ========================================================================== */

/* Tablets y pantallas medianas (≤ 768px) */
@media (max-width: 768px) {
  .siele-topbar {
    padding: 8px 10px;
  }

  .siele-brand {
    gap: 8px;
  }

  .siele-exam-title .main-name {
    font-size: 0.85rem;
  }

  .siele-exam-title .sub-name {
    display: none;
  }

  .siele-top-info {
    gap: 6px;
  }

  .candidate-badge {
    max-width: 120px;
    padding: 4px 6px;
    font-size: 0.75rem;
  }

  .timer-box {
    padding: 4px 8px;
    font-size: 0.78rem;
  }

  .siele-card {
    padding: 16px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
  }

  .task-meta-title h2 {
    font-size: 1.15rem;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .option-img-preview {
    height: 180px;
  }

  .record-controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .record-buttons-group {
    justify-content: space-between;
    width: 100%;
  }

  .record-buttons-group .btn-record,
  .record-buttons-group .btn-stop {
    flex: 1;
    justify-content: center;
    padding: 10px 8px;
    font-size: 0.82rem;
  }

  .visualizer-wrapper {
    justify-content: center;
    width: 100%;
  }

  .wave-canvas {
    width: 100%;
    max-width: 220px;
  }

  .recorded-result-box {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .recorded-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .recorded-actions audio {
    width: 100%;
    max-width: 100%;
  }

  .recorded-actions .btn-download-mp4 {
    width: 100%;
    justify-content: center;
  }

  .nav-actions-row {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .nav-actions-row .btn-primary,
  .nav-actions-row .btn-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
    display: flex;
    padding: 11px;
  }
}

/* Teléfonos pequeños y ventanas estrechas (≤ 480px) */
@media (max-width: 480px) {
  .siele-topbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
  }

  .siele-brand {
    width: 100%;
    justify-content: flex-start;
  }

  .siele-top-info {
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 5px;
  }

  .candidate-badge {
    max-width: 160px;
  }

  .siele-logo-pill {
    padding: 2px 7px;
    font-size: 0.9rem;
  }

  .task-meta-title h2 {
    font-size: 1.05rem;
  }

  .audio-prompt-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-play-prompt {
    width: 100%;
    justify-content: center;
  }

  .countdown-badge {
    font-size: 0.82rem;
    padding: 4px 6px;
  }

  .file-name-code {
    max-width: 120px;
    font-size: 0.72rem;
  }
}
