/* ========================================
   VARIABLES GLOBALES
   ======================================== */
   :root {
    --primary-color: #0088ff;
    --primary-hover: #0077ee;
    --primary-active: #0066dd;
    
    --secondary-color: #f0f0f0;
    --secondary-hover: #e0e0e0;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    
    --border-color: #e0e0e0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    --sidebar-width: 240px;
    --header-height: 64px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    --transition: all 0.2s ease;
  }
  
  /* ========================================
     RESET Y BASE
     ======================================== */
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    overflow-x: hidden;
  }
  

  /* Scroll suave en toda la página */
html {
  scroll-behavior: smooth;
}

/* Mejorar scroll en la sección de contenido */
.main-content::-webkit-scrollbar {
  width: 12px;
}

.main-content::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 10px;
}

.main-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}
  /* ========================================
     LAYOUT - PANTALLA DE INICIO
     ======================================== */
   .home-page {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
  }
  
  /* ========================================
     BARRA LATERAL
     ======================================== */
  .sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 100;
  }
  
  .sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
  }
  
  .logo-icon {
    font-size: 24px;
  }
  
  .sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
  }
  
  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    margin-bottom: 4px;
  }
  
  .nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
  }
  
  .nav-item.active {
    background: var(--primary-color);
    color: white;
  }
  
  .nav-icon {
    font-size: 18px;
    flex-shrink: 0;
  }
  
  .nav-text {
    flex: 1;
  }
  
  .nav-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
  }
  
  .nav-item.active .nav-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
  }
  
  .nav-separator {
    height: 1px;
    background: var(--border-color);
    margin: 12px 0;
  }
  
  .sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
  }
  
  .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    cursor: pointer;
  }
  
  .user-info:hover {
    background: var(--bg-secondary);
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }
  
  .user-details {
    flex: 1;
    min-width: 0;
  }
  
  .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .user-status {
    font-size: 11px;
    color: var(--text-tertiary);
  }
  
  /* ========================================
     CONTENIDO PRINCIPAL
     ======================================== */
   .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
  }
  
  .top-bar {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    gap: 24px;
    box-shadow: var(--shadow-sm);
    z-index: 50;
  }
  
  .search-container {
    flex: 1;
    max-width: 600px;
  }
  
  .search-input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    background: var(--bg-secondary);
    transition: var(--transition);
  }
  
  .search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.1);
  }
  
  .header-actions {
    display: flex;
    gap: 12px;
  }
  
  /* ========================================
     SECCIÓN HERO
     ======================================== */
   .hero-section {
    padding: 60px 32px 40px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0; /* No se comprime */
  }
  
  .hero-title {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
  }
  
  .hero-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 32px;
  }
  
  .quick-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  /* ========================================
     SECCIÓN DE PROYECTOS
     ======================================== */
   .projects-section {
    padding: 48px 32px;
    min-height: 400px; /* Altura mínima garantizada */
  }
  
  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
  }
  
  .section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
  }
  
  .btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
  }
  
  .btn-text:hover {
    background: rgba(0, 136, 255, 0.1);
  }
  
  .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
    max-height: 450px; /* Altura máxima para 1-2 filas */
  }
  
  .project-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
  }
  
  .project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
  }
  
  .project-thumbnail {
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  
  .project-icon {
    font-size: 64px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  }
  
  .project-info {
    padding: 16px;
  }
  
  .project-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .project-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
  }
  
  .project-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .project-date {
    font-size: 12px;
    color: var(--text-tertiary);
  }
  
  .project-actions {
    display: flex;
    gap: 4px;
  }
  
  .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
  }
  
  .btn-icon:hover {
    background: var(--bg-secondary);
  }
  
  /* ========================================
     ESTADO VACÍO
     ======================================== */
  .empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
  }
  
  .empty-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
  }
  
  .empty-state h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
  }
  
  .empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
  }
  
  /* ========================================
     BOTONES
     ======================================== */
  .btn-primary,
  .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
  }
  
  .btn-primary {
    background: var(--primary-color);
    color: white;
  }
  
  .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }
  
  .btn-primary:active {
    background: var(--primary-active);
    transform: translateY(0);
  }
  
  .btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
  }
  
  .btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-tertiary);
  }
  
  .btn-large {
    padding: 16px 32px;
    font-size: 16px;
  }
  
  .btn-icon-only {
    padding: 12px;
    aspect-ratio: 1;
  }
  
  /* ========================================
     MODALES
     ======================================== */
  .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
  }
  
  .modal.active {
    display: flex;
  }
  
  .modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
  }
  
  .modal-large {
    max-width: 800px;
  }
  
  @keyframes modalSlideIn {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
  }
  
  .modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
  }
  
  .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
  }
  
  .modal-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
  }
  
  .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
  }
  
  /* ========================================
     FORMULARIOS
     ======================================== */
  .form-group {
    margin-bottom: 20px;
  }
  
  .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
  }
  
  .form-input,
  .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-secondary);
  }
  
  .form-input:focus,
  .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.1);
  }
  
  .form-textarea {
    resize: vertical;
    min-height: 80px;
  }
  
  .code-input {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    border-color: #3e3e42;
  }
  
  .code-input:focus {
    background: #252526;
    border-color: var(--primary-color);
  }
  
  .import-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    color: #856404;
    margin-top: 16px;
  }
  
  .info-icon {
    font-size: 20px;
    flex-shrink: 0;
  }
  
  
  
  /* ========================================
     RESPONSIVE
     ======================================== */
  @media (max-width: 768px) {
    .sidebar {
      width: 80px;
    }
    
    .logo-text,
    .nav-text,
    .nav-badge,
    .user-details {
      display: none;
    }
    
    .nav-item {
      justify-content: center;
    }
    
    .hero-title {
      font-size: 32px;
    }
    
    .quick-actions {
      flex-direction: column;
    }
    
    .projects-grid {
      grid-template-columns: 1fr;
    }
  }
  
  /* ========================================
     ESTILOS DEL EDITOR (editor.html)
     ======================================== */
  .editor-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  
  .editor-header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 24px;
    box-shadow: var(--shadow-sm);
    z-index: 100;
  }
  
  .editor-title-section {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  
  .back-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
  }
  
  .back-button:hover {
    background: var(--border-color);
  }
  
  .editor-title-input {
    font-size: 18px;
    font-weight: 600;
    border: 1px solid transparent;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    background: transparent;
    transition: var(--transition);
    min-width: 200px;
  }
  
  .editor-title-input:hover {
    background: var(--bg-secondary);
  }
  
  .editor-title-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
  }
  
  .editor-actions {
    display: flex;
    gap: 12px;
  }
  
  .editor-container {
    display: flex;
    flex: 1;
    overflow: hidden;
  }
  
  #blocklyDiv {
    flex: 1;
    min-width: 400px;
  }
  
  .code-panel {
    width: 450px;
    background: #252526;
    border-left: 1px solid #3e3e42;
    display: flex;
    flex-direction: column;
  }
  
  .code-header {
    background: #2d2d30;
    padding: 10px 15px;
    border-bottom: 1px solid #3e3e42;
    font-weight: 600;
    font-size: 13px;
    color: #cccccc;
  }
  
  #codeOutput {
    flex: 1;
    padding: 15px;
    overflow: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #1e1e1e;
    color: #d4d4d4;
    white-space: pre;
  }
  
  .code-actions {
    padding: 10px 15px;
    background: #2d2d30;
    border-top: 1px solid #3e3e42;
    display: flex;
    gap: 10px;
  }
  
  .copy-btn {
    background: #0e639c;
    flex: 1;
  }
  
  .copy-btn.copied {
    background: #16825d;
  }
  
  .save-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
  }
  
  .save-indicator.saving {
    color: var(--primary-color);
  }
  
  .save-indicator.saved {
    color: #16825d;
  }

  /* ========================================
   PLANTILLAS - ESTILOS MEJORADOS
   ======================================== */
   .templates-section {
    padding: 48px 32px 80px; /* Más padding abajo */
    background: white;
    border-top: 1px solid var(--border-color);
  }

  .projects-section .section-header {
    margin-bottom: 32px; /* Más espacio después del título */
  }
  
  .templates-section .section-header {
    margin-bottom: 32px;
  }
  
  /* Más espacio entre las grid cards */
  .projects-grid {
    margin-bottom: 40px; /* Espacio después de los proyectos recientes */
  }

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.template-card {
  padding: 24px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: white;
  position: relative;
  overflow: hidden;
}

