/* ==========================================================================
   YZG STUDIO v4.2 - FULLSCREEN MOBILE CENTERING & FIT
   ========================================================================== */

/* 🚫 En PC esto permanece 100% oculto */
.yzg-mobile-header,
.yzg-mobile-dock {
  display: none !important;
}

/* 📱 SOLO EN MÓVIL (≤ 768px / iPhone SE / Android) */
@media (max-width: 768px) {

  /* 1. Ocultar sidebar y elementos de PC */
  #main-sidebar, 
  .sidebar, 
  .sidebar-collapsed, 
  .desktop-header, 
  header .app-title, 
  .top-bar-title {
    display: none !important;
  }

  /* 2. FORZAR 100% ANCHO EN TODOS LOS CONTENEDORES Y VISTAS */
  html, body, 
  #app, .app-container, .main-content,
  #workspace, #builder-workspace, .workspace-container,
  #view-chat, #view-builder, #view-gallery, #view-agent,
  .chat-side, .chat-container, .builder-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    left: 0 !important;
    right: 0 !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* 3. CENTRAR EL CONTENIDO INTERNO (MENSAJES Y BIENVENIDA) */
  #workspace, 
  #builder-workspace, 
  .chat-viewport, 
  .empty-state {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding-top: 60px !important;
    padding-bottom: 140px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }

  /* 4. MÚSCULO DE MENSAJES Y CARDS AL 100% */
  .msg-group, 
  .msg-content, 
  .system-instructions-box, 
  #system-instructions-box,
  .empty-state {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .empty-state h2 {
    font-size: 22px !important;
    text-align: center !important;
  }

  .empty-state p {
    font-size: 14px !important;
    text-align: center !important;
  }

  /* 5. HEADER MÓVIL (Con puntero arreglado) */
  .yzg-mobile-header {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 52px;
    padding: 0 14px;
    align-items: center;
    justify-content: space-between;
    z-index: 9999;
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
    box-sizing: border-box !important;
  }

  .yzg-mobile-header * {
    pointer-events: auto !important;
  }

  .m-logo {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #fff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
  }

  .m-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: #e2e8f0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .m-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .m-icon-btn:active {
    color: var(--accent, #818cf8);
    background: rgba(129, 140, 248, 0.2);
  }

  /* 6. DOCK INFERIOR CENTRADO CON GLOW */
  .yzg-mobile-dock {
    display: flex !important;
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 340px;
    height: 52px;
    background: rgba(18, 24, 39, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50px;
    justify-content: space-around;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    pointer-events: auto !important;
  }

  .m-dock-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
  }

  .m-dock-btn.active {
    color: #fff !important;
    background: rgba(129, 140, 248, 0.3) !important;
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.6) !important;
  }

  /* 7. CAJA DE INPUT FLOTANTE CENTRADA */
  .input-box,
  .chat-input-container {
    position: fixed !important;
    bottom: 74px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 400px !important;
    margin: 0 !important;
    z-index: 9998 !important;
  }
}
