
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Variables y reset */
:root {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #3730a3;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --dark: #0f172a;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --white: #ffffff;
  --black: #000000;
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Light mode theme variables */
  --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-secondary: rgba(255, 255, 255, 0.15);
  --bg-card: rgba(255, 255, 255, 0.15);
  --text-primary: var(--white);
  --text-secondary: rgba(255, 255, 255, 0.9);
  --text-muted: rgba(255, 255, 255, 0.6);
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-backdrop: rgba(255, 255, 255, 0.1);
}

/* Dark mode variables */
[data-theme="dark"] {
  --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --bg-secondary: rgba(0, 0, 0, 0.4);
  --bg-card: rgba(0, 0, 0, 0.3);
  --text-primary: #e5e7eb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-backdrop: rgba(0, 0, 0, 0.2);
  --glass-bg: rgba(0, 0, 0, 0.2);
  --glass-border: rgba(255, 255, 255, 0.1);
  
  /* Shadows for dark mode */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Fondo animado */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
  z-index: -1;
  animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
  0%, 100% { transform: translateX(0) translateY(0) rotate(0deg); }
  25% { transform: translateX(-10px) translateY(-5px) rotate(1deg); }
  50% { transform: translateX(10px) translateY(5px) rotate(-1deg); }
  75% { transform: translateX(-5px) translateY(10px) rotate(0.5deg); }
}

/* Header con glassmorphism */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(25px);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideDown 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: background 0.3s ease, border-color 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.logo {
  height: 56px;
  margin-right: 1.5rem;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
}

.logo:hover {
  transform: scale(1.08) rotate(3deg);
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.2));
}

.header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  flex: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.025em;
  transition: color 0.3s ease;
}

