/* ============================================
   CURSO IFCD 0110 - ESTILOS PRINCIPALES
   Diseño Moderno con Glassmorphism
   ============================================ */

/* Variables CSS */
:root {
  /* Colores principales */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --dark-gradient: linear-gradient(135deg, #0c0c1e 0%, #1a1a3e 100%);

  /* Colores de tecnologías */
  --html-color: #e34c26;
  --css-color: #264de4;
  --js-color: #f7df1e;
  --notepad-color: #90c24a;
  --gimp-color: #8c7748;

  /* Colores de UI */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.08);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);

  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(102, 126, 234, 0.5);

  /* Sombras */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.3);

  /* Tipografía */
  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Fira Code", "Consolas", monospace;

  /* Animaciones */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Espaciado */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Bordes */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 50px;
}

/* Reset y base */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-primary);
  background: var(--dark-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Partículas de fondo */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(102, 126, 234, 0.6);
  border-radius: 50%;
  animation: float 15s infinite ease-in-out;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-md) var(--spacing-xl);
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-xl);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.logo-icon {
  width: 50px;
  height: 50px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-glow);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: var(--shadow-glow);
  }
  50% {
    box-shadow: 0 0 50px rgba(102, 126, 234, 0.5);
  }
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Navegación principal */
.main-nav {
  display: flex;
  gap: var(--spacing-sm);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.nav-btn.active {
  background: var(--primary-gradient);
  color: var(--text-primary);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.nav-btn i {
  font-size: 1.1rem;
}

.nav-btn[data-section="html"] i {
  color: var(--html-color);
}
.nav-btn[data-section="css"] i {
  color: var(--css-color);
}
.nav-btn[data-section="wordpress"] i {
  color: #21759b;
}
.nav-btn[data-section="notepad"] i {
  color: var(--notepad-color);
}
.nav-btn[data-section="gimp"] i {
  color: var(--gimp-color);
}

.nav-btn.active i {
  color: var(--text-primary);
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.main-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  width: 100%;
  max-width: 100vw;
  padding: var(--spacing-md);
  gap: var(--spacing-md);
  min-height: calc(100vh - 80px);
  position: relative;
  z-index: 1;
  overflow-x: hidden;
}

/* ============================================
   PANEL DE LECCIONES
   ============================================ */
.lessons-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(10px);
  height: fit-content;
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 100px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.panel-header i {
  color: #667eea;
  font-size: 1.2rem;
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.lessons-list {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  max-height: 500px;
  overflow-y: auto;
}

.lessons-list::-webkit-scrollbar {
  width: 6px;
}

.lessons-list::-webkit-scrollbar-track {
  background: transparent;
}

.lessons-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: left;
  width: 100%;
}

.lesson-item:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.lesson-item.active {
  background: rgba(102, 126, 234, 0.2);
  color: var(--text-primary);
  border-left: 3px solid #667eea;
}

.lesson-item.completed .lesson-number {
  background: linear-gradient(135deg, #00d9a5 0%, #00b894 100%);
}

.lesson-number {
  width: 28px;
  height: 28px;
  background: var(--bg-glass);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.lesson-item.active .lesson-number {
  background: var(--primary-gradient);
}

/* Separadores de nivel */
.level-separator {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  margin: var(--spacing-sm) 0;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
}

.level-badge {
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.level-name {
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   ÁREA DE CONTENIDO
   ============================================ */
.content-area {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Header de lección */
.lesson-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.lesson-badge {
  width: 48px;
  height: 48px;
  background: var(--primary-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.lesson-badge.html {
  background: linear-gradient(135deg, #e34c26 0%, #f16529 100%);
}
.lesson-badge.css {
  background: linear-gradient(135deg, #264de4 0%, #2965f1 100%);
}
.lesson-badge.wordpress {
  background: linear-gradient(135deg, #21759b 0%, #464646 100%);
}
.lesson-badge.notepad {
  background: linear-gradient(135deg, #90c24a 0%, #73a839 100%);
}
.lesson-badge.gimp {
  background: linear-gradient(135deg, #8c7748 0%, #5c4e30 100%);
}

.lesson-info {
  flex: 1;
}

.lesson-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.lesson-info p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Anillo de progreso */
.progress-ring {
  width: 48px;
  height: 48px;
  position: relative;
  flex-shrink: 0;
}

.progress-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.progress-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 3;
}

.progress-bar {
  fill: none;
  stroke: url(#progressGradient);
  stroke: #667eea;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray var(--transition-slow);
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Card de contenido - Explicación compacta */
.content-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lesson-content {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.glass-effect {
  backdrop-filter: blur(10px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.card-header i {
  color: #f7df1e;
  font-size: 1rem;
}

.card-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.card-body {
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.card-body > * {
  flex: 1;
  min-width: 200px;
}

.card-body p {
  margin-bottom: var(--spacing-md);
}

.card-body p:last-child {
  margin-bottom: 0;
}

.card-body code {
  background: rgba(102, 126, 234, 0.2);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9em;
  word-break: break-word;
}

.card-body ul,
.card-body ol {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.card-body li {
  margin-bottom: var(--spacing-sm);
}

.card-body strong {
  color: var(--text-primary);
}

/* ============================================
   EDITOR Y VISTA PREVIA
   ============================================ */
.editor-preview-container {
  display: grid;
  grid-template-columns: 1fr 8px 1fr;
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 400px;
  max-width: 100%;
}

/* Editor de código */
.editor-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  background: #1e1e3f;
  border-bottom: 1px solid var(--border-color);
}

.editor-tabs {
  display: flex;
  gap: var(--spacing-xs);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-glass);
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.tab-btn i {
  font-size: 0.9rem;
}

.editor-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.action-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

/* Editor wrapper */
.editor-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
  background: #1a1a2e;
}

.line-numbers {
  padding: var(--spacing-sm) var(--spacing-md);
  background: #16162a;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  text-align: right;
  user-select: none;
  min-width: 40px;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
}

.code-editor {
  position: absolute;
  top: 0;
  left: 40px;
  right: 0;
  bottom: 0;
  padding: var(--spacing-sm);
  background: transparent;
  border: none;
  color: transparent;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  caret-color: #667eea;
  z-index: 2;
  white-space: pre;
  overflow: auto;
  word-wrap: normal;
  tab-size: 2;
}

.code-highlight {
  position: absolute;
  top: 0;
  left: 40px;
  right: 0;
  bottom: 0;
  padding: var(--spacing-sm);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
  pointer-events: none;
  z-index: 1;
  color: var(--text-primary);
  word-wrap: normal;
}

/* Scrollbar para el editor */
.code-editor::-webkit-scrollbar,
.code-highlight::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.code-editor::-webkit-scrollbar-track,
.code-highlight::-webkit-scrollbar-track {
  background: #16162a;
}

.code-editor::-webkit-scrollbar-thumb,
.code-highlight::-webkit-scrollbar-thumb {
  background: #3d3d5c;
  border-radius: 4px;
}

.code-editor::-webkit-scrollbar-thumb:hover,
.code-highlight::-webkit-scrollbar-thumb:hover {
  background: #5a5a8a;
}

/* Resaltado de sintaxis */
.code-highlight .tag {
  color: #ff6b6b;
}
.code-highlight .attr {
  color: #ffd93d;
}
.code-highlight .value {
  color: #6bcb77;
}
.code-highlight .comment {
  color: #6c757d;
  font-style: italic;
}
.code-highlight .string {
  color: #6bcb77;
}
.code-highlight .property {
  color: #4ecdc4;
}
.code-highlight .selector {
  color: #ff6b6b;
}
.code-highlight .number {
  color: #f093fb;
}
.code-highlight .keyword {
  color: #c792ea;
}

/* Separador */
.resizer {
  background: var(--bg-secondary);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.resizer:hover {
  background: rgba(102, 126, 234, 0.3);
}

.resizer-handle {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Vista previa */
.preview-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: #f0f0f5;
  border-bottom: 1px solid #ddd;
}

.browser-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red {
  background: #ff5f57;
}
.dot.yellow {
  background: #febc2e;
}
.dot.green {
  background: #28c840;
}

.url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-md);
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: #666;
}

.url-bar i {
  color: #28c840;
  font-size: 0.7rem;
}

.preview-actions button {
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  padding: var(--spacing-xs);
  transition: color var(--transition-fast);
}

.preview-actions button:hover {
  color: #333;
}

.preview-wrapper {
  flex: 1;
  overflow: hidden;
}

.preview-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* ============================================
   NAVEGACIÓN DE LECCIONES
   ============================================ */
.lesson-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg) 0;
  flex-wrap: wrap;
}

.nav-lesson-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.nav-lesson-btn:hover:not(:disabled) {
  background: var(--primary-gradient);
  color: var(--text-primary);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.nav-lesson-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lesson-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Botones de página */
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover:not(.active) {
  background: rgba(102, 126, 234, 0.2);
  color: var(--text-primary);
  border-color: rgba(102, 126, 234, 0.5);
  transform: translateY(-2px);
}

.page-btn.active {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transform: scale(1.1);
}

/* Puntos suspensivos */
.page-ellipsis {
  color: var(--text-muted);
  padding: 0 4px;
  font-size: 0.9rem;
  user-select: none;
}

/* ============================================
   TOAST NOTIFICACIONES
   ============================================ */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: linear-gradient(135deg, #00d9a5 0%, #00b894 100%);
  color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-normal);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast i {
  font-size: 1.2rem;
}

/* ============================================
   MODAL PANTALLA COMPLETA
   ============================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 90%;
  height: 85%;
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: rotate(90deg);
}

#fullscreenFrame {
  width: 100%;
  height: 100%;
  border: none;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Pantallas grandes - mantener sidebar */
@media (max-width: 1400px) {
  .main-container {
    grid-template-columns: 240px 1fr;
  }
}

/* Tablets y pantallas medianas */
@media (max-width: 900px) {
  .main-container {
    grid-template-columns: 1fr;
  }

  .lessons-panel {
    position: static;
    max-height: none;
  }

  .lessons-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    max-height: none;
  }
  
  .card-body {
    flex-direction: column;
  }
  
  .card-body > * {
    min-width: 100%;
  }
}

/* Tablets pequeñas - 768px */
@media (max-width: 768px) {
  .header {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .header-content {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .logo-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .logo-text h1 {
    font-size: 1.2rem;
  }

  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-xs);
  }

  .nav-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }

  .nav-btn span {
    display: none;
  }

  .nav-btn i {
    font-size: 1rem;
  }

  .editor-preview-container {
    grid-template-columns: 1fr;
    grid-template-rows: 280px 8px 280px;
    min-height: auto;
  }

  .resizer {
    cursor: row-resize;
    height: 8px;
    width: 100%;
  }

  .resizer-handle i {
    transform: rotate(90deg);
  }

  .lesson-header {
    padding: var(--spacing-md);
    gap: var(--spacing-md);
  }

  .lesson-badge {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .lesson-info h2 {
    font-size: 1.2rem;
  }

  .progress-ring {
    width: 50px;
    height: 50px;
  }
}

/* Móviles */
@media (max-width: 600px) {
  :root {
    --spacing-lg: 1rem;
    --spacing-xl: 1.25rem;
  }

  .header {
    padding: var(--spacing-sm);
  }

  .logo-section {
    gap: var(--spacing-sm);
  }

  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .logo-text h1 {
    font-size: 1rem;
  }

  .logo-text span {
    font-size: 0.7rem;
  }

  .main-nav {
    width: 100%;
    justify-content: space-around;
  }

  .nav-btn {
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    flex: 1;
    justify-content: center;
    max-width: 60px;
  }

  .main-container {
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
  }

  .lessons-panel {
    border-radius: var(--radius-md);
  }

  .panel-header {
    padding: var(--spacing-md);
  }

  .panel-header h2 {
    font-size: 1rem;
  }

  .lessons-list {
    padding: var(--spacing-sm);
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xs);
  }

  .lesson-item {
    padding: var(--spacing-sm);
    font-size: 0.75rem;
    gap: var(--spacing-sm);
  }

  .lesson-number {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }

  .lesson-header {
    flex-direction: column;
    text-align: center;
    padding: var(--spacing-md);
    gap: var(--spacing-sm);
  }

  .lesson-badge {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }

  .lesson-info h2 {
    font-size: 1.1rem;
  }

  .lesson-info p {
    font-size: 0.85rem;
  }

  .progress-ring {
    width: 45px;
    height: 45px;
  }

  .progress-text {
    font-size: 0.65rem;
  }

  .content-card {
    border-radius: var(--radius-md);
  }

  .card-header {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .card-header h3 {
    font-size: 0.9rem;
  }

  .card-body {
    padding: var(--spacing-md);
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .card-body code {
    font-size: 0.8em;
    padding: 1px 5px;
  }

  .editor-preview-container {
    grid-template-columns: 1fr;
    grid-template-rows: 250px 8px 250px;
    border-radius: var(--radius-md);
  }

  .editor-header {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .tab-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
  }

  .action-btn {
    width: 28px;
    height: 28px;
  }

  .line-numbers {
    font-size: 0.6rem;
    min-width: 30px;
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .code-editor,
  .code-highlight {
    left: 30px;
    font-size: 0.6rem;
    line-height: 1.4;
    padding: var(--spacing-xs);
  }

  .preview-header {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .browser-dots {
    gap: 4px;
  }

  .dot {
    width: 8px;
    height: 8px;
  }

  .url-bar {
    font-size: 0.65rem;
    padding: 2px var(--spacing-sm);
  }

  .lesson-navigation {
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
  }

  .nav-lesson-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
    width: 100%;
    justify-content: center;
  }

  .lesson-dots {
    order: -1;
    flex-wrap: wrap;
    justify-content: center;
  }

  .lesson-dot {
    width: 8px;
    height: 8px;
  }

  .toast {
    bottom: 15px;
    right: 15px;
    left: 15px;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
  }

  .modal-content {
    width: 95%;
    height: 90%;
    border-radius: var(--radius-md);
  }

  .modal-close {
    width: 35px;
    height: 35px;
    top: 10px;
    right: 10px;
  }
}

/* Móviles muy pequeños */
@media (max-width: 380px) {
  .lessons-list {
    grid-template-columns: 1fr;
  }

  .nav-btn {
    max-width: 50px;
  }

  .editor-preview-container {
    grid-template-rows: 200px 8px 200px;
  }
}

/* ============================================
   ANIMACIONES ADICIONALES
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.content-area > * {
  animation: fadeIn 0.5s ease forwards;
}

.content-area > *:nth-child(1) {
  animation-delay: 0.1s;
}
.content-area > *:nth-child(2) {
  animation-delay: 0.2s;
}
.content-area > *:nth-child(3) {
  animation-delay: 0.3s;
}
.content-area > *:nth-child(4) {
  animation-delay: 0.4s;
}

.lesson-item {
  animation: slideInLeft 0.3s ease forwards;
  opacity: 0;
}

.lesson-item:nth-child(1) {
  animation-delay: 0.1s;
}
.lesson-item:nth-child(2) {
  animation-delay: 0.15s;
}
.lesson-item:nth-child(3) {
  animation-delay: 0.2s;
}
.lesson-item:nth-child(4) {
  animation-delay: 0.25s;
}
.lesson-item:nth-child(5) {
  animation-delay: 0.3s;
}
.lesson-item:nth-child(6) {
  animation-delay: 0.35s;
}

/* ============================================
   ESTILOS WORDPRESS LESSONS
   ============================================ */
.wp-lesson {
  padding: 10px 0;
}

.wp-lesson h4 {
  color: var(--text-primary);
  margin: 15px 0 10px 0;
  font-size: 1rem;
}

.wp-lesson h4:first-child {
  margin-top: 0;
}

.wp-image {
  width: 100%;
  max-width: 500px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid var(--border-color);
}

.wp-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.wp-feature {
  background: var(--bg-glass);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.wp-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.85rem;
}

.wp-table th,
.wp-table td {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.wp-table th {
  background: var(--bg-glass);
  font-weight: 600;
}

.wp-table tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

.wp-lesson mark {
  background: rgba(102, 126, 234, 0.3);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 3px;
}

.wp-lesson a {
  color: #667eea;
}

.wp-lesson a:hover {
  text-decoration: underline;
}

/* ============================================
   PREVENIR DESBORDAMIENTO GLOBAL
   ============================================ */
.content-area {
  max-width: 100%;
  overflow-x: hidden;
}

.content-area pre,
.card-body pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.content-area table,
.card-body table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  word-wrap: break-word;
}

.content-area img,
.card-body img {
  max-width: 100%;
  height: auto;
}

/* Evitar que código largo cause scroll */
.editor-wrapper,
.editor-section {
  max-width: 100%;
  overflow: hidden;
}

.preview-section {
  max-width: 100%;
  overflow: hidden;
}
