/* ATLAS_IOF_LAYOUT_FIX_V1 */

/* Recuperar toda la anchura del contenedor principal */
#atlas-iof-content:has(> #iof-projects-panel) {
  display: block !important;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#atlas-iof-content > #iof-projects-panel {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 20px !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box;
  align-items: stretch;
}

/* Encabezado a toda la anchura */
#iof-projects-panel > h3,
#iof-projects-panel > .iof-project-muted {
  grid-column: 1 / -1 !important;
  margin: 0;
}

#iof-projects-panel > h3 {
  font-size: 21px;
}

/* Formulario y listado, cada uno con la mitad disponible */
#iof-projects-panel > .iof-project-form {
  grid-column: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 100%;
  box-sizing: border-box;
}

/* Campos sin cortes ni desbordamientos */
#iof-projects-panel .iof-project-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

#iof-projects-panel .iof-project-field,
#iof-projects-panel .iof-work-field {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

#iof-projects-panel input,
#iof-projects-panel select,
#iof-projects-panel textarea {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Zona de trabajo debajo de ambas columnas */
#iof-projects-panel > #iof-workspace {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  min-width: 0;
  max-width: none !important;
  box-sizing: border-box;
  margin-top: 4px;
}

/* Selector de proyecto activo */
#iof-workspace .iof-work-top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 15px;
  width: 100%;
}

#iof-workspace .iof-work-top > .iof-work-field {
  display: grid !important;
  width: 100%;
  min-width: 0;
  flex: none !important;
}

#iof-workspace .iof-work-top select {
  min-height: 43px;
  display: block;
}

#iof-workspace .iof-work-top button {
  min-height: 43px;
  white-space: nowrap;
}

/* Parcelas y rodales en dos columnas amplias */
#iof-workspace .iof-work-columns {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 20px;
  width: 100%;
}

#iof-workspace .iof-work-card {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 22px;
  align-content: start;
}

/* Mejor presentación de los formularios */
#iof-workspace .iof-work-stand-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

#iof-workspace .iof-work-card button {
  width: 100%;
  min-height: 43px;
}

#iof-projects-panel .iof-project-card {
  width: 100%;
  box-sizing: border-box;
}

/* Ordenadores y tabletas */
@media (max-width: 1000px) {
  #atlas-iof-content > #iof-projects-panel {
    grid-template-columns: 1fr !important;
  }

  #iof-projects-panel > .iof-project-form,
  #iof-projects-panel > #iof-workspace {
    grid-column: 1 / -1 !important;
  }

  #iof-workspace .iof-work-columns {
    grid-template-columns: 1fr !important;
  }
}

/* Móviles */
@media (max-width: 600px) {
  #iof-projects-panel .iof-project-grid,
  #iof-workspace .iof-work-stand-form,
  #iof-workspace .iof-work-top {
    grid-template-columns: 1fr !important;
  }

  #iof-workspace .iof-work-card {
    padding: 16px;
  }
}
