/* ===================================================================
   APP MÓVIL ESTUDIANTE ICFES - SISTEMA DE DISEÑO Y ESTILOS
   =================================================================== */

:root {
  --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Colores Principales */
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #3730A3;
  --primary-subtle: #EEF2FF;
  
  --secondary: #06B6D4;
  --secondary-subtle: #ECFEFF;

  --success: #10B981;
  --success-dark: #047857;
  --success-subtle: #ECFDF5;

  --warning: #F59E0B;
  --warning-subtle: #FFFBEB;

  --danger: #EF4444;
  --danger-subtle: #FEF2F2;

  /* Superficies y Fondos */
  --bg-app: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-muted: #F1F5F9;
  --bg-dark: #0F172A;

  /* Textos */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-light: #F8FAFC;

  /* Bordes y Sombras */
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --border-focus: #818CF8;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1);
  --shadow-glow: 0 8px 25px -4px rgba(79, 70, 229, 0.35);

  --max-width: 480px; /* Ancho óptimo de experiencia app móvil */
  --bottom-nav-height: 68px;
  --top-header-height: 64px;
}

/* Reset y base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--text-primary);
  background-color: #0F172A;
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.18) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Contenedor central de la app (Mobile Viewport) */
.app-container {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg-app);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
}

@media (min-width: 520px) {
  .app-container {
    min-height: 94vh;
    margin: 3vh auto;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
  }
}

/* Header superior de la App */
.app-header {
  height: var(--top-header-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #818CF8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3);
}

.header-brand-info h1 {
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.header-brand-info span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-muted);
  padding: 5px 10px 5px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.header-user-badge:hover {
  background: var(--primary-subtle);
  border-color: var(--border-focus);
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #10B981, #06B6D4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.78rem;
}

.header-username {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Área de contenido principal desplazable */
.app-content {
  flex: 1;
  padding: 18px 18px calc(var(--bottom-nav-height) + 24px);
  overflow-y: auto;
  position: relative;
}

/* Vistas de la App */
.app-view {
  display: none;
  animation: fadeInView 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-view.active {
  display: block;
}

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

/* Tarjetas y Contenedores */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

.card-gradient {
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  color: white;
  border: none;
  box-shadow: var(--shadow-glow);
}

.card-title {
  font-family: var(--font-primary);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.card-gradient .card-subtitle {
  color: rgba(255, 255, 255, 0.85);
}

/* Badges y Etiquetas */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success-dark);
  border: 1px solid #A7F3D0;
}

.badge-warning {
  background: var(--warning-subtle);
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-danger {
  background: var(--danger-subtle);
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.badge-primary {
  background: var(--primary-subtle);
  color: var(--primary-dark);
  border: 1px solid #C7D2FE;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-focus);
}

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Formularios e Inputs */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Barra de Navegación Inferior (Floating Bottom Nav) */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--bottom-nav-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 6px;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  position: relative;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item .nav-label {
  font-family: var(--font-primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px) scale(1.1);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  width: 28px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* Quick KPI Grid en Dashboard */
.kpi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-mini-card {
  background: var(--bg-card);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.kpi-mini-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-mini-value {
  font-family: var(--font-primary);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Pantalla de Simulacro / Examen Activo */
.exam-runner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0F172A;
  z-index: 500;
  display: none;
  flex-direction: column;
  color: white;
}

.exam-runner.active {
  display: flex;
}

.exam-runner-header {
  padding: 14px 20px;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.exam-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
}

.exam-runner-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.question-card {
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: white;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.option-btn:hover {
  background: rgba(79, 70, 229, 0.2);
  border-color: var(--primary-light);
}

.option-btn.selected {
  background: rgba(79, 70, 229, 0.35);
  border-color: #818CF8;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.option-letter {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.option-btn.selected .option-letter {
  background: var(--primary);
  color: white;
}

.exam-runner-footer {
  padding: 16px 20px;
  background: rgba(30, 41, 59, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: popModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popModal {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

/* Notificaciones Toasts */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  animation: slideToast 0.3s ease;
  pointer-events: auto;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info    { border-left: 4px solid var(--primary); }

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modo Embebido dentro del Mockup / iframe */
@media (max-width: 600px) {
  html, body {
    background-color: var(--bg-app) !important;
    background-image: none !important;
  }
  .app-container {
    min-height: 100% !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}
