.body {
  font-family: Arial, sans-serif;
}

.container1 {
  width: 99%;
  padding: 2px;
  max-width: 1600px;
}

.main {
  clear: both;
  display: flex;
  column-gap: 2px;
  flex-direction: row;
  height: 70vh;
  margin: 0px;
  margin-right: 1em;
  width: 100%;
  align-items: stretch;
}

h1 {
  margin: 10px;
  text-align: center;
  font-size: large;
}

.tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #eee;
  padding: 0px 0px;
  box-sizing: border-box;
}

.tabs-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.fname {
  flex-grow: 1;
  text-align: center;
  font-size: large;
  font-weight: bold;
  color: #333;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background-color: #eee;
}

.tab {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 10px;
  margin: 0px;
  transition: 0.3s;
}

.tabs div.active {
  background-color: #ccc;
  border-top:1px solid black;
  border-left:1px solid black;
  border-right:1px solid black;
}

.tab:hover {
  background-color: #ddd;
}

#editoren {
  height: 100%;
  width: 50%;
  min-width: 25%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: 2px solid #ccc;
  flex-shrink: 0;
  flex-grow: 0;
}

/* Vorschau-Wrapper für Begrenzung */
/* Vorschau-Wrapper für Begrenzung – flexibel machen */
.preview-wrapper {
  width: 50%;
  min-width: 20%;        /* darf schrumpfen */
  height: 100%;
  box-sizing: border-box;
  flex: 1 1 auto;        /* wichtig: darf wachsen & schrumpfen */
  padding-right: 1em;
}

/* Vorschau-Container mit schönem Rahmen */
.preview-container {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* Das sichtbare Preview-iframe */
iframe#live-preview {
  height: 100%;
  width: 100%;
  box-sizing: border-box;

  /* Optik (deine Werte beibehalten) */
  border: 3px solid #007bff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.2);
  background: linear-gradient(145deg, #f8f9fa, #e9ecef);
  position: relative;
  display: block;
}

.editor {
  height: 100%;
  width: 100%;
  display: none;
}

.editor.active {
  display: block;
}

/* Monaco Editor Container */
#html-monaco-editor,
#css-monaco-editor,
#js-monaco-editor {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* EINHEITLICHER Resizer (ersetzen) */
.resizer {
  flex: 0 0 8px;
  width: 8px;
  min-width: 8px;
  max-width: 8px;
  background: #e5e7eb;
  cursor: col-resize;          /* wichtig: Spalten-Resize */
  user-select: none;           /* keine Textselektion beim Drag */
  touch-action: none;          /* wichtig für Touch-Drag */
  position: relative;
  z-index: 100;
  border-left: 1px solid #d1d5db;
  border-right: 1px solid #d1d5db;
  display: block;
  visibility: visible;
}
.resizer:hover { background-color: #d1d5db; }

.resizer::before {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -8px;
  right: -8px;
  /* unsichtbar, aber klick-/ziehbar */
  background: transparent;
  cursor: col-resize;
}

/* Beim Resizen: globaler Cursor & keine Textselektion */
body.resizing {
  cursor: ew-resize !important;
  user-select: none !important;
}

/* WICHTIG: verhindert, dass das iframe Mouse/Pointer-Up "schluckt" */
body.resizing iframe#live-preview {
  pointer-events: none;
}

/* Hamburger-Menü rechts */
.hamburger-menu-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.hamburger-menu {
  cursor: pointer;
  font-size: 36px;
  padding-right:0.5em;
}

.menu {
  display: none;
  position: absolute;
  width: 160px;
  top: 40px;
  right: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 200;
  border-radius: 5px;
}

.menu-item {
  width: 100%;
  padding: 10px 20px;
  text-decoration: none;
  color: #333;
  display: block;
  background-color: #fff;
  cursor: pointer;
}

.menu-item:hover {
  background-color: #f0f0f0;
}

.menu-item:last-child {
  border-bottom: none;
}

button {
  border: none;
}

/* Drag & Drop Bildverwaltung */
#img-editor {
  padding: 10px;
  background-color: #f9f9f9;
  border: 2px dashed #ccc;
  border-radius: 6px;
  transition: all 0.3s ease;
  min-height: 80%;
  max-height: 90%;
  width: 95%;
  margin: 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  overflow: auto;
  /* Sicherstellen, dass das Element versteckt wird, wenn nicht aktiv */
  display: none;
}

#img-editor.active {
  display: flex;
}

#img-editor.drag-over {
  border-color: #007bff;
  background-color: #e3f2fd;
  transform: scale(1.02);
}

#img-editor::before {
  content: "📁 Bilder hier hineinziehen oder klicken zum Auswählen";
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
  margin-top: 2px;
  flex-shrink: 0;
  padding: 10px;
}

#previewDiv {
  width: 100%;
  max-height: 100%;
  /* neu: horizontales und vertikales Scrollen erlauben */
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px;
  background-color: white;
  margin-bottom: 5px;
  /* neu: Bilder in einer flexiblen Zeile/Spalte anordnen */
  display: flex;
  flex-wrap: wrap;
}

.image-container {
  display: inline-block;
  margin: 3px;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  position: relative;
  transition: all 0.3s ease;
  max-width: 100px;
}

.image-container:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.preview-image {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.preview-image:hover {
  transform: scale(1.05);
}

/* .preview-image.selected ist nicht mehr benötigt */

.image-filename {
  font-size: 10px;
  color: #666;
  margin-top: 3px;
  text-align: center;
  word-break: break-word;
  max-width: 100%;
}

.remove-image-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #dc3545;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.remove-image-btn:hover {
  background-color: #c82333;
  transform: scale(1.1);
}

/* selectedImagesDiv und selected-image sind nicht mehr benötigt */

/* Dialog Styles */
dialog {
  border: none;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 20px;
  max-width: 80%;
  max-height: 80%;
  overflow-y: auto;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.close-button:hover {
  color: #333;
}

.uebersicht {
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.menue {
  max-width: 100px;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#dialogtable {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

#dialogtable th,
#dialogtable td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

#dialogtable th {
  background-color: #f5f5f5;
  font-weight: bold;
}

.menuebild {
  text-align: center;
}

.public {
  text-align: center;
  margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main {
    flex-direction: column;
    height: auto;
  }
  
  #editoren,
  .preview-container {
    width: 100% !important;
    height: 50vh;
    min-width: 100% !important;
  }
  
  .tabs {
    flex-direction: column;
    gap: 10px;
  }
  
  .tabs-buttons {
    width: 100%;
    justify-content: center;
  }
  
  .fname {
    order: -1;
  }
  

}
