/* Variables CSS */
/* Variables CSS */
:root { 
  --panel-bg: #ffffff; 
  --zone-bg: #f8f9fa; 
  --zone-border: #e9ecef;
  --header-bg: #ffffff;
  --tab-active-bg: #ffffff;
  --text-muted: #6c757d;
  --primary-color: #0d6efd;
  --border-radius: 0.5rem;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.08);
}

/* Importación de fuentes */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* Base Styles */
body{ 
  background: #eef1f4; 
  min-height: 100vh;
  color: #212529;
  font-size: 14px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Layout */
.container-narrow{ 
  max-width: 1000px;
  padding: 0;
}

.exam-zone {
  position: relative;
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* Controls Panel - Fixed at top */
.controls-panel {
  background: #fff;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid var(--zone-border);
  position: sticky;
  top: 20px;
  z-index: 1020;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

/* Hide toggle button on desktop */
.controls-toggle {
  display: none;
}

/* Questions Area - Scrollable */
.questions-area {
  background: #fff;
  border-radius: var(--border-radius);
  border: 1px solid var(--zone-border);
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 1.5rem;
  min-height: 200px;
}

/* Empty state message */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 1.1rem;
  text-align: center;
  background: linear-gradient(to bottom, #f8f9fa, #fff);
  border-radius: var(--border-radius);
  border: 2px dashed #dee2e6;
}

.empty-state i {
  color: var(--primary-color);
}

.empty-state p:first-of-type {
  font-weight: 600;
  font-size: 1.1rem;
  color: #495057;
}

/* Content container */
.controls-wrapper {
  max-width: 100%;
  margin: 0 auto;
}

/* Card body fix */
.card-body {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Questions Zone */
#examZone {
  padding: 0 1.25rem;
}

/* Result card */
#resultCard {
  margin: 1.25rem;
}

.exam-container {
  background: var(--panel-bg);
  border: 1px solid var(--zone-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

/* Header and Zones */
.header-zone {
  background: var(--header-bg);
  border: 1px solid var(--zone-border);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 15px rgba(0,0,0,.08);
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.exam-zone { 
  background: #fff; 
  border: 1px solid var(--zone-border);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 15px rgba(0,0,0,.08);
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

/* Tabs */
.tabs-container {
  width: 100%;
  background: #fff;
  border: none;
  padding: 1.25rem;
}

.nav-tabs {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  gap: 0.5rem;
  background: transparent;
}

.nav-tabs .nav-link {
  margin: 0;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease-in-out;
  position: relative;
  background: transparent;
}

.nav-tabs .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-color);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-tabs .nav-link:hover {
  color: var(--primary-color);
}

.nav-tabs .nav-link.active {
  color: var(--primary-color);
  font-weight: 600;
}

.nav-tabs .nav-link.active::after {
  transform: scaleX(1);
}

.nav-tabs .nav-link:not(.active) {
  opacity: 0.85;
}

.nav-tabs .nav-link:not(.active):hover::after {
  transform: scaleX(0.3);
  background: var(--text-muted);
}

/* Disabled Tab States */
.nav-tabs .nav-link.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.nav-tabs .nav-link.disabled:hover {
  color: var(--text-muted);
}

.nav-tabs .nav-link.disabled::before {
  content: '🔒';
  font-size: 0.9em;
  margin-right: 0.5rem;
  opacity: 0.7;
}

.nav-tabs .nav-link.disabled:hover::before {
  content: '🚫 Debes finalizar el examen actual';
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(33, 37, 41, 0.95);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-tabs .nav-link.disabled:hover::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(33, 37, 41, 0.95);
  z-index: 1000;
}

/* Accordion */
.accordion-item {
  background: #fff;
  border: 1px solid var(--zone-border);
  border-radius: var(--border-radius);
  transition: all 0.2s ease-in-out;
  margin-bottom: 15px;
}

.accordion-item:hover {
  box-shadow: var(--shadow-sm);
}

.accordion-button {
  padding: 0.75rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #2c3e50;
  background: #cfe2ff;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-button::after {
  margin-left: auto;
  width: 1rem;
  height: 1rem;
  background-size: 1rem;
  flex-shrink: 0;
}

.accordion-button:not(.collapsed) {
  color: var(--primary-color);
  background: #cfe2ff;
  box-shadow: none;
}

.accordion-body {
  padding: 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #3a4f63;
  background: #fff;
  border-top: 1px solid var(--zone-border);
}

/* Form Elements */
.form-check {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  min-height: 30px;
  padding: 0 0 0 12px;
  gap: 10px;
}

.form-check-input {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  border-width: 2px !important;
  border-color: #495057 !important;
}

.form-check-label {
  position: relative;
  flex-grow: 1;
  padding: 1px 22px 1px 12px;
  margin-left: 0;
  border-radius: 4px;
  line-height: 1.4;
  transition: all 0.2s ease;
  cursor: pointer;
  color: #3a3a3a;
  display: flex;
  align-items: center;
  min-height: 30px;
}

/* Form States */
.form-check:hover .form-check-label {
  background-color: rgba(0,0,0,0.02);
}

.form-check-input:checked + .form-check-label {
  background-color: rgba(13, 110, 253, 0.05);
  border: 1px solid rgba(13, 110, 253, 0.15);
}

.question-card.incorrect .form-check-input:checked + .form-check-label:not(.correct-answer) {
  background-color: #f8d7da;
  border: 1px solid #dc3545;
}

/* Highlight correct answer after exam ends */
.form-check-label.correct-answer {
  background-color: #d1e7dd !important;
  border: 1px solid #198754 !important;
  font-weight: 600;
  position: relative;
}

.form-check-label.correct-answer::after {
  content: '✓ Correcta';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #198754;
  font-weight: bold;
  font-size: 0.875rem;
}

/* Highlight wrong answer chosen by user */
.form-check-label.wrong-answer {
  background-color: #f8d7da !important;
  border: 1px solid #dc3545 !important;
  font-weight: 600;
  position: relative;
}

.form-check-label.wrong-answer::after {
  content: '✗ Tu selección';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #dc3545;
  font-weight: bold;
  font-size: 0.875rem;
}

.form-check.hinted .form-check-label {
  background-color: #d1e7dd !important;
  border: 1px solid #198754;
}

.form-check.hinted .form-check-label::after {
  content: '✓';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #198754;
  font-weight: bold;
  font-size: 1.1em;
}

.question-card.correct { 
  border-left: 6px solid #198754; 
}

.question-card.incorrect { 
  border-left: 6px solid #dc3545; 
}

.question-card.unanswered { 
  border: 2px solid #ffc107; 
  background-color: #fff9e6; 
}

/* Controls and UI Elements */
.sticky-control { 
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  border: 1px solid var(--zone-border);
}

.sticky-control.stuck { 
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

/* Questions and Results spacing */
#examZone {
  margin-top: 1.25rem;
}

#resultCard {
  margin-bottom: 1.25rem;
}

/* Question card adjustments */
.question-card {
  margin-bottom: 1.25rem;
  background: #fff;
  border: 1px solid var(--zone-border);
  border-radius: var(--border-radius);
  padding: 0.3rem;
}

/* Lista de preguntas con numeración automática */
.question-list {
  margin: 0;
  padding-left: 1.5em;
  list-style-position: outside;
}

.question-list li {
  padding-left: 0.3em;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.question-list li::marker {
  font-weight: 600;
  color: inherit;
}

.question-list li strong {
  font-weight: 600;
}

.file-label { 
  font-size: .9rem; 
  color: #6c757d;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.file-label.success {
  color: #198754;
}

/* Options Container */
.options-container {
  padding-left: 40px;
  display: flex;
  flex-direction: column;
  gap: 2px
}

/* UI Components */
.eye-btn { 
  color: var(--primary-color);
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
}

.eye-btn:hover {
  opacity: 1;
  background: rgba(13, 110, 253, 0.1);
}

.eye-btn.active {
  color: var(--primary-color);
  opacity: 1;
  background: rgba(13, 110, 253, 0.15);
}

/* Difficulty badges */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background-color: rgba(0, 0, 0, 0.03);
}

.diff-dot {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  display: inline-block;
}

.diff-flame {
  font-size: 12px;
  line-height: 1;
  display: inline-block;
  margin-left: 1px;
  animation: flicker 1.5s infinite alternate;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.difficulty-easy .diff-dot {
  background-color: #198754;
}

.difficulty-medium .diff-dot {
  background-color: #fd7e14;
}

.difficulty-hard .diff-dot {
  background-color: #dc3545;
}

.difficulty-very-hard .diff-dot {
  background-color: #6f42c1;
}

/* KPI Cards */
.kpi { 
  text-align: center; 
}

.kpi-card {
  background: linear-gradient(to bottom, #ffffff, #fafbfc);
  border: 1px solid var(--zone-border);
  border-radius: var(--border-radius);
  padding: 0.75rem;
}

.kpi-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

/* Animations */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(-10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

.bank-info {
  animation: fadeIn 0.3s ease-in-out;
}

/* Additional components */
.accordion-body p {
  margin-bottom: 0.75rem;
  color: #3a4f63;
}

.accordion-body ul.exam-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam-content-summary {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--zone-border);
  font-size: 0.8125rem;
}

.exam-topics {
  display: inline;
  color: var(--text-muted);
}

/* Footer styles */
footer hr {
  opacity: 0.15;
}

footer .copyright {
  font-size: 0.7rem;
}

footer .trademark {
  font-size: 0.7rem;
  opacity: 0.75;
}

/* Estilos para el botón de resaltar pendientes */
#btnHighlightUnanswered.active {
  background-color: transparent !important;
  border-color: #ffc107 !important;
  color: #ffc107 !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

#btnHighlightUnanswered.active:hover {
  background-color: rgba(255, 193, 7, 0.1) !important;
  border-color: #ffc107 !important;
  color: #ffc107 !important;
}

#btnHighlightUnanswered.active:focus {
  background-color: transparent !important;
  border-color: #ffc107 !important;
  color: #ffc107 !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

/* Custom Modal/Alert System */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease-in-out;
}

.custom-modal {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

.custom-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.custom-modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.custom-modal-icon.warning {
  background: #fff3cd;
  color: #856404;
}

.custom-modal-icon.info {
  background: #cfe2ff;
  color: #084298;
}

.custom-modal-icon.success {
  background: #d1e7dd;
  color: #0f5132;
}

.custom-modal-icon.error {
  background: #f8d7da;
  color: #842029;
}

.custom-modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #212529;
}

.custom-modal-body {
  padding: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #495057;
}

.custom-modal-footer {
  padding: 1rem 1.5rem;
  background: #f8f9fa;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.custom-modal-button {
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.custom-modal-button.primary {
  background: #0d6efd;
  color: white;
}

.custom-modal-button.primary:hover {
  background: #0b5ed7;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.custom-modal-button.secondary {
  background: #6c757d;
  color: white;
}

.custom-modal-button.secondary:hover {
  background: #5c636a;
}

.custom-modal-button.danger {
  background: #dc3545;
  color: white;
}

.custom-modal-button.danger:hover {
  background: #bb2d3b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.custom-modal-button.outline {
  background: transparent;
  border: 1px solid #dee2e6;
  color: #495057;
}

.custom-modal-button.outline:hover {
  background: #f8f9fa;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

/* Responsive styles for mobile */
@media (max-width: 768px) {
  .container-narrow {
    padding: 0 0.5rem;
  }
  
  .exam-zone {
    padding: 0.75rem;
    border-radius: 0.75rem;
  }
  
  .controls-panel {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    top: 5px;
    transition: all 0.3s ease;
  }
  
  .controls-panel.minimized .controls-content {
    display: none;
  }
  
  .controls-panel.minimized {
    padding: 0.25rem 0.5rem;
  }
  
  .controls-toggle {
    display: block !important;
    text-align: center;
    padding: 0.15rem;
    cursor: pointer;
    color: #6c757d;
    font-size: 0.65rem;
    user-select: none;
  }
  
  .controls-toggle i {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
  }
  
  .controls-panel.minimized .controls-toggle i {
    transform: rotate(180deg);
  }
  
  .header-zone {
    padding: 0.75rem 0.5rem;
  }
  
  .question-card {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0.75rem !important;
  }
  
  .question-card .card-body {
    padding: 0.6rem 0.5rem !important;
  }
  
  /* Reducir tamaño de letra en tarjetas de preguntas */
  .question-card .card-body strong {
    font-size: 0.85rem !important;
    line-height: 1.35 !important;
  }
  
  .question-card .small {
    font-size: 0.7rem !important;
  }
  
  /* Ajustar sangrado de preguntas en móvil */
  .question-card .card-body > div:has(strong) {
    padding-left: 1.8em !important;
    text-indent: -1.8em !important;
  }
  
  .options-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  .form-check {
    padding-left: 1.5rem !important;
  }
  
  .form-check-label {
    font-size: 0.85rem !important;
    line-height: 1.3 !important;
  }
  
  body {
    padding: 0;
  }
  
  /* KPIs en una sola línea horizontal ultra-compacta */
  .kpi-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.2rem;
    margin-bottom: 0.4rem !important;
  }
  
  .kpi-row .col-md-4 {
    flex: 1;
    max-width: none !important;
    padding: 0 !important;
  }
  
  .kpi-card {
    padding: 0.3rem 0.2rem !important;
    min-height: auto !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  /* Ocultar títulos de KPI en móvil */
  .kpi-label {
    display: none !important;
  }
  
  .kpi-value {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1.2;
    text-align: center;
  }
  
  .kpi-value .h5 {
    font-size: 0.8rem !important;
    margin-bottom: 0 !important;
  }
  
  .kpi-value .text-muted {
    font-size: 0.6rem !important;
  }
  
  /* Ocultar información extra del primer KPI */
  .kpi .text-muted.small {
    display: none !important;
  }
  
  /* Temporizador más compacto en móvil */
  #timer {
    font-size: 0.8rem !important;
    line-height: 1.2 !important;
  }
  
  /* Ocultar texto "Restante" del temporizador */
  .kpi:nth-child(3) .text-muted {
    display: none !important;
  }
  
  /* Botones de control en 1 sola línea */
  .btn-group-controls {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.2rem;
  }
  
  .btn-group-controls > div {
    grid-column: span 1;
  }
  
  .btn-group-controls .btn {
    font-size: 0.75rem !important;
    padding: 0.3rem 0.2rem !important;
    white-space: nowrap;
    line-height: 1.1;
    font-weight: 600 !important;
  }
  
  .btn-group-controls .btn i {
    display: none;
  }
  
  /* Barra de progreso en móvil */
  .progress {
    height: 0.4rem !important;
  }
  
  /* Reducir espacio en card del panel */
  .controls-panel .card-body {
    padding-top: 0 !important;
    padding-right: 0.25rem !important;
    padding-left: 0.25rem !important;
    padding-bottom: 0 !important;
  }
  
  /* Empty state más compacto en móvil */
  .empty-state {
    font-size: 0.8rem !important;
    min-height: 100px !important;
    padding: 0.8rem !important;
  }
  
  .empty-state i {
    font-size: 1.8rem !important;
  }
  
  .empty-state p:first-of-type {
    font-size: 0.85rem !important;
  }
  
  .empty-state p {
    font-size: 0.7rem !important;
    margin-bottom: 0.25rem !important;
  }
  
  /* Respuestas correctas/incorrectas: solo iconos en móvil */
  .form-check-label.correct-answer::after {
    content: '✓' !important;
    right: 8px !important;
    font-size: 1rem !important;
  }
  
  .form-check-label.wrong-answer::after {
    content: '✗' !important;
    right: 8px !important;
    font-size: 1rem !important;
  }
  
  /* Reducir padding horizontal del examZone */
  #examZone {
    padding: 0 0.5rem !important;
  }
}