/* Navegación mejorada */
nav {
  display: flex;
  gap: 0.75rem;
  background: var(--glass-backdrop);
  padding: 0.75rem;
  border-radius: 24px;
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Dark mode toggle button */
.theme-toggle {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1100;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: var(--shadow-lg);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.theme-toggle[data-theme="dark"] svg.sun-icon {
  opacity: 0;
  transform: rotate(180deg) scale(0.5);
}

.theme-toggle[data-theme="light"] svg.moon-icon {
  opacity: 0;
  transform: rotate(-180deg) scale(0.5);
}

.theme-toggle svg.sun-icon,
.theme-toggle svg.moon-icon {
  position: absolute;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

@media (max-width: 768px) {
  .theme-toggle {
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
  }
  
  .theme-toggle svg {
    width: 20px;
    height: 20px;
  }
}

/* ===== Gestor de Prompts ===== */
.prompt-actions {
  margin-bottom: 1rem;
}

.prompt-list {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
}

.prompt-item {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prompt-item h4 {
  color: var(--white);
  margin: 0;
}

.prompt-item small {
  color: rgba(255, 255, 255, 0.7);
}

.prompt-item .actions {
  display: flex;
  gap: 0.5rem;
}

.prompt-editor {
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem;
}

.prompt-editor .form-group {
  margin-bottom: 0.75rem;
}

.prompt-editor .form-row {
  margin: 0.5rem 0 1rem 0;
}

.prompt-editor-actions {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  padding: 1rem 1.75rem;
  cursor: pointer;
  border-radius: 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.025em;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover::before {
  left: 100%;
}

.nav-btn:hover, .nav-btn.active {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(20px);
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Secciones principales */
.seccion {
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from { transform: translateY(60px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.oculto {
  display: none !important;
}

/* Tabla de usuarios simple */
.tabla-usuarios { width: 100%; border-collapse: collapse; }
.tabla-usuarios th, .tabla-usuarios td { border: 1px solid rgba(255,255,255,0.2); padding: 8px; color: var(--white); }
.tabla-usuarios th { background: rgba(255,255,255,0.1); text-align: left; }

/* Cards con glassmorphism avanzado */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  border-radius: 28px;
  box-shadow: var(--shadow-2xl);
  padding: 3rem;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border-color);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 
    0 35px 70px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.card h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.025em;
  transition: color 0.3s ease;
}

/* Formulario elegante */
.form-audio {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.file-label {
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  font-size: 1.125rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: color 0.3s ease;
}

input[type="file"] {
  width: 100%;
  padding: 1.5rem;
  background: var(--glass-backdrop);
  border: 2px dashed var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

input[type="file"]:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

input[type="file"]:focus {
  outline: none;
  border-color: var(--white);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* Reproductor de audio */
.audio-player-container {
  margin: 2rem 0;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

audio {
  width: 100%;
  border-radius: 16px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
  background: rgba(255, 255, 255, 0.1);
}

/* Botón principal mejorado */
.btn-auditar {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  border: none;
  padding: 1.25rem 2.5rem;
  border-radius: 20px;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.btn-auditar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-auditar:hover::before {
  left: 100%;
}

.btn-auditar:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 15px 40px rgba(79, 70, 229, 0.5);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
}

.btn-auditar:active {
  transform: translateY(-2px) scale(1.02);
}

.btn-auditar:disabled {
  background: linear-gradient(135deg, var(--gray-400), var(--gray-500));
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

/* Estado de carga */
.estado {
  min-height: 2.5rem;
  margin-top: 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--white);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Sección de resultados */
.resultados {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.resultado-card {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 2.5rem;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.resultado-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  border-radius: 24px 24px 0 0;
}

.resultado-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.15);
}

.resultado-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: color 0.3s ease;
}

.resultado-area {
  min-height: 5rem;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-secondary);
  padding: 1.5rem;
  background: var(--glass-backdrop);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(5px);
  font-weight: 400;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.resultado-area.vacio {
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Lista de auditorías */
.lista-auditorias {
  list-style: none;
  margin-top: 2rem;
  display: grid;
  gap: 1.5rem;
}

.lista-auditorias li {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  position: relative;
  overflow: hidden;
  color: var(--white);
  font-weight: 500;
}

.lista-auditorias li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  transform: scaleY(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lista-auditorias li:hover::before {
  transform: scaleY(1);
}

.lista-auditorias li:hover {
  transform: translateX(12px) translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.15);
}

.lista-auditorias .vacio {
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  cursor: default;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  padding: 3rem;
}

/* Botón volver */
.btn-volver {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  border: none;
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 2rem;
  padding: 1rem 2rem;
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.3);
}

.btn-volver:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(6, 182, 212, 0.4);
}

/* Responsive design */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 1rem;
    gap: 1.5rem;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  nav {
    width: 100%;
    justify-content: center;
  }

  .nav-btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
  }

  .seccion {
    margin: 2rem 1rem;
    max-width: 100%;
  }

  .card {
    padding: 2rem;
    margin-bottom: 2rem;
  }

  .resultados {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .resultado-card {
    padding: 2rem;
  }
}

/* Animaciones adicionales */
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s infinite;
}

/* Efectos de hover mejorados */
.interactive-element {
  position: relative;
  overflow: hidden;
}

.interactive-element::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.interactive-element:hover::after {
  width: 300px;
  height: 300px;
}

/* Conversación detallada tipo chat - Estilo oscuro forzado */
.turno {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1f2937; /* slate-800 */
  border: 1px solid #374151; /* slate-700 */
  max-width: 92%;
  font-size: 1em;
  line-height: 1.6;
  color: #e5e7eb; /* slate-200 */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.speaker {
  font-weight: 700;
  color: #60a5fa; /* azul para etiqueta por defecto */
  margin-right: 6px;
}
.texto {
  color: #e5e7eb;
}
.turno:nth-child(even) {
  background: #111827; /* gray-900 */
  border-color: #1f2937;
}

/* Estilos para etiquetas en el historial */
.etiqueta {
  display: inline-block;
  background: #e0e7ff;
  color: #2a4d8f;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.95em;
  margin-right: 6px;
  margin-top: 4px;
}
.btn-etiqueta {
  background: #f4f4f8;
  border: 1px solid #bfcfff;
  color: #2a4d8f;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 0.95em;
  cursor: pointer;
  margin-left: 2px;
  margin-top: 4px;
  transition: background 0.2s;
}
.btn-etiqueta:hover {
  background: #e0e7ff;
}

/* Estilo para input de edición inline de etiqueta */
.input-etiqueta {
  font-size: 0.95em;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #bfcfff;
  outline: none;
  margin-right: 6px;
  margin-top: 4px;
  background: #fff;
  color: #2a4d8f;
  width: 120px;
  box-sizing: border-box;
  transition: border 0.2s;
}
.input-etiqueta:focus {
  border: 1.5px solid #2a4d8f;
  background: #e0e7ff;
}

/* Diferentes colores para Alliance y Prospect en la conversación (oscuro) */
.turno.alliance {
  background: #0f172a; /* navy oscuro */
  border-left: 4px solid #10b981; /* green-500 */
}
.turno.prospect {
  background: #1f2937;
  border-left: 4px solid #f97316; /* orange-500 */
}
.turno.alliance .speaker { color: #10b981; }
.turno.prospect .speaker { color: #f97316; }

/* Botón de editar turno en transcripción editable */
.btn-editar-turno {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: 8px;
  vertical-align: middle;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.btn-editar-turno:hover {
  opacity: 1;
}
.texto-editable {
  cursor: pointer;
  transition: background 0.2s;
}
.texto-editable:hover {
  background: #f0f4ff;
}

/* Mejora del representante en análisis */
.mejora-representante-list {
  margin: 10px 0 20px 0;
  padding-left: 18px;
}
.mejora-representante-list li {
  margin-bottom: 10px;
  background: #f8fafd;
  border-left: 4px solid #00796b;
  padding: 8px 12px;
  border-radius: 6px;
}
.mejora-original {
  color: #2a4d8f;
  font-style: italic;
}
.mejora-sugerencia {
  color: #00796b;
  font-weight: bold;
}

/* Textarea para edición de turnos en transcripción editable */
.textarea-etiqueta {
  font-size: 1em;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid #bfcfff;
  outline: none;
  margin: 4px 0 4px 0;
  background: #fff;
  color: #2a4d8f;
  width: 95%;
  min-height: 48px;
  box-sizing: border-box;
  resize: vertical;
  transition: border 0.2s, background 0.2s;
}
.textarea-etiqueta:focus {
  border: 2px solid #2a4d8f;
  background: #e0e7ff;
}

/* Transcripción editable: acciones (+ y ✕) y layout */
.turno.turno-editable {
  position: relative;
  padding-left: 28px;
  padding-right: 28px;
}

/* Estados visuales para drag & drop */
.turno.turno-editable.dragging {
  opacity: 0.7;
  outline: 2px dashed var(--primary);
}
.turno.turno-editable.drag-over {
  box-shadow: 0 0 0 2px var(--secondary) inset;
}

.btn-agregar-despues,
.btn-eliminar-turno {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.btn-agregar-despues {
  right: 4px;
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: #fff;
  border: none;
  box-shadow: 0 2px 6px rgba(16,185,129,0.35);
}

.btn-eliminar-turno {
  left: 4px;
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  color: #fff;
  border: none;
  box-shadow: 0 2px 6px rgba(239,68,68,0.35);
  font-weight: 700;
}

.turno.turno-editable:hover .btn-agregar-despues,
.turno.turno-editable:hover .btn-eliminar-turno {
  opacity: 1;
  pointer-events: auto;
}

/* Hover/active/focus states */
.btn-agregar-despues:hover,
.btn-eliminar-turno:hover {
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}

.btn-agregar-despues:active,
.btn-eliminar-turno:active {
  transform: translateY(-50%) scale(0.98);
}

.btn-agregar-despues:focus-visible,
.btn-eliminar-turno:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.35);
}

/* Reproductor de audio flotante */
.audio-float-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: #fff;
  box-shadow: 0 -2px 16px rgba(44, 62, 80, 0.12);
  padding: 10px 0 6px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1.5px solid #e0e7ff;
  transition: transform 0.3s;
}
.audio-float-player.oculto {
  display: none;
}
#audio-float {
  width: 90vw;
  max-width: 480px;
}

/* Botón de cerrar reproductor flotante */
.btn-cerrar-float {
  position: fixed;
  bottom: 8px;
  right: 12px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1001;
}

.btn-cerrar-float:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.btn-cerrar-float:active {
  transform: scale(0.95);
}

/* Controles fijos de audio (arriba derecha) */
.audio-sticky-controls {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.audio-sticky-controls .ctrl-btn {
  appearance: none;
  border: none;
  outline: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.75));
  color: #334155;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.7);
}

.audio-sticky-controls .ctrl-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.75);
}

.audio-sticky-controls .ctrl-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18) inset;
}

.audio-sticky-controls .ctrl-btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.35), inset 0 1px 0 rgba(255,255,255,0.35);
}

