/* ====================================================================
   ESTILOS DE LA PLATAFORMA DEL ESTUDIANTE - HACKATHON TECHSKILLS UEC
   ==================================================================== */

:root {
  --primary: #1f4e79;
  --primary-dark: #153655;
  --primary-light: #2c6ea9;
  --accent: #0284c7;
  --accent-light: #e0f2fe;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card-light: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --border-focus: #38bdf8;
  --editor-bg: #0b0f19;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  user-select: text;
}

/* Pantalla de carga / Registro inicial */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, #1e3a8a 0%, #0f172a 70%);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand .logo-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #0284c7, #1f4e79);
  color: #fff;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
  box-shadow: 0 10px 15px -3px rgba(2, 132, 199, 0.4);
}

.auth-brand h1 {
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
}

.auth-brand p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #0b0f19;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #0284c7, #1f4e79);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.security-notice {
  margin-top: 20px;
  padding: 12px;
  background: rgba(14, 165, 233, 0.1);
  border-left: 3px solid #0284c7;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #bae6fd;
}

/* Sala de Espera */
.waiting-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at center, #1e293b 0%, #0b0f19 100%);
}

.waiting-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 580px;
  width: 100%;
  padding: 36px;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

.pulse-spinner {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(2, 132, 199, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  font-size: 28px;
  position: relative;
}

.pulse-spinner::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #38bdf8;
  animation: pulse-ring 2s infinite ease-out;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.waiting-student-info {
  background: #0b0f19;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin: 20px 0;
  text-align: left;
  font-size: 0.9rem;
}

.waiting-student-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.waiting-student-info .info-row:last-child {
  border-bottom: none;
}

.waiting-student-info .label {
  color: var(--text-muted);
}

.waiting-student-info .value {
  color: #fff;
  font-weight: 600;
}

.btn-secondary {
  background: var(--bg-card-light);
  color: #fff;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

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

/* Header de la Plataforma de Evaluación */
.exam-header {
  background: #0b0f19;
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.exam-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.exam-brand .brand-badge {
  background: linear-gradient(135deg, #0284c7, #1f4e79);
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  letter-spacing: 0.5px;
}

.exam-brand .exam-titles h1 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

.exam-brand .exam-titles p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.exam-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.timer-box {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #38bdf8;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.timer-box.warning {
  color: #f59e0b;
  border-color: #f59e0b;
}

.timer-box.danger {
  color: #ef4444;
  border-color: #ef4444;
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  0% { opacity: 1; }
  100% { opacity: 0.5; }
}

.badge-score {
  background: rgba(22, 163, 74, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-infraction {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-submit-exam {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-submit-exam:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* Barra de pestañas */
.tabs-nav {
  display: flex;
  gap: 6px;
  padding: 12px 24px 0;
  background: #0f172a;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  background: #1e293b;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 10px 18px;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: #334155;
}

.tab-btn.active {
  background: var(--bg-card);
  color: #38bdf8;
  border-top: 3px solid #38bdf8;
}

/* Área de contenido de retos */
.exam-main {
  flex: 1;
  padding: 18px 24px 30px;
  background: var(--bg-body);
}

.challenge-section {
  display: none;
}

.challenge-section.active {
  display: block;
}

/* Enunciado del reto */
.challenge-banner {
  background: #1e293b;
  border-left: 4px solid #0284c7;
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 16px;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.challenge-banner h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.challenge-banner .weight-tag {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.challenge-banner p {
  color: #cbd5e1;
  font-size: 0.9rem;
  margin-top: 6px;
}

.challenge-banner ul {
  margin: 8px 0 0 20px;
  color: #94a3b8;
  font-size: 0.87rem;
}

.challenge-banner ul li {
  margin-bottom: 4px;
}

.challenge-banner code {
  background: #0b0f19;
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Grilla del Reto: Editor y Vista Previa */
.challenge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

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

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  background: #131d2e;
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
}

.panel-header .title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
}

.code-editor-wrapper {
  position: relative;
  flex: 1;
  min-height: 380px;
}

.code-editor {
  width: 100%;
  height: 100%;
  min-height: 380px;
  background: var(--editor-bg);
  border: none;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.5;
  padding: 14px;
  resize: vertical;
  tab-size: 2;
  outline: none;
  white-space: pre;
  overflow-x: auto;
}

.preview-frame {
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: none;
  background: #ffffff;
}

/* Barra de acciones de cada reto */
.action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.action-toolbar .btn-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-execute {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.3);
}

.btn-execute:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-ghost:hover {
  background: #334155;
  color: #fff;
}

/* Visualizador Compacto de Pruebas Superadas */
.test-results-card {
  background: #131d2e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 12px;
}

.test-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 700;
}

.test-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}

.test-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #0b0f19;
  border-radius: 6px;
  font-size: 0.83rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.test-item.passed {
  color: #4ade80;
  border-left: 3px solid #16a34a;
}

.test-item.failed {
  color: #f87171;
  border-left: 3px solid #dc2626;
}

.test-item .icon {
  font-size: 14px;
}

/* Pestaña de Resultados y Rúbrica Final */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.score-hero {
  text-align: center;
  padding: 24px;
  background: #0b0f19;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.score-hero .score-number {
  font-size: 3.2rem;
  font-weight: 800;
  color: #38bdf8;
  font-family: var(--font-mono);
  line-height: 1;
}

.score-hero .score-scale {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.rubric-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.88rem;
}

.rubric-table th, 
.rubric-table td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

.rubric-table th {
  background: #131d2e;
  color: #cbd5e1;
  font-weight: 600;
}

.rubric-table td {
  background: #1e293b;
}

.badge-level {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-level.excelente {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

.badge-level.aceptable {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
}

.badge-level.proceso {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

/* Modal Anti-Fraude SweetAlert2 Overrides */
.swal2-popup.swal2-dark-custom {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8) !important;
}

.swal2-popup.swal2-dark-custom .swal2-title {
  color: #fff !important;
}

.swal2-popup.swal2-dark-custom .swal2-html-container {
  color: #cbd5e1 !important;
}
