/* ==========================================
   VARIABLES DE ESTILO (Dark Mode Pro)
   ========================================== */
   :root {
    /* Paleta de colores base (Estilo Zinc/Slate) */
    --bg-main: #09090b;       /* Fondo general súper oscuro */
    --bg-header: #09090b;     /* Fondo del topbar */
    --bg-panel: #18181b;      /* Fondo de las cabeceras de paneles */
    --bg-editor: #121214;     /* Fondo del textarea de código */
    
    --border-color: #27272a;  /* Bordes sutiles */
    
    /* Textos */
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    
    /* Acentos */
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-purple: #8b5cf6;
    --accent-red: #ef4444;
    --accent-red-hover: #dc2626;
    --accent-green: #10b981;
    
    /* Fuentes */
    --font-code: 'Fira Code', 'Courier New', Courier, monospace;
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  }
  
  /* ==========================================
     RESETEO GLOBAL
     ========================================== */
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Evita scroll en la página entera */
  }
  
  /* ==========================================
     SCROLLBARS PERSONALIZADOS
     ========================================== */
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: var(--bg-editor);
  }
  ::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 5px;
    border: 2px solid var(--bg-editor);
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #52525b;
  }
  
  /* ==========================================
     BARRA SUPERIOR (TOPBAR)
     ========================================== */
  .topbar {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
  }
  
  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .brand h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .badge {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
  }
  
  .actions {
    display: flex;
    gap: 12px;
  }
  
  /* ==========================================
     BOTONES Y COMPONENTES
     ========================================== */
  .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #27272a;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .btn:hover {
    background-color: #3f3f46;
    transform: translateY(-1px);
  }
  
  .btn:active {
    transform: translateY(1px);
  }
  
  .btn-primary {
    background: var(--accent-blue);
    border: 1px solid var(--accent-blue-hover);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  }
  
  .btn-primary:hover {
    background: var(--accent-blue-hover);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
  }
  
  .btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
  }
  
  .btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
  }
  
  /* ==========================================
     ICONOS SVG
     ========================================== */
  .svg-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
  }
  
  .logo-svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5));
  }
  
  /* ==========================================
     LAYOUT PRINCIPAL (SPLIT SCREEN)
     ========================================== */
  .studio-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
  }
  
  .panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
  }
  
  .panel:last-child {
    border-right: none;
  }
  
  .panel-header {
    background-color: var(--bg-panel);
    padding: 12px 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
  }
  
  .panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
  }
  
  /* ==========================================
     ÁREA DEL EDITOR DE CÓDIGO
     ========================================== */
  .editor-wrapper {
    flex: 1;
    position: relative;
    background-color: var(--bg-editor);
  }
  
  #code-input {
    width: 100%;
    height: 100%;
    background-color: transparent;
    color: #e2e8f0;
    border: none;
    padding: 20px;
    font-family: var(--font-code);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    tab-size: 2; /* Para que las tabulaciones se vean bien */
  }
  
  /* Color de selección en el texto */
  #code-input::selection {
    background-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
  }
  
  /* ==========================================
     ÁREA DE VISTA PREVIA (IFRAME)
     ========================================== */
  .preview-wrapper {
    flex: 1;
    background-color: #ffffff; /* Fondo blanco clásico para HTML estándar */
    position: relative;
  }
  
  #preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
  }
  
  .status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 2s infinite;
  }
  
  /* Animación sutil para el punto de estado */
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  }
