/* ============ VARIABLES Y RESET ============ */
:root {
  --primary: #0056b3;
  --primary-dark: #003d82;
  --primary-light: #4a90e2;
  --success: #10b981;
  --success-dark: #059669;
  --danger: #ef4444;
  --warning: #f59e0b;
  --purple: #8b5cf6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.2);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-blue: linear-gradient(135deg, #0056b3 0%, #4a90e2 100%);
  --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* ============ FONDO ANIMADO ============ */
.bg-animation {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 20s infinite ease-in-out;
}

.circle-1 { width: 300px; height: 300px; top: -100px; left: -100px; animation-delay: 0s; }
.circle-2 { width: 400px; height: 400px; bottom: -150px; right: -150px; animation-delay: 5s; }
.circle-3 { width: 250px; height: 250px; top: 50%; left: 50%; animation-delay: 10s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ============ CONTENEDOR PRINCIPAL ============ */
.container {
  max-width: 950px;
  background: white;
  margin: auto;
  padding: 0;
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  overflow: hidden;
  animation: slideUp 0.6s ease-out;
}

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

/* ============ HEADER MEJORADO ============ */
.main-header {
  background: linear-gradient(135deg, #0056b3 0%, #4a90e2 50%, #8b5cf6 100%);
  padding: 50px 30px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.main-header::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: moveBg 20s linear infinite;
}

@keyframes moveBg {
  from { transform: translate(0, 0); }
  to { transform: translate(30px, 30px); }
}

.header-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  z-index: 1;
}

.main-title {
  font-size: 2.8rem;
  font-weight: 800;
  margin: 0 0 10px 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
  position: relative;
  z-index: 1;
  letter-spacing: -1px;
}

.main-subtitle {
  font-size: 1.15rem;
  opacity: 0.95;
  margin: 0 0 25px 0;
  position: relative;
  z-index: 1;
}

.header-info {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.info-chip {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============ SECCIÓN DE DATOS ============ */
.data-section {
  padding: 40px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-bottom: 1px solid var(--gray-200);
}

.section-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 10px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.section-title {
  color: var(--gray-800);
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 8px 0;
}

.section-desc {
  text-align: center;
  color: var(--gray-600);
  margin: 0 0 30px 0;
}

.input-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.input-group.full-width { flex: 1; }

label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-icon { font-size: 1.1rem; }

input[type="text"] {
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.1);
  transform: translateY(-1px);
}

.btn-start, .btn-primary {
  background: linear-gradient(135deg, #0056b3 0%, #4a90e2 100%);
  color: white;
  padding: 16px 32px;
  border: none;
  width: 100%;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3);
  margin-top: 20px;
}

.btn-start:hover, .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 86, 179, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  margin: 40px 0;
  font-size: 1.2rem;
  padding: 20px;
}

.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-icon { font-size: 1.3rem; }

/* ============ BARRA DE PROGRESO ============ */
.progress-container {
  padding: 25px 40px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--gray-800);
}

.progress-count {
  color: var(--primary);
  font-weight: 700;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============ CABECERAS DE SECCIÓN ============ */
#quiz { padding: 30px 40px 40px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 25px;
  margin: 40px 0 25px 0;
  background: linear-gradient(135deg, #0056b3 0%, #4a90e2 100%);
  border-radius: 16px;
  color: white;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.section-header::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(255,255,255,0.15), transparent);
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.section-number {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.section-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.section-sub {
  margin: 4px 0 0 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.section-points {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ============ PREGUNTAS ============ */
.question {
  margin-bottom: 25px;
  padding: 25px;
  background: white;
  border-radius: 16px;
  border: 2px solid var(--gray-200);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.question:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.question p {
  font-weight: 500;
  margin: 0 0 18px 0;
  color: var(--gray-800);
  line-height: 1.6;
  font-size: 1rem;
}

.q-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0056b3 0%, #4a90e2 100%);
  color: white;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-right: 10px;
  box-shadow: 0 2px 6px rgba(0, 86, 179, 0.3);
}

.question label {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 10px;
  background-color: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 500;
  color: var(--gray-800);
}

.question label:hover {
  background-color: #eef4ff;
  border-color: var(--primary-light);
  transform: translateX(4px);
}

.question input[type="radio"] {
  margin-right: 12px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.radio-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: white;
  border: 2px solid var(--gray-300);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-right: 10px;
  transition: all 0.25s ease;
}

.question label:hover .radio-letter {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ============ VERDADERO/FALSO ============ */
.vf-question {
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

.vf-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.vf-label {
  padding: 16px !important;
  text-align: center;
  font-weight: 600 !important;
  border-radius: 12px !important;
  transition: all 0.3s ease !important;
}

.vf-true {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
}

.vf-true:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important;
  transform: scale(1.02) !important;
}

.vf-false {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}

.vf-false:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
  transform: scale(1.02) !important;
}

/* ============ BLOQUES DE CORRESPONDENCIA ============ */
.match-block {
  margin: 30px 0;
  padding: 25px;
  background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
  border-radius: 16px;
  border: 2px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.match-block-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px dashed var(--gray-200);
}

.match-icon {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #0056b3 0%, #4a90e2 100%);
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.match-block-header h3 {
  margin: 0;
  color: var(--gray-800);
  font-size: 1.2rem;
}

.match-block-header p {
  margin: 4px 0 0 0;
  color: var(--gray-600);
  font-size: 0.9rem;
}

.match-grid {
  display: grid;
  gap: 12px;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  transition: all 0.25s ease;
}

.match-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.match-label {
  flex: 1;
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.95rem;
}

.match-item select {
  flex: 1.5;
  padding: 10px 12px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--gray-800);
}

.match-item select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* ============ BANCO DE PALABRAS ============ */
.phrase-bank {
  padding: 20px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 16px;
  margin-bottom: 25px;
  border: 2px solid #f59e0b;
}

.phrase-bank strong {
  display: block;
  margin-bottom: 12px;
  color: #78350f;
  font-size: 1rem;
}

.word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word-chips span {
  background: white;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  color: #78350f;
  font-weight: 600;
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.phrase-question {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.phrase-question input[type="text"] {
  width: 100%;
  margin-top: 10px;
  padding: 14px 18px;
  font-size: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  background: white;
  transition: all 0.3s ease;
}

.phrase-question input[type="text"]:focus {
  outline: none;
  border-color: var(--warning);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}

/* ============ UTILIDADES ============ */
.hidden { display: none; }

/* ============ RESULTADOS ============ */
.results-card {
  padding: 40px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  text-align: center;
  border: 2px solid var(--gray-200);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.5s ease-out;
}

.results-card h2 {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 2rem;
}

.score-display {
  font-size: 5rem;
  font-weight: 800;
  margin: 25px 0;
  background: linear-gradient(135deg, #0056b3 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
  animation: pulse 2s infinite;
}

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

.score-display.approved {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-display.failed {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 30px 0;
}

.stat-card {
  background: white;
  padding: 18px;
  border-radius: 14px;
  border: 2px solid var(--gray-200);
  text-align: left;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, #0056b3 0%, #4a90e2 100%);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--gray-800);
  font-size: 0.9rem;
}

.stat-card .success { color: var(--success); font-weight: 700; }
.stat-card .danger { color: var(--danger); font-weight: 700; }

.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin: 30px 0;
  flex-wrap: wrap;
}

.btn-pdf, .btn-print {
  padding: 16px 28px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 260px;
  justify-content: center;
}

.btn-print {
  background: linear-gradient(135deg, #0056b3 0%, #4a90e2 100%);
  box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3);
}

.btn-pdf {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-pdf:hover, .btn-print:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.review-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 30px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.review-table thead {
  background: linear-gradient(135deg, #0056b3 0%, #4a90e2 100%);
  color: white;
}

.review-table th {
  padding: 14px;
  text-align: left;
  font-weight: 600;
}

.review-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
}

.review-table tbody tr:hover {
  background: var(--gray-50);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  body { padding: 10px; }
  .main-title { font-size: 2rem; }
  .main-header { padding: 35px 20px; }
  #quiz { padding: 20px; }
  .data-section { padding: 25px 20px; }
  .input-row { flex-direction: column; gap: 15px; }
  .section-header { flex-direction: column; text-align: center; padding: 20px; }
  .section-points { margin: 10px 0 0 0; }
  .match-item { flex-direction: column; align-items: stretch; }
  .match-label { margin-bottom: 5px; }
  .vf-buttons { grid-template-columns: 1fr; }
  .score-display { font-size: 3.5rem; }
  .progress-container { padding: 20px; }
}

/* ============ IMPRESIÓN ============ */
@media print {
  .bg-animation, .btn-pdf, .btn-print, .btn-primary, .btn-start,
  #setup, .progress-container, .header-info { display: none !important; }
  body { background: white; padding: 0; }
  .container { box-shadow: none; border-radius: 0; }
  .main-header { background: #0056b3 !important; }
  .section-header { background: #0056b3 !important; color: white !important; }
  .question { break-inside: avoid; }
  .results-card { box-shadow: none; border: 2px solid #000; }
}