﻿/* ==========================================================================
   MEDPREGUNTAS - SISTEMA DE DISEÑO MODERNO (HTML5 & VANILLA JS)
   ========================================================================== */

:root {
  --primary: #00ACC1;
  --primary-hover: #0097A7;
  --primary-light: #E0F7FA;
  --primary-subtle: #F0FDFA;
  --primary-darker: #00838F;

  --secondary: #2C3E46;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;

  --success: #10B981;
  --success-dark: #059669;
  --success-light: #ECFDF5;
  --success-border: #A7F3D0;

  --error: #EF4444;
  --error-dark: #DC2626;
  --error-light: #FEF2F2;
  --error-border: #FECACA;

  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --warning-border: #FDE68A;

  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg-page);
  color: var(--secondary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* TOPBAR */
.top-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.top-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--secondary);
  font-size: 1.15rem;
  font-weight: 700;
  transition: opacity .15s;
}

.brand-logo:hover {
  opacity: 0.85;
}

.brand-icon {
  font-size: 1.5rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-darker);
  background: var(--primary-light);
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

.btn-icon {
  background: #f1f5f9;
  border: 1px solid var(--slate-200);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--slate-700);
  transition: all .15s;
}

.btn-icon:hover {
  background: var(--slate-200);
}

.btn-icon.active {
  background: #FEF3C7;
  border-color: #FCD34D;
  color: #B45309;
}

.btn-icon.active .star-icon {
  color: #F59E0B;
}

.btn-hub {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background .15s, transform .1s;
}

.btn-hub:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--slate-200);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4DD0E1, #00ACC1, #00838F);
  transition: width .3s ease;
}

/* BREADCRUMBS */
.main-container {
  padding-top: 24px;
  padding-bottom: 60px;
  flex: 1;
}

.breadcrumb-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--slate-500);
}

.breadcrumbs a {
  color: var(--primary-darker);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .sep {
  color: var(--slate-400);
}

.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-mieunacom {
  background: #E0F2FE;
  color: #0369A1;
  border: 1px solid #BAE6FD;
}

.badge-origen {
  background: #EDE9FE;
  color: #6D28D9;
  border: 1px solid #DDD6FE;
}

.badge-topic {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.badge-subarea {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

.badge-difficulty {
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.badge-year {
  background: #F3F4F6;
  color: #374151;
}

/* QUESTION CARD */
.question-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.q-number-pill {
  font-size: 0.80rem;
  font-weight: 800;
  background: var(--primary-light);
  color: var(--primary-darker);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

.q-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--secondary);
}

.q-statement p {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #1E293B;
  white-space: pre-line;
}

/* OPTIONS */
.options-section {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.options-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.option-wrapper {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--slate-200);
  background: #ffffff;
  transition: all .2s ease;
  overflow: hidden;
}

.option-wrapper:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0, 172, 193, 0.12);
}

.option-label {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  margin: 0;
  width: 100%;
}

.option-radio {
  display: none;
}

.option-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--slate-300);
  color: var(--slate-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: all .15s;
}

.option-text {
  font-size: 1.0rem;
  font-weight: 600;
  color: var(--secondary);
  flex: 1;
}

.option-wrapper.selected {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.option-wrapper.selected .option-badge {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.option-wrapper.is-correct {
  border-color: var(--success) !important;
  background: var(--success-light) !important;
}

.option-wrapper.is-correct .option-badge {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #ffffff !important;
}

.option-wrapper.is-incorrect {
  border-color: var(--error) !important;
  background: var(--error-light) !important;
}

.option-wrapper.is-incorrect .option-badge {
  background: var(--error) !important;
  border-color: var(--error) !important;
  color: #ffffff !important;
}

.option-state-icon {
  font-weight: 800;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: none;
}

.option-wrapper.is-correct .option-state-icon {
  display: inline-block;
  background: #D1FAE5;
  color: #065F46;
}
.option-wrapper.is-correct .option-state-icon::after {
  content: "✓ CORRECTA";
}

.option-wrapper.is-incorrect .option-state-icon {
  display: inline-block;
  background: #FEE2E2;
  color: #991B1B;
}
.option-wrapper.is-incorrect .option-state-icon::after {
  content: "✗ TU RESPUESTA";
}

.option-justification {
  padding: 12px 20px 16px 68px;
  border-top: 1px dashed rgba(0,0,0,0.08);
  font-size: 0.90rem;
  line-height: 1.6;
}

.option-wrapper.is-correct .option-justification {
  background: #F0FDF4;
  color: #166534;
}

.option-wrapper.is-incorrect .option-justification {
  background: #FEF2F2;
  color: #991B1B;
}

.option-wrapper:not(.is-correct):not(.is-incorrect) .option-justification {
  background: #F8FAFC;
  color: var(--slate-600);
}

.action-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 172, 193, 0.28);
  transition: all .15s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 172, 193, 0.35);
}

