/* --------------------------------------------------------------
   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;
}

/* --------------------------------------------------------------
   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;
}

.meta-row.bottom-line > div {
  flex: 1;
  min-width: 200px;
}

/* --------------------------------------------------------------
   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);
}

.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 */
.gallery-image img {
  width: 256px;
  height: auto;
  border-radius: 4px;
}

/* 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;
}

/* --------------------------------------------------------------
   Stapelverarbeitung
-------------------------------------------------------------- */
.select-all-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 1rem;
}
.select-all-label input {
  margin-right: 0.5rem;
}

/* --------------------------------------------------------------
   Modal
-------------------------------------------------------------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.modal.hidden { display: none; }

.modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 10px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  box-shadow: 0 0 30px rgba(0,0,0,0.3);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: #c00000;
  font-weight: bold;
}

/* --------------------------------------------------------------
   Zoom / Lupe
-------------------------------------------------------------- */
.zoom-container {
  width: 768px;
  margin: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

#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; }
}
