/* ============================================================
   DiveLearn — Sistema de Diseño Oficial
   Colores: #5453eb (morado) · #e0f24a (lima) · #b2cafd (lavanda)
   Tipografía: Nunito (sustituto web de Symora)
   ============================================================ */

@font-face {
  font-family: 'Questrial';
  src: url('/fonts/questrial-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Symora';
  src: url('/fonts/symora.otf') format('opentype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Nunito como fallback web si Symora no carga */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --purple:        #5453eb;
  --purple-mid:    #7b7aff;
  --purple-light:  #b2cafd;
  --purple-pale:   rgba(84,83,235,0.12);
  --lime:          #e0f24a;
  --lime-dark:     #c5d63e;
  --lime-pale:     rgba(224,242,74,0.12);

  --bg:            #ffffff;
  --surface:       #f6f7ff;
  --surface2:      #eef2ff;
  --surface3:      #dfe3fb;
  --text:          #1f1d5c;
  --text-muted:    #55538a;
  --border:        rgba(84,83,235,0.22);
  --border-hover:  rgba(84,83,235,0.5);

  --glow-purple:   0 0 32px rgba(84,83,235,0.25);
  --glow-lime:     0 0 24px rgba(224,242,74,0.2);
  --shadow:        0 4px 24px rgba(84,83,235,0.12);

  --radius:        16px;
  --radius-sm:     10px;
  --radius-xs:     6px;
  --transition:    all 0.2s ease;

  --font:          'Symora', 'Questrial', 'Century Gothic', system-ui, -apple-system, sans-serif;
  --font-mono:     'Fira Code', 'Cascadia Code', 'Courier New', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(16px, 5vw, 40px) clamp(16px, 4vw, 32px);
}

/* ── Nav bar ─────────────────────────────────────────────── */
.dl-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 10px clamp(16px,4vw,32px);
  display: flex;
  align-items: center;
  gap: 14px;
}
.dl-nav-logo {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.dl-nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}
.dl-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}
.dl-nav-back:hover { color: var(--lime-texto); }
.dl-nav-sep { color: var(--surface3); font-size: 0.75rem; }
.dl-nav-current { color: var(--text); font-size: 0.85rem; font-weight: 600; }

/* ── Activity header ─────────────────────────────────────── */
.activity-header {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(24px,5vw,48px) clamp(20px,5vw,40px);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.activity-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: var(--purple);
  opacity: 0.06;
  border-radius: 50%;
}
.activity-header::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 10%;
  width: 140px; height: 140px;
  background: var(--lime);
  opacity: 0.04;
  border-radius: 50%;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}
.breadcrumb a {
  color: var(--lav-texto);
  text-decoration: none;
  transition: var(--transition);
}
.breadcrumb a:hover { color: var(--lime-texto); }
.breadcrumb-sep { color: var(--surface3); }
.breadcrumb-current { color: var(--text-muted); }

.activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--purple-pale);
  border: 1px solid var(--border);
  color: var(--lav-texto);
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.activity-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.activity-title span { color: var(--lime-texto); }

.activity-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 600;
}
/* legacy support */
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 600;
}
.activity-meta { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Cards ───────────────────────────────────────────────── */
.card, .main-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(20px,4vw,36px);
  margin-bottom: 20px;
}

.card-title, .section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::after, .section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section { margin-bottom: 32px; }

