/* --------------------------------------------------------------
   Grundstil
-------------------------------------------------------------- */
body {
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  background-color: #f8f8f8;
  margin: 0;
  padding: 0;
  color: #1a1a1a;
  touch-action: pan-y;
}

.container {
  max-width: 960px;
  margin: 40px auto;
  padding: 20px 100px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------
   Bildanzeige
-------------------------------------------------------------- */
.image-center {
  text-align: center;
  margin-bottom: 20px;
}
.image-center img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
}
/* --------------------------------------------------------------
   Videoanzeige
-------------------------------------------------------------- */
/* Tagmask: Bild + Video gleich behandeln */
.tagmask-media{
  display: block;
  width: 768px;        /* feste Zielbreite */
  max-width: 100%;     /* auf kleinen Screens responsive */
  height: auto;
  margin: 0 auto;      /* das ist das eigentliche Zentrieren */
  border: none;
  outline: none;
  box-shadow: none;
}

/* optional: Video-Frame wirklich mittig halten (falls du ihn nutzt) */
#video-frame{
  display: flex;
  justify-content: center;
}


/* --------------------------------------------------------------
   Meta-Daten Layout
-------------------------------------------------------------- */
.meta-group,
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.meta-group input,
.meta-row input {
  height: 24px;
  font-size: 14px;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

#dpi { width: 60px; }

.meta-double { gap: 40px; }

.meta-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-block.left-align > div { justify-content: flex-start; }
.meta-block.left-align strong { text-align: left; margin-right: 6px; }

.meta-block > div {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.meta-block > div strong {
  min-width: 90px;
  text-align: right;
  margin-right: 8px;
}

.meta-block input {
  flex: 1;
  max-width: 240px;
}

.meta-row.top-line > div { min-width: 180px; flex: 1; }

.meta-row.middle-line {
  display: flex;
  justify-content: space-between;
  gap: 40px;
}

.meta-pair {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 300px;
  flex: 1;
}

/* Bottom-Line exakt wie 4er-Spaltenlayout oben (rechts endet wie "Letzter Bearbeiter") */
.meta-row.bottom-line{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 20px;          /* muss zum gap der oberen meta-row passen */
  align-items: center;
  width: 100%;
}

.meta-row.bottom-line .left{
  grid-column: 1 / 4;        /* Spalte 1–3 */
  white-space: nowrap;       /* bleibt eine Zeile */
}

.meta-row.bottom-line .right{
  grid-column: 4 / 5;        /* Spalte 4 */
  text-align: right;
  white-space: nowrap;       /* bleibt eine Zeile */
}



/* --------------------------------------------------------------
   Edit Bereich
-------------------------------------------------------------- */
.edit-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.edit-section label { font-weight: bold; margin-right: 4px; }
.edit-section input {
  height: 24px;
  font-size: 14px;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #ccc;
  width: 220px;
  margin-right: 12px;
}

/* --------------------------------------------------------------
   Top Bar
-------------------------------------------------------------- */
.top-bar {
  background-color: #1a1a1a;
  color: white;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-button {
  background-color: #c00000;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.3s ease;
  cursor: pointer;
}
.nav-button:hover { background-color: #a00000; }

/* Dropdowns */
select.nav-button.dropdown {
  appearance: none;
  background-color: #c00000;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.user-info { display: flex; align-items: center; gap: 15px; }
.username, .score { font-weight: bold; }

/* --------------------------------------------------------------
   Titel
-------------------------------------------------------------- */
.page-title { text-align: center; margin: 20px 0; }
.page-title h1 {
  font-size: 28px;
  font-weight: bold;
  color: #333;
  margin: 0;
}

/* --------------------------------------------------------------
   Seitenbuttons
-------------------------------------------------------------- */
.side-button {
  position: fixed;
  top: 80px;
  bottom: 30px;
  width: 80px;
  background-color: #c00000;
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  z-index: 999;
  transition: background-color 0.3s ease;
}
.side-button.left  { left: 0;  border-radius: 0 8px 8px 0; }
.side-button.right { right: 0; border-radius: 8px 0 0 8px; }
.side-button:hover { background-color: #a00000; }

/* Serie-Filter */
.series-dropdown-container {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  margin: 1rem 0;
}
.series-dropdown-container label { margin-right: 0.5rem; }
.series-dropdown-container .nav-button.dropdown { max-width: 200px; }

/* --------------------------------------------------------------
   Info Boxen (graue Bereiche)
-------------------------------------------------------------- */
.filter-section,
#top_tags_section,
#top_categories_section,
#category_tags_section,
#assigned_tags_section {
  background-color: #f1f1f1;
  border-left: 4px solid #c00000;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
}

.filter-section h2,
#top_tags_section h2,
#top_categories_section h2,
#category_tags_section h2,
#assigned_tags_section h2 {
  margin-top: 0;
  color: #c00000;
  font-size: 18px;
}

/* --------------------------------------------------------------
   Tag Chips
-------------------------------------------------------------- */
#top_tags_section a,
#top_categories_section a,
#category_tags_section a {
  display: inline-block;
  background-color: #1a1a1a;
  color: white;
  padding: 6px 12px;
  margin: 6px 8px 6px 0;
  border-radius: 20px;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}
#top_tags_section a:hover,
#top_categories_section a:hover,
#category_tags_section a:hover {
  background-color: #c00000;
}

.assigned-tag {
  display: inline-block;
  background-color: #c00000;
  color: white;
  padding: 6px 12px;
  margin: 6px 8px 6px 0;
  border-radius: 20px;
  font-size: 14px;
  transition: background-color 0.3s ease;
  cursor: pointer;
}
.assigned-tag:hover { background-color: #1a1a1a; }
.assigned-tag.newly-added:hover { background-color: #a00000; }

/* --------------------------------------------------------------
   Galerie Layout
-------------------------------------------------------------- */
.gallery-container {
  width: 95%;
  margin: 20px auto;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(0,0,0,0.05);
}

/* NEU: bulk-section optisch wie filter-section, damit das Layout "wie vorher" bleibt */
.bulk-section{
  background-color: #f1f1f1;
  border-left: 4px solid #c00000;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
}
.bulk-section h2{
  margin-top: 0;
  color: #c00000;
  font-size: 18px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(256px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.gallery-item {
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background-color 0.2s;
}
.gallery-item:hover { background-color: #e0e0e0; }
.gallery-item.fully-processed { background-color: #e6f5e6; border-color: #9ccc9c; }
.gallery-item.fully-processed:hover { background-color: #cceacc; }
.gallery-item.selected { background-color: rgba(20,20,120,0.2); }
.gallery-item.selected:hover { background-color: rgba(20,20,120,0.3); }

/* Galerie-Bild (alt, falls irgendwo noch verwendet) */
.gallery-image img {
  width: 256px;
  height: auto;
  border-radius: 4px;
}

/* NEU: passt zum aktuellen Template (gallery.html nutzt <img class="gallery-thumb">) */
.gallery-thumb{
  width: 256px;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* Galerie Info */
.gallery-info { display: flex; flex-wrap: wrap; margin-top: 10px; }

.info-row {
  display: flex;
  align-items: center;
  padding: 4px;
  width: 100%;
}
.info-label {
  flex: 0 0 30%;
  font-weight: bold;
}
.info-value {
  flex: 1;
  margin-left: 5px;
  word-break: break-word;
}

.tile-thumb{
  width: 100%;
  display: flex;
  justify-content: center; /* horizontal zentrieren */
}

/* Damit absolute Positionen innerhalb der Kachel funktionieren */
.gallery-item { position: relative; }

/* Checkbox komplett „weg“, aber bleibt im DOM */
.gallery-item .bulk_checkbox{
  position: absolute;
  opacity: 0;           /* unsichtbar, bleibt im DOM */
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  pointer-events: none; /* nicht klickbar */
}

  .video-badge{
    position:absolute;
    right:8px;
    bottom:8px;
    padding:2px 6px;
    font-size:11px;
    line-height:1.2;
    border-radius:4px;
    background:rgba(0,0,0,.75);
    color:#fff;
    pointer-events:none;
  }
  .tile-thumb{ position:relative; }

  /* NEU: Buttons unten nebeneinander, Download rechts */
  .tile-actions{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
  }
  .tile-actions a.nav-button{
    text-decoration:none;
    display:inline-block;
    text-align:center;
  }
/* --------------------------------------------------------------
   Stapelverarbeitung
-------------------------------------------------------------- */
.select-all-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 1rem;
}
.select-all-label input {
  margin-right: 0.5rem;
}

/* ----------------------------
   Galerie Edit Modal (iframe)
   ---------------------------- */
/* ---------------------------------------------------------
   Edit-Modal (edit_image.html) – Layout wie Tagging-Maske
--------------------------------------------------------- */
.edit-iframe-body {
  margin: 0;
  padding: 0;
  background: transparent;
}

.edit-page {
  padding: 22px 24px 26px;
  background: #fff;
}

.edit-title {
  margin: 6px 0 14px;
  font-size: 28px;
  font-weight: 700;
  text-align: left;
}

.edit-media-wrap {
  max-width: 768px;           /* Tiny-Breite wie Tagging-Maske */
  margin: 0 auto 18px;
}

.edit-media {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #000;           /* Video/letterboxing sauber */
}

.edit-form {
  max-width: 900px;
  margin: 0 auto;
}

.edit-section {
  background: #f3f3f3;
  border-left: 4px solid #b00000;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0 16px;
}

.edit-section-title {
  margin: 0 0 10px;
  color: #b00000;
  font-weight: 800;
  font-size: 20px;
  text-align: left; /* oben/links */
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}

.edit-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 10px;
}

.edit-row label {
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.edit-row input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.edit-row-wide {
  grid-column: 1 / -1;
}

.edit-hint {
  margin-top: 10px;
  opacity: 0.85;
  font-size: 0.95em;
}

.edit-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

/* Responsive: auf schmalen Screens alles untereinander */
@media (max-width: 740px) {
  .edit-grid {
    grid-template-columns: 1fr;
  }
  .edit-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .edit-row label {
    white-space: normal;
  }
}



/* --------------------------------------------------------------
   Zoom / Lupe
-------------------------------------------------------------- */
.zoom-container {
  width: 768px;
  margin: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* kleine Ergänzung: Video passt in den gleichen Rahmen */
.zoom-container video{
  width: 100%;
  max-width: 768px;
  height: auto;
  display: block;
}

#zoom-frame {
  width: 768px;
  position: relative;
  overflow: hidden;
}

#tiny-img {
  width: 768px;
  display: block;
  position: relative;
  z-index: 1;
}

#original-img {
  display: none;
  position: absolute;
  top: 0; left: 0;
  z-index: 2;
  cursor: grab;
}

#zoom-lens {
  position: absolute;
  border: 2px solid #c00000;
  width: 100px;
  height: 100px;
  pointer-events: none;
  display: none;
}

#zoom-result {
  overflow: hidden;
  width: 400px;
  height: 400px;
  border: 1px solid #ccc;
  position: relative;
}
#zoom-result img {
  position: absolute;
  top: 0; left: 0;
}

/* --------------------------------------------------------------
   Highscore
-------------------------------------------------------------- */
.highscore-container {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 0 12px rgba(0,0,0,0.05);
  margin-top: 20px;
}
.highscore-list { margin: 0; padding: 0; }
.highscore-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px 15px;
  margin-bottom: 10px;
  transition: background-color 0.3s ease;
}
.highscore-item:hover { background-color: #f1f1f1; }
.highscore-item .ranking { font-weight: bold; width: 40px; }
.highscore-item .username { flex: 1; margin-left: 10px; font-size: 16px; }
.highscore-item .score { font-weight: bold; font-size: 16px; color: #c00000; }

/* --------------------------------------------------------------
   Mobil
-------------------------------------------------------------- */
@media (max-width: 768px) {
  .container { padding: 20px; }

  .nav-button { padding: 10px; font-size: 14px; }
  .score, .username { font-size: 14px; }

  .meta-group, .edit-section {
    flex-direction: column;
  }

  .edit-section input { width: 100%; }

  .side-button { display: none; }

  /* NEU: Zoom auf Mobile nicht überlaufen lassen */
  .zoom-container, #zoom-frame, #tiny-img{
    width: 100%;
    max-width: 768px;
  }
}

/* --------------------------------------------------------------
   Edit_image (Dialog + iframe)
-------------------------------------------------------------- */
dialog#editDialog {
  width: min(1100px, 92vw);
  height: min(820px, 86vh);
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
}
dialog#editDialog::backdrop {
  background: rgba(0,0,0,0.65);
}
.edit-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.edit-dialog-title {
  font-weight: 700;
}
.edit-dialog-close {
  cursor: pointer;
  border: none;
  padding: 6px 10px;
}
#editFrame {
  width: 100%;
  height: calc(100% - 52px);
  border: none;
  display: block;
}