.btn-primary:disabled {
  background: var(--slate-300);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: #ffffff;
  color: var(--slate-700);
  border: 1.5px solid var(--slate-300);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
}

.btn-secondary:hover {
  background: var(--slate-100);
  border-color: var(--slate-400);
}

/* FEEDBACK */
.feedback-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  animation: fadeIn .3s ease;
}

.feedback-card.correct {
  background: var(--success-light);
  border: 1.5px solid var(--success-border);
  color: #065F46;
}

.feedback-card.incorrect {
  background: var(--error-light);
  border: 1.5px solid var(--error-border);
  color: #991B1B;
}

.feedback-icon-box {
  font-size: 2.2rem;
}

.feedback-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.feedback-subtitle {
  font-size: 0.94rem;
}

.explanation-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn .35s ease;
}

.exp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--slate-200);
}

.exp-icon {
  font-size: 1.4rem;
}

.exp-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--secondary);
}

.exp-paragraph {
  font-size: 1.0rem;
  line-height: 1.8;
  color: var(--slate-700);
  white-space: pre-line;
}

/* NAVIGATION FOOTER */
.navigation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  background: #ffffff;
  color: var(--secondary);
  border: 1.5px solid var(--slate-200);
  transition: all .15s;
}

.nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary-darker);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nav-btn.nav-next {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.nav-btn.nav-next:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

.nav-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.keyboard-hints {
  text-align: center;
  font-size: 0.82rem;
  color: var(--slate-400);
  margin-top: 10px;
}

.keyboard-hints kbd {
  background: #ffffff;
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-weight: 700;
  color: var(--slate-600);
}

/* INDEX DASHBOARD */
.index-header {
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  padding: 36px 0;
  box-shadow: var(--shadow-sm);
}

.index-header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-icon-large {
  font-size: 2.8rem;
}

.index-main-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--secondary);
}

.index-main-title strong {
  color: var(--primary);
}

.index-sub-title {
  font-size: 0.95rem;
  color: var(--slate-500);
  margin-top: 4px;
}

.header-badge-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.stat-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card.stat-success {
  border-left: 4px solid var(--success);
}

.stat-card.stat-saved {
  border-left: 4px solid var(--warning);
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 2.0rem;
  font-weight: 800;
  color: var(--secondary);
  margin: 6px 0 2px 0;
}

.stat-meta {
  font-size: 0.84rem;
  color: var(--slate-400);
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tab {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all .15s;
}

.filter-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  flex: 1;
  max-width: 320px;
}

.search-box input {
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.88rem;
  width: 100%;
}

.btn-text-danger {
  background: none;
  border: none;
  color: var(--error);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
}

.btn-text-danger:hover {
  text-decoration: underline;
}

.questions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.grid-card {
  background: #ffffff;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
}

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

.grid-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.card-pill {
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--slate-100);
  color: var(--slate-700);
  padding: 2px 8px;
  border-radius: 4px;
}

.star-flag {
  margin-left: auto;
  font-size: 0.95rem;
  display: none;
}

.star-flag.active {
  display: inline;
}

.grid-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.grid-card-title a {
  color: var(--secondary);
  text-decoration: none;
}

.grid-card-title a:hover {
  color: var(--primary);
}

.grid-card-snippet {
  font-size: 0.88rem;
  color: var(--slate-500);
  line-height: 1.55;
  margin-bottom: 16px;
  flex: 1;
}

.grid-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--slate-100);
  padding-top: 12px;
  font-size: 0.82rem;
}

.card-opts-count {
  color: var(--slate-400);
  font-weight: 600;
}

.card-status-badge {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.card-status-badge.status-pending {
  background: var(--slate-100);
  color: var(--slate-500);
}

.card-status-badge.status-correct {
  background: #D1FAE5;
  color: #065F46;
}

.card-status-badge.status-incorrect {
  background: #FEE2E2;
  color: #991B1B;
}

.card-link {
  font-weight: 700;
  color: var(--primary-darker);
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

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

@media (max-width: 768px) {
  .top-bar-content { height: 56px; }
  .brand-text { display: none; }
  .question-card, .options-section, .explanation-card { padding: 20px; }
  .navigation-footer { flex-direction: column; }
  .nav-btn { width: 100%; justify-content: center; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
}