/* ── Buttons ─────────────────────────────────────────────── */
button, .btn {
  font-family: var(--font);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 11px 24px;
  font-size: 0.9rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

/* Primary — purple */
.btn-primary,
button:not([class*="secondary"]):not([class*="danger"]):not([class*="outline"]):not([class*="ghost"]):not([class*="lime"]) {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 2px 14px rgba(84,83,235,0.35);
}
.btn-primary:hover,
button:not([class*="secondary"]):not([class*="danger"]):not([class*="outline"]):not([class*="ghost"]):not([class*="lime"]):hover {
  background: var(--purple-mid);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(84,83,235,0.5);
}

/* Lime CTA */
.btn-lime, .control-btn.secondary, .calculate-btn {
  background: var(--lime) !important;
  color: #1f1d5c !important;
  box-shadow: 0 2px 14px rgba(224,242,74,0.25) !important;
  font-weight: 800 !important;
}
.btn-lime:hover, .control-btn.secondary:hover, .calculate-btn:hover {
  background: var(--lime-dark) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 20px rgba(224,242,74,0.35) !important;
}

/* Danger */
.btn-danger, .control-btn.danger {
  background: #e53e3e !important;
  color: #fff !important;
}
.btn-danger:hover, .control-btn.danger:hover {
  background: #c53030 !important;
}

/* Outline */
.btn-outline {
  background: transparent;
  border: 2px solid var(--purple);
  color: var(--lav-texto);
}
.btn-outline:hover {
  background: var(--purple-pale);
  border-color: var(--purple-mid);
}

/* Nav buttons */
.nav-btn {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
.nav-btn:hover {
  border-color: var(--purple) !important;
  background: var(--purple-pale) !important;
  transform: translateY(-1px) !important;
}
.nav-btn.secondary {
  background: var(--lime) !important;
  color: #1f1d5c !important;
  border-color: transparent !important;
}
.nav-btn.secondary:hover {
  background: var(--lime-dark) !important;
  transform: translateY(-1px) !important;
}

/* Topology / selector buttons */
.topology-btn, .option-btn, .selector-btn {
  background: var(--surface2) !important;
  border: 2px solid var(--border) !important;
  color: var(--text-muted) !important;
  padding: 9px 18px !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  font-weight: 700 !important;
  font-family: var(--font) !important;
  font-size: 0.85rem !important;
  transition: var(--transition) !important;
  box-shadow: none !important;
}
.topology-btn:hover, .option-btn:hover {
  border-color: var(--purple) !important;
  color: var(--text) !important;
  background: var(--purple-pale) !important;
  transform: translateY(-1px) !important;
}
.topology-btn.active, .option-btn.active {
  background: var(--purple) !important;
  color: #fff !important;
  border-color: var(--purple) !important;
}

/* ── Inputs ──────────────────────────────────────────────── */
input:not([type="button"]):not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
textarea, select, .input-field {
  font-family: var(--font);
  font-weight: 500;
  background: var(--surface2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 0.95rem;
  width: 100%;
  transition: var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus, .input-field:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(84,83,235,0.18);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}
label, .input-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

/* ── Tables ──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; border-radius: var(--radius-sm); overflow: hidden; }
th {
  background: var(--purple);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
td {
  background: var(--surface2);
  color: var(--text);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
tr:hover td { background: var(--surface3); }
tr:last-child td { border-bottom: none; }

/* ── Feedback boxes ──────────────────────────────────────── */
.feedback-success, .result-success, .feedback.correct-feedback {
  background: var(--lime-pale);
  border: 1px solid rgba(224,242,74,0.3);
  border-left: 4px solid var(--lime);
  color: var(--text);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.feedback-info, .result-info, .feedback-area {
  background: var(--purple-pale);
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple);
  color: var(--text);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.feedback-error, .result-error, .feedback.wrong-feedback {
  background: rgba(229,62,62,0.1);
  border: 1px solid rgba(229,62,62,0.3);
  border-left: 4px solid #e53e3e;
  color: var(--text);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* ── Tips / highlight box ────────────────────────────────── */
.tips-section, .tip-box, .info-box {
  background: rgba(224,242,74,0.05);
  border: 1px solid rgba(224,242,74,0.2);
  border-left: 4px solid var(--lime);
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  margin: 24px 0;
}
.tips-title {
  color: var(--lime-texto);
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tip-item {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 6px 0;
  line-height: 1.6;
}
.tip-item strong { color: var(--text); }

/* ── Device palette (drag-drop) ──────────────────────────── */
.device-palette {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.device-item {
  background: linear-gradient(135deg, var(--purple), var(--purple-mid));
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-xs);
  cursor: grab;
  font-weight: 700;
  font-size: 0.85rem;
  transition: var(--transition);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  box-shadow: 0 2px 10px rgba(84,83,235,0.3);
}
.device-item:hover { transform: translateY(-2px); box-shadow: 0 4px 18px rgba(84,83,235,0.45); }
.device-item:active { cursor: grabbing; transform: scale(0.97); }
.device-item.router   { background: linear-gradient(135deg,#22c55e,#16a34a); box-shadow: 0 2px 10px rgba(34,197,94,0.3); }
.device-item.switch   { background: linear-gradient(135deg,var(--purple),var(--purple-mid)); }
.device-item.computer { background: linear-gradient(135deg,#f59e0b,#d97706); box-shadow: 0 2px 10px rgba(245,158,11,0.3); }
.device-item.server   { background: linear-gradient(135deg,#e53e3e,#c53030); box-shadow: 0 2px 10px rgba(229,62,62,0.3); }
.device-item.wifi     { background: linear-gradient(135deg,#0891b2,#0e7490); box-shadow: 0 2px 10px rgba(8,145,178,0.3); }

/* ── Interactive containers ──────────────────────────────── */
.topology-selector, .controls, .button-group, .action-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin: 16px 0 !important;
}

.calculator-container, .input-container, .tool-container,
.comparison-container, .simulator-container, .editor-container {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin: 16px 0;
}

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

.input-group { margin-bottom: 16px; }

.results-area { margin-top: 20px; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.dropped-device {
  position: absolute;
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: move;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 12px rgba(84,83,235,0.12);
}

/* ── Canvas / drop zones ─────────────────────────────────── */
.canvas, .drop-zone, .design-area {
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 300px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.canvas:hover, .design-area:hover { border-color: var(--purple); }
.connection-line {
  position: absolute;
  height: 2px;
  background: var(--purple-light);
  transform-origin: left center;
  z-index: 1;
  opacity: 0.7;
}

/* ── Quiz components ─────────────────────────────────────── */
.quiz-container, .question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.progress-header {
  background: linear-gradient(135deg, var(--purple), var(--purple-mid));
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.progress-info { color: rgba(255,255,255,0.85); font-size: 0.85rem; font-weight: 600; }
.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--lime);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.question-container { padding: 32px 28px; }
.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: var(--purple);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.question-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 22px;
  line-height: 1.5;
}
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: pointer;
  transition: var(--transition);
}
.option:hover { border-color: var(--purple); background: var(--purple-pale); transform: translateX(3px); }
.option.selected { border-color: var(--purple); background: var(--purple-pale); }
.option.correct  { border-color: var(--lime); background: var(--lime-pale); }
.option.wrong    { border-color: #e53e3e; background: rgba(229,62,62,0.1); }
.option-label { font-weight: 700; color: var(--text); margin-bottom: 3px; font-size: 0.9rem; }
.option-text  { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.feedback { margin-top: 14px; display: none; }
.feedback.show { display: block; }
.navigation, .nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.completion-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.status-indicator {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface3);
  transition: var(--transition);
}
.status-indicator.done { background: var(--lime); box-shadow: 0 0 8px var(--lime); }

/* ── Score / results ─────────────────────────────────────── */
.score-display, .final-score, .results-screen {
  text-align: center;
  padding: 40px 24px;
}
.score-number {
  font-size: clamp(3rem,8vw,5rem);
  font-weight: 900;
  color: var(--lime-texto);
  line-height: 1;
  display: block;
  margin-bottom: 8px;
}
.score-label { color: var(--text-muted); font-weight: 600; font-size: 1rem; }
.result-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 12px;
}
.result-card-title { font-weight: 800; color: var(--text); margin-bottom: 4px; }
.result-card-value { font-size: 1.8rem; font-weight: 900; color: var(--lime-texto); }

/* ── Code ────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  background: var(--surface3);
  color: var(--lime-texto);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.88em;
}
pre {
  font-family: var(--font-mono);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  color: var(--lime-texto);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ── Footer brand ────────────────────────────────────────── */
.footer, .divelearn-brand {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.divelearn-brand { color: var(--lav-texto); }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.anim-fade-up { animation: fadeInUp 0.4s ease both; }
.anim-fade    { animation: fadeIn 0.3s ease both; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .activity-meta { gap: 8px; }
  .meta-chip, .meta-item { font-size: 0.78rem; padding: 5px 10px; }
  .navigation, .nav-buttons { flex-direction: column; }
  .navigation button, .nav-buttons button { width: 100%; justify-content: center; }
  .question-container { padding: 20px 16px; }
  .device-palette { gap: 8px; }
  .device-item { font-size: 0.8rem; padding: 8px 12px; }
}

@view-transition {
  navigation: auto;
}