.audio-sticky-controls .ctrl-btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
}

.audio-sticky-controls svg {
  pointer-events: none;
}

@media (max-width: 768px) {
  .audio-sticky-controls {
    bottom: 12px;
    padding: 8px;
    gap: 8px;
  }
  .audio-sticky-controls .ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
}

/* Estilos para la sección de fragmentos */
.info-text {
  color: var(--gray-600);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.lista-sesiones {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sesion-item {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sesion-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.95);
}

.sesion-info h4 {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.sesion-info p {
  color: var(--gray-600);
  font-size: 0.9rem;
  margin: 0;
}

.btn-ver-fragments {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn-ver-fragments:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.session-info {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.session-info h3 {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.session-info p {
  color: var(--gray-600);
  font-size: 0.9rem;
  margin: 0;
}

.fragments-container {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.fragments-list {
  display: grid;
  gap: 1rem;
}

.fragment-item {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fragment-item:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.fragment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.fragment-header h4 {
  color: var(--primary);
  font-weight: 600;
  margin: 0;
}

.speaker-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.speaker-badge.speaker_00 {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
}

.speaker-badge.speaker_01 {
  background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
  color: white;
}

.fragment-details {
  margin-bottom: 1rem;
}

.fragment-details p {
  color: var(--gray-700);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.fragment-details strong {
  color: var(--gray-800);
  font-weight: 600;
}

.fragment-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-play-fragment,
.btn-download-fragment {
  background: linear-gradient(135deg, var(--secondary) 0%, #0891b2 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn-play-fragment:hover,
.btn-download-fragment:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, #0891b2 0%, var(--secondary) 100%);
}

.btn-download-fragment {
  background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
}

.btn-download-fragment:hover {
  background: linear-gradient(135deg, #d97706 0%, var(--accent) 100%);
}

/* Responsive para fragmentos */
@media (max-width: 768px) {
  .sesion-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .fragment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .fragment-actions {
    flex-direction: column;
  }
  
  .btn-play-fragment,
  .btn-download-fragment {
    width: 100%;
    text-align: center;
  }
}

/* ===== ESTILOS PARA ALMACÉN DE AUDIOS ===== */

.audio-upload-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.audio-upload-section h3 {
  color: var(--white);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.form-audio-upload {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn-upload {
  background: linear-gradient(135deg, var(--success), #059669);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.btn-upload::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-upload:hover::before {
  left: 100%;
}

.btn-upload:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-upload:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.audio-storage-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.audio-storage-section h3 {
  color: var(--white);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.audio-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-input,
.filter-select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--white);
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

/* Accesibilidad: alto contraste en el desplegable nativo de opciones */
.filter-select option {
  color: #111;               /* Texto oscuro para fondo claro nativo */
  background-color: #ffffff; /* Fondo blanco para legibilidad */
}
.filter-select optgroup {
  color: #111;
  background-color: #ffffff;
}
.filter-select:disabled {
  color: rgba(255, 255, 255, 0.6);
}
.filter-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.filter-select {
  min-width: 150px;
}

/* Asignación de usuarios */
.assign-container {
  display: flex;
  align-items: center;
  gap: 8px;
}
.assign-container label {
  color: var(--white);
  font-weight: 500;
}

.audio-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.audio-item {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.audio-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.audio-item:hover::before {
  transform: scaleX(1);
}

.audio-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(255, 255, 255, 0.3);
}

.audio-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.audio-item-title {
  color: var(--white);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.audio-item-meta {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audio-item-size {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--white);
}

.audio-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn-audio-action {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-audio-action:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-audio-action.primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-audio-action.primary:hover {
  background: var(--primary-dark);
}

.btn-audio-action.danger {
  background: var(--error);
  border-color: var(--error);
}

.btn-audio-action.danger:hover {
  background: #dc2626;
}

.audio-item-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 3rem 1rem;
  font-style: italic;
}

.loading {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 2rem;
  font-style: italic;
}

.audio-item-format {
  background: var(--primary);
  color: var(--white);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

/* Estilos para el estado de auditoría */
.audio-audit-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-left: 0.5rem;
  transition: all 0.3s ease;
}

.audio-audit-status.audited {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.audio-audit-status.not-audited {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.audio-audit-status.audited:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

.audio-audit-status.not-audited:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.4);
}

/* Estilo para botón deshabilitado cuando ya está auditado */
.btn-audio-action.primary:disabled {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  color: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-audio-action.primary:disabled:hover {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  transform: none;
  box-shadow: none;
}

/* ===== Fixes específicos para iPhone/iOS en la página de Login ===== */
body.login-page .header {
  position: static; /* Evita saltos por sticky en Safari iOS */
}

/* Evitar auto-zoom y mejorar contraste en inputs del login */
body.login-page .search-input {
  font-size: 16px; /* >=16px para evitar zoom en iOS */
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
}
body.login-page .search-input::placeholder {
  color: rgba(255, 255, 255, 0.85);
}

/* Botón más compacto y legible en móviles */
body.login-page .btn-auditar {
  font-size: 1rem;
  padding: 1.1rem 2.25rem;
}

/* Considerar safe-area en iOS */
@supports(padding: max(env(safe-area-inset-top), 0px)) {
  body.login-page .seccion.login-container {
    padding-top: max(env(safe-area-inset-top), 0px);
  }
}

@media (max-width: 768px) {
  body.login-page .login-container .card { padding: 1.5rem; }
  body.login-page .login-header { font-size: 1.5rem; }
}

/* Aumentar contraste del fondo morado y del botón en la página de login */
body.login-page {
  background: linear-gradient(135deg, #5b4ae6 0%, #3b27c7 100%) !important;
}
body.login-page::before {
  /* Evitar que las capas radiales aclaren el morado en iOS */
  display: none;
}
body.login-page .btn-auditar {
  background: linear-gradient(135deg, #5b4ae6, #7c6cf2) !important;
  background-color: #5b4ae6; /* fallback sólido */
}

/* ===== Mejora de contraste en páginas NO-login (móvil) ===== */
@media (max-width: 768px) {
  /* Fondo más saturado y sin capas radiales que lavan el color */
  body:not(.login-page) {
    background: linear-gradient(135deg, #5b4ae6 0%, #3b27c7 100%) !important;
  }
  body:not(.login-page)::before { display: none; }

  /* Superficies glass más translúcidas para que se vea el morado */
  .card,
  .resultado-card,
  .audio-player-container,
  .audio-upload-section,
  .audio-storage-section,
  .lista-auditorias li,
  .audio-item,
  .prompt-list,
  .prompt-editor,
  .session-info,
  .fragments-container,
  .fragment-item {
    background: rgba(255, 255, 255, 0.10) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
  }
}