.template-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.template-card:hover::before {
  transform: scaleX(1);
}

.template-card:hover {
  border-color: var(--primary-color);
  background: rgba(0, 136, 255, 0.02);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.template-preview {
  font-size: 64px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  transition: var(--transition);
}

.template-card:hover .template-preview {
  transform: scale(1.1);
}

.template-card h4 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.template-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.template-badge {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  margin-top: 8px;
}

.template-card:hover .template-badge {
  background: var(--primary-color);
  color: white;
}

/* ========================================
   MODAL DE PLANTILLA
   ======================================== */
.template-preview-large {
  font-size: 120px;
  text-align: center;
  margin-bottom: 24px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.template-description {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.6;
}

.template-features {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 24px;
}

.template-features h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.template-features ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.template-features li {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 8px 0;
  padding-left: 28px;
  position: relative;
  line-height: 1.5;
}

.template-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 16px;
}

/* Responsive para plantillas */
@media (max-width: 768px) {
  .templates-grid {
    grid-template-columns: 1fr;
  }
  
  .template-preview-large {
    font-size: 80px;
  }
}

/* ========================================
   FILTROS Y BÚSQUEDA
   ======================================== */
   .project-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
  }
  
  .filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .filter-tab {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    white-space: nowrap;
  }
  
  .filter-tab:hover {
    background: var(--bg-secondary);
    border-color: var(--text-tertiary);
  }
  
  .filter-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
  }
  
  .filter-sort {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .sort-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    color: var(--text-primary);
    min-width: 180px;
  }
  
  .sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.1);
  }
  
  .sort-select:hover {
    border-color: var(--text-tertiary);
  }
  
  /* ========================================
     BADGES Y INDICADORES
     ======================================== */
  .favorite-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: favoritePulse 2s ease-in-out infinite;
  }
  
  @keyframes favoritePulse {
    0%, 100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.1);
    }
  }
  
  /* ========================================
     ACCIONES DE PROYECTO MEJORADAS
     ======================================== */
  .project-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
  }
  
  .project-card:hover .project-actions {
    opacity: 1;
  }
  
  .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
  }
  
  .btn-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
  }
  
  .btn-icon:active {
    transform: scale(0.95);
  }
  
  /* Colores específicos para cada acción */
  .btn-icon:nth-child(1):hover {
    background: #ffd700; /* Dorado para favorito */
  }
  
  .btn-icon:nth-child(2):hover {
    background: #4CAF50; /* Verde para duplicar */
  }
  
  .btn-icon:nth-child(3):hover {
    background: #f44336; /* Rojo para eliminar */
  }
  
  /* ========================================
     ESTADOS MEJORADOS
     ======================================== */
  .empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    background: white;
    border-radius: var(--border-radius);
    margin: 20px 0;
  }
  
  .empty-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
    animation: emptyFloat 3s ease-in-out infinite;
  }
  
  @keyframes emptyFloat {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-10px);
    }
  }
  
  .empty-state h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
  }
  
  .empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
  }
  
  /* ========================================
     PROYECTO CARD - MEJORAS
     ======================================== */
  .project-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
  }
  
  .project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color) 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    z-index: 1;
  }
  
  .project-card:hover::before {
    transform: scaleX(1);
  }
  
  .project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
  }
  
  .project-thumbnail {
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }
  
  .project-icon {
    font-size: 64px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: var(--transition);
  }
  
  .project-card:hover .project-icon {
    transform: scale(1.1) rotate(5deg);
  }
  
  /* ========================================
     BÚSQUEDA - ESTADO DE RESULTADOS
     ======================================== */
  .search-results-info {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .search-results-info strong {
    color: var(--primary-color);
    font-weight: 600;
  }
  
  /* ========================================
     RESPONSIVE - FILTROS
     ======================================== */
  @media (max-width: 768px) {
    .project-filters {
      flex-direction: column;
      align-items: stretch;
    }
    
    .filter-tabs {
      justify-content: center;
    }
    
    .filter-sort {
      width: 100%;
    }
    
    .sort-select {
      width: 100%;
    }
    
    .filter-tab {
      flex: 1;
      min-width: 0;
      font-size: 12px;
      padding: 8px 12px;
    }
    
    .project-actions {
      opacity: 1; /* Siempre visible en móvil */
    }
    
    .favorite-badge {
      font-size: 20px;
    }
  }
  
  /* ========================================
     ANIMACIONES ADICIONALES
     ======================================== */
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .project-card {
    animation: fadeIn 0.3s ease;
  }
  
  .project-card:nth-child(1) { animation-delay: 0s; }
  .project-card:nth-child(2) { animation-delay: 0.05s; }
  .project-card:nth-child(3) { animation-delay: 0.1s; }
  .project-card:nth-child(4) { animation-delay: 0.15s; }
  .project-card:nth-child(5) { animation-delay: 0.2s; }
  .project-card:nth-child(6) { animation-delay: 0.25s; }
  
  /* ========================================
     MEJORAS VISUALES - GRID
     ======================================== */
  .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
  }
  
  /* Cuando hay pocos proyectos, no expandir demasiado */
  .projects-grid:has(.project-card:nth-child(-n+3)) {
    grid-template-columns: repeat(auto-fit, minmax(280px, 350px));
  }
  
  /* ========================================
     BOTÓN VOLVER A RECIENTES
     ======================================== */
  #backToRecent {
    margin-top: 32px;
    padding-bottom: 32px;
  }
  
  #backToRecent .btn-secondary {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
  }
  
  #backToRecent .btn-secondary:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
  }

  /* ========================================
   PÁGINA DE PROYECTOS - ESTILOS DEDICADOS
   ======================================== */
