/* =======================================================
   ? Grundlayout Ellipse-Formular (Contao 5)
   ======================================================= */
.ce_ellipse {

}

/* =======================================================
   ?? Tabellenähnliches Layout für Parameter
   ======================================================= */

/* Formular insgesamt als Block: Checkbox oben, Inhalt darunter */
.ellipse-form {
  width: 100%;
  border-collapse: collapse;
  display: grid;
  grid-template-columns: 1fr;       /* nur eine Spalte */
  gap: 1rem;                        /* Abstand zwischen Checkbox + Inhalt */
  align-items: start;
}

/* Fieldsets im Parameterbereich in Grid-Form */
.ellipse-config-section fieldset {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
  border: none;
  margin: 0;
  padding: 0;
}

.ellipse-config-section legend {
  grid-column: 1 / -1;
  font-weight: bold;
  font-size: 1rem;
  margin-top: 1rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #ccc;
}
.ellipse-config-section h3 {
  font-size: 1rem;
  font-weight: bold;
}
/* Formularzeilen */
.ellipse-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.5rem;
  align-items: center;
}

.ellipse-form .form-row label {
  font-weight: 600;
  color: var(--pb-text-color);
  text-align: left;
  padding-left: 0.5rem;
}

.ellipse-form .form-row input,
.ellipse-form .form-row select {
  width: 100%;
  max-width: none;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: var(--pb-input-bg);
}
.ellipse-form .form-row input:hover,
.ellipse-form .form-row select:hover {
  background-color: var(--pb-body-bg)
}
/* =======================================================
   Anzeige der zyklischen Felder
   ======================================================= 
*/
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  width: 100%;
}

.color-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 200px;
  border: 1px solid #eee;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}

.color-cell label {
  min-width: 60px;
  font-weight: bold;
  text-align: right;
}

.color-cell input {
  width: 80px;
}

/* =======================================================
   ?? Formularaktionen (Buttons etc.)
   ======================================================= */
.ellipse-form .form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 1rem;
}

.ellipse-form button,
.ellipse-form input[type="submit"],
.ellipse-form input[type="button"] {
  padding: 0.4rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: var(--pb-link-color-navigation-bg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ellipse-form button:hover,
.ellipse-form input[type="submit"]:hover,
.ellipse-form input[type="button"]:hover {
  background: var(--pb-link-hover-color-navigation-bg);
}

/* ======================================================
   ?? Hilfe-Popup Layout & Drag
   ====================================================== */
.help-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4); /* ?? dunkle Abdunkelung */
  justify-content: flex-start;
  align-items: center;
  z-index: 9999;
}

.help-content {
  background: var(--pb-container-bg);
  color: black;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  min-width: 250px;

  /* ?? hier die entscheidenden Änderungen */
  position: relative; /* bleibt im Flex-Container */
  margin-left: 2rem;  /* Abstand vom linken Rand */
  top: 0;             /* vertikal zentriert durch align-items */
  transform: none;    /* keine Zentrierung mehr */
  left: auto;         /* alte Zentrierung komplett neutralisieren */
}


.dialog-drag-handle {
  var(--pb-link-color-navigation-bg);

  padding: 0.25rem 0.5rem;
  font-weight: bold;
  cursor: move;
  user-select: none;
  border-radius: 0.3rem;
  border: 1px solid var(--pb-body-bg);
}


#helpPopup.active {
  display: flex;
}

.helpContent h2,
.helpContent h3 {
  margin-top: 0;
  font-size: 1.2rem;
}

.close-help {
  display: block;
  margin-left: auto;
  background: var(--pb-link-color-navigation-bg);
  border: 1px solid #ccc;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}

.close-help:hover {
  background: var(--pb-link-hover-color-navigation-bg);
}

/* =======================================================
   ?? Ein-/Ausklappbare Bereiche (Speichern/Laden)
   ======================================================= */
.ellipse-form-section {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease-in-out;
}

.ellipse-form-section.active {
  max-height: 500px;
  opacity: 1;
}

/* =======================================================
   ?? Erfolg- und Warnmeldungen
   ======================================================= */
.save-ok {
  background: #e9e9e9;
  border: 1px solid #0a0;
  padding: 4px;
}

.save-warning {
  background: red;
  border: 1px solid #cc0;
  padding: 4px;
}