.projects-page-content {
  padding: 32px 48px;
  max-width: 1800px;
  margin: 0 auto;
}

.projects-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 32px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================
   ESTADÍSTICAS - CARDS COMPACTAS
   ======================================== */
.header-stats {
  display: flex;
  gap: 16px;
}

.stat-card {
  background: white;
  padding: 16px 24px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  text-align: center;
  min-width: 100px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========================================
   GRID DE PROYECTOS - COMPACTO (ESTILO CANVA)
   ======================================== */
  .projects-grid-full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

/* Cards más compactas */
.projects-grid-full .project-card {
  background: white;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  position: relative;
}

.projects-grid-full .project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}

/* Thumbnail más pequeño */
.projects-grid-full .project-thumbnail {
  height: 120px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.projects-grid-full .project-icon {
  font-size: 42px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: var(--transition);
}

.projects-grid-full .project-card:hover .project-icon {
  transform: scale(1.08);
}

.projects-grid-full .project-info {
  padding: 12px;
}

.projects-grid-full .project-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projects-grid-full .project-description {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
  line-height: 1.4;
}

.projects-grid-full .project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.projects-grid-full .project-date {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Botones de acción más pequeños */
.projects-grid-full .project-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: var(--transition);
}

.projects-grid-full .project-card:hover .project-actions {
  opacity: 1;
}

.projects-grid-full .btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

.projects-grid-full .btn-icon:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

/* Badge de favorito más pequeño */
.projects-grid-full .favorite-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ========================================
   FILTROS EN PÁGINA DE PROYECTOS
   ======================================== */
.projects-page-content .project-filters {
  margin-bottom: 24px;
  padding: 12px 16px;
}

.projects-page-content .filter-tab {
  padding: 8px 16px;
  font-size: 13px;
}

.projects-page-content .sort-select {
  padding: 8px 14px;
  font-size: 13px;
  min-width: 160px;
}

/* ========================================
   RESPONSIVE - PÁGINA DE PROYECTOS
   ======================================== */
@media (max-width: 1400px) {
  .projects-grid-full {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 1400px) {
  .projects-grid-full {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

@media (max-width: 1200px) {
  .projects-grid-full {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .projects-page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-stats {
    width: 100%;
    justify-content: space-between;
  }
  
  .stat-card {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
  }
  
  .stat-number {
    font-size: 24px;
  }
  
  .stat-label {
    font-size: 11px;
  }
  
  .page-title {
    font-size: 24px;
  }
  
  .page-subtitle {
    font-size: 14px;
  }
  
  .projects-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
  }
  
  .projects-grid-full .project-thumbnail {
    height: 135px;
  }
  
  .projects-grid-full .project-icon {
    font-size: 46px;
  }
  
  .projects-grid-full .project-actions {
    opacity: 1; /* Siempre visible en móvil */
  }
}

/* ========================================
   AJUSTES PARA MUCHOS PROYECTOS
   ======================================== */
.projects-grid-full:has(.project-card:nth-child(n+20)) {
  gap: 16px;
}

.projects-grid-full:has(.project-card:nth-child(n+50)) {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

/* ========================================
   SCROLL SUAVE EN PÁGINA DE PROYECTOS
   ======================================== */
   .projects-page-content {
    padding: 32px 48px;
    max-width: 80%; /* Ocupa todo el ancho */
    margin: 0;
    width: 100%;
  }

/* ========================================
   ANIMACIONES ESCALONADAS
   ======================================== */
.projects-grid-full .project-card {
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.projects-grid-full .project-card:nth-child(1) { animation-delay: 0s; }
.projects-grid-full .project-card:nth-child(2) { animation-delay: 0.03s; }
.projects-grid-full .project-card:nth-child(3) { animation-delay: 0.06s; }
.projects-grid-full .project-card:nth-child(4) { animation-delay: 0.09s; }
.projects-grid-full .project-card:nth-child(5) { animation-delay: 0.12s; }
.projects-grid-full .project-card:nth-child(6) { animation-delay: 0.15s; }
.projects-grid-full .project-card:nth-child(7) { animation-delay: 0.18s; }
.projects-grid-full .project-card:nth-child(8) { animation-delay: 0.21s; }
.projects-grid-full .project-card:nth-child(n+9) { animation-delay: 0.24s; }

/* ========================================
   CREADOR DE BLOQUES - ESTILOS ADICIONALES
   ======================================== */

/* Empty state para bloques custom en el toolbox */
.customBlocksEmpty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Animación para nuevos bloques */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.saved-block-item {
  animation: slideInFromRight 0.3s ease;
}

/* Estilo para bloques custom en el workspace */
.blocklyDraggable[data-custom-block="true"] {
  filter: drop-shadow(0 2px 4px rgba(108, 92, 231, 0.3));
}

/* Highlight para campos editables */
.creator-content input:focus,
.creator-content textarea:focus,
.creator-content select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.1);
}

/* Mejorar apariencia del code editor */
.code-editor:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.2);
}

/* Indicador de bloque guardado */
.save-success {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #4CAF50;
  color: white;
  padding: 16px 24px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  z-index: 9999;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive para creador de bloques */
@media (max-width: 1024px) {
  .creator-sidebar {
    width: 280px;
  }

  .creator-tabs {
    overflow-x: auto;
  }

  .creator-tab {
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  .creator-container {
    flex-direction: column;
  }

  .creator-sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .color-picker-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .input-item {
    flex-direction: column;
    align-items: stretch;
  }

  .input-item select,
  .input-item input {
    width: 100%;
    max-width: none;
  }
}

/* Tooltip mejorado */
.form-section {
  position: relative;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 50%;
  font-size: 12px;
  cursor: help;
  margin-left: 4px;
}

.help-icon:hover {
  background: var(--primary-color);
  color: white;
}

.forgot-password-link {
  display: block;
  text-align: right;
  margin-top: 8px;
  font-size: 14px;
  color: var(--primary-color);
  text-decoration: none;
  transition: opacity 0.2s;
}

.forgot-password-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

#emailVerificationBanner {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#emailVerificationBanner button:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.project-icon-option {
  width: 50px;
  height: 50px;
  font-size: 28px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.project-icon-option:hover {
  transform: scale(1.1);
  border-color: #667eea;
}

.project-icon-option.selected {
  border-color: #667eea;
  background: #f0f4ff;
}

.faq-section {
  background: white;
  border-radius: 12px;
  padding: 32px;
  margin-top: 40px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.faq-section h3 {
  font-size: 24px;
  margin-bottom: 24px;
  color: #333;
}

.faq-item {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-item strong {
  display: block;
  color: #667eea;
  font-size: 16px;
  margin-bottom: 8px;
}

.faq-item p {
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.faq-item kbd {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 13px;
}

/* =======================================
   🔐 USER INFO SIDEBAR
   ======================================= */

   .user-info-sidebar {
    margin-bottom: 8px;
  }
  
  #userSection {
    animation: fadeIn 0.3s ease-in;
  }
  
  #guestSection {
    animation: fadeIn 0.3s ease-in;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* Ajustar sidebar para que el logout esté al final */
  .sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* No fijar en pantalla: la barra lateral ya vive en el layout flex */
    position: static;
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
  }
  
  .sidebar-nav {
    flex: 1;
    overflow-y: auto;
  }

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px;
}

.logo-text {
  font-size: 20px;
  font-weight: 900;
  color: #8B5CF6;
  letter-spacing: -0.5px;
}

.logo-icon-svg {
  width: 55px;
  height: 55px;
  flex-shrink: 0;
  margin: 4px 0;
}

.logo-tagline {
  font-size: 8px;
  font-weight: 700;
  color: #9CA3AF;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
/* ✨ Efecto hover (opcional) */
.logo:hover .logo-icon-svg {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}