/* ---------------------------------------------
   Variablen
--------------------------------------------- */
:root {
  --clr1: #09203F;
  --clr2: #537895;
  --clr3: #09203F;
  --clr4: #537895;
  --btn-bg: rgba(255, 255, 255, 0.85);
  --btn-shadow: rgba(0, 0, 0, 0.15);
  --input-bg: rgba(255, 255, 255, 0.7);
  --input-shadow: rgba(0, 0, 0, 0.05);
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --btn-gap: 0.75rem;
  /* Abstand zwischen Buttons */
}

/* Bildname-Block weiter links & sauber */
.name-edit {
  margin: 6px 0 10px 0;
  padding-left: 0 !important;
  /* vorher evtl. 0.75rem – weg damit */
  padding-right: 0 !important;
}

/* Label kleiner & ohne Einrückung */
.name-edit label {
  display: block;
  margin: 0 0 6px 0;
  font-size: .30rem;
  opacity: .85;
}

/* Input bündig & etwas schicker (an deine großen Felder angelehnt) */
.name-edit .name-input {
  display: block;
  width: 100%;
  max-width: none;
  padding: 5px 10px;
  border-radius: 10px;
}


/* Seite darf immer vertikal scrollen */
html,
body {
  height: auto;
  min-height: 100%;
  overflow-y: auto !important;
}

/* Container darf wachsen (keine feste Höhe) */
.container {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Galerie nicht einsperren */
#gallery {
  max-height: none !important;
  overflow: visible !important;
}



/* ---------------------------------------------
   Animierter Gradient-Hintergrund
--------------------------------------------- */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  height: 100vh;
  background: linear-gradient(45deg, var(--clr1), var(--clr2), var(--clr3), var(--clr4));
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* ---------------------------------------------
   Container mit Glassmorphism
--------------------------------------------- */
.container,
.header,
.modal-content {
  background: rgba(255, 255, 255, 0.311);
  border-radius: var(--radius);
  backdrop-filter: blur(15px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  margin: 1rem;
}

/* ---------------------------------------------
   Button-Gruppen mit flex & Gap
--------------------------------------------- */
.action-buttons,
.crop-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--btn-gap);
  margin-top: 10px;
  margin-bottom: 10px;
}

.lang-btn-container {
  display: inline-flex;
  gap: var(--btn-gap);
}

/* ---------------------------------------------
   Buttons im iOS-Neumorphic-Stil
--------------------------------------------- */
.action-buttons button,
.crop-controls button,
.lang-btn {
  background: var(--btn-bg);
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  margin-top: var(--btn-gap);
  margin-bottom: var(--btn-gap);
  font-size: 1rem;
  color: #333;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.action-buttons button:hover,
.crop-controls button:hover,
.lang-btn:hover {
  transform: translateY(-2px);
  background: rgb(255, 255, 255);
}

.action-buttons button:focus,
.crop-controls button:focus,
.lang-btn:focus {
  outline: 2px solid rgba(36, 119, 209, 0.5);
}

.action-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------------------------------------------
   Drop-Zone Stylings
--------------------------------------------- */
#drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 4rem 2rem;
  text-align: center;
  color: #fff;
  font-size: 1.1rem;
  transition: background 0.3s, border-color 0.3s;
}

#drop-zone.dragover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
}

/* ---------------------------------------------
   Inputs & Slider im Neumorphic-Stil
--------------------------------------------- */
input[type="number"],
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  margin: 0.5rem 0;
  background: var(--input-bg);
  border-radius: var(--radius);
  box-shadow:
    inset 4px 4px 8px var(--input-shadow),
    inset -4px -4px 8px #fff;
  padding: 0.5rem;
  transition: box-shadow 0.2s ease;
}

input[type="number"]:focus,
input[type="range"]:focus {
  box-shadow:
    inset 2px 2px 6px var(--input-shadow),
    inset -2px -2px 6px #fff;
}

input[type="range"] {
  height: 12px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: var(--btn-bg);
  border-radius: 50%;
  box-shadow:
    4px 4px 8px var(--btn-shadow),
    -4px -4px 8px #fff;
  cursor: pointer;
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* ---------------------------------------------
   Modal & Cropper-Container
--------------------------------------------- */
/* ---------------------------------------------
   Modal & Cropper-Container
--------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  overflow-y: auto;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-content {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: visible;
  position: relative;
}

.crop-image-container {
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius);
}

#crop-image {
  max-width: 100%;
  max-height: 70vh;
  display: block;
}

/* ---------------------------------------------
   Sonstige Utilities
--------------------------------------------- */
.hidden {
  display: none !important;
}

/* ---------------------------------------------
   Galerie & Thumbnails
--------------------------------------------- */
#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 200px));
  justify-content: center;
  gap: 1rem;
}

.image-card {
  width: 200px;
  margin: 0 auto;
}

.image-card canvas {
  width: 100% !important;
  height: auto !important;
  display: block;
}

/* ---------------------------------------------
   Kontakt-Link mit Slide-In & Hover-Effekt
--------------------------------------------- */
.contact {
  position: fixed;
  bottom: 1rem;
  /* zentriert horizontal */
  left: 90%;
  transform: translateX(-50%) translateY(20px);
  background: var(--btn-bg);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: #333;
  font-weight: bold;
  opacity: 0;
  animation: slideUpFadeIn 0.8s ease-out forwards;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.upscaler {
  margin-right: 200px;
  position: fixed;
  left: 10%;
  bottom: 1rem;
  background: var(--btn-bg);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: #333;
  font-weight: bold;
  opacity: 0;
  animation: slideUpFadeIn 0.8s ease-out forwards;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;

}

.photoroom {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  background: var(--btn-bg);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: #333;
  font-weight: bold;
  opacity: 0;
  animation: slideUpFadeIn 0.8s ease-out 0.2s forwards;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  z-index: 10;
}

.photoroom a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

.photoroom:hover {
  transform: translateX(-50%) translateY(-3px);
  background: rgba(255, 255, 255, 1);
  box-shadow:
    6px 6px 12px var(--btn-shadow),
    -6px -6px 12px #ffffff;
}

/* Keyframes für Slide-Up + Fade-In */
@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Underline-Wachstum bei Hover */
.contact::after {
  content: "";
  display: block;
  margin: 0.25rem auto 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--clr1), var(--clr3));
  transition: width 0.4s ease;
}

.contact:hover {
  transform: translateX(-50%) translateY(-3px);
  background: rgba(255, 255, 255, 1);
  box-shadow:
    6px 6px 12px var(--btn-shadow),
    -6px -6px 12px #ffffff;
}

.contact:hover::after {
  width: 100%;
}

@media (max-width: 768px) {
  .contact {
    left: 50%;
  }
}

.name-edit {
  margin-top: .5rem;
  padding: 0 0.75rem 0.75rem;
}

.name-edit label {
  font-size: .85rem;
  opacity: .8;
  margin-right: .5rem;
}

.name-edit input {
  width: 100%;
  max-width: 260px;
}


.meta .filename {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Karte referenzierbar für Overlay */
.image-card {
  position: relative;
}

/* zentrierte Leiste oben, mit etwas Abstand zum Bild */
.card-tools {
  position: absolute;
  top: 12px;
  /* ↑ mehr/weniger Luft: Wert anpassen */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  z-index: 5;
}

/* Buttons in der Leiste */
.card-tools .delete-btn,
.card-tools .crop-btn {
  position: static !important;
  /* falls vorher absolut */
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  border-radius: 8px;
}

/* Mehr Luft über dem Settings-Block */
#settings {
  margin-top: 20px !important;
  /* 24–40 je nach Geschmack */
  margin-bottom: 15px;
}

/* exakt 3 Karten pro Reihe (responsive Fallbacks) */
#gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

/* < 1024px: 2 Spalten */
@media (max-width: 1024px) {
  #gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* < 640px: 1 Spalte (Mobil) */
@media (max-width: 640px) {
  #gallery {
    grid-template-columns: 1fr;
  }
}

/* falls noch nicht gesetzt: Canvas füllt die Karte */
.image-card canvas {
  display: block;
  width: 100%;
  height: auto;
}


/* --- CARD: nichts darf aus der Karte „herauslaufen“ --- */
.image-card {
  position: relative;
  overflow: hidden;
  /* verhindert, dass Inhalte in Nachbarspalten ragen */
  padding: 12px;
  border-radius: 12px;
}

/* Canvas sauber skalieren */
.image-card canvas {
  display: block;
  width: 100%;
  height: auto;
  /* Aspect Ratio bleibt erhalten */
}

/* Meta/Editor/Controls: konsistente Abstände */
.meta {
  margin-top: 8px;
}

.name-edit {
  margin-top: 8px;
}

.card-controls {
  margin-top: 10px;
}

/* Eingaben immer innerhalb der Karte halten */
.name-edit .name-input,
.card-controls input[type="number"] {
  width: 100%;
  box-sizing: border-box;
}

/* --- FILENAME: Reset (sonst sieht er wie ein „Pill“ aus) --- */
.meta .filename {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* --- Tools-Overlay sicher über dem Bild, aber ohne Einfluss aufs Layout --- */
.card-tools {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  z-index: 3;
  /* über dem Canvas, nicht über Nachbar-Karten */
}

/* falls Buttons vorher absolut positioniert waren */
.card-tools .delete-btn,
.card-tools .crop-btn {
  position: static !important;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  border-radius: 8px;
}

/* Sicherheit: Box-Sizing überall innerhalb der Karte */
.image-card * {
  box-sizing: border-box;
}



/* === Crop-Toolbar (Format-Auswahl, Flip, Frei, Reset) ===================== */
/* === Crop-Toolbar (Format-Auswahl, Flip, Frei, Reset) ===================== */
.crop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--btn-gap);
  margin-top: .25rem;
  margin-bottom: .25rem;
  padding: .75rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

/* Custom Input Container */
.custom-ratio-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--input-bg);
  border-radius: var(--radius);
  box-shadow:
    inset 2px 2px 6px var(--input-shadow),
    inset -2px -2px 6px #fff;
}

.custom-ratio-input input {
  width: 60px;
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  text-align: center;
  font-size: 0.9rem;
  background: white;
}

.custom-ratio-input input:focus {
  outline: 2px solid rgba(36, 119, 209, 0.35);
  border-color: rgba(36, 119, 209, 0.5);
}

.custom-ratio-input span {
  font-weight: bold;
  color: #333;
}

/* Preset-Select im gleichen Stil wie Inputs/Buttons */
.crop-aspect-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.6rem 1rem;
  min-width: 210px;
  background: var(--input-bg);
  border: none;
  border-radius: var(--radius);
  box-shadow:
    inset 4px 4px 8px var(--input-shadow),
    inset -4px -4px 8px #fff;
  color: #333;
  cursor: pointer;
  transition: box-shadow .2s ease, background .2s ease, transform .2s ease;
}

.crop-aspect-select:focus {
  outline: 2px solid rgba(36, 119, 209, 0.35);
  box-shadow:
    inset 2px 2px 6px var(--input-shadow),
    inset -2px -2px 6px #fff;
}

/* Basisklasse für Toolbar-Buttons */
.btn {
  background: var(--btn-bg);
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  color: #333;
  cursor: pointer;
  box-shadow:
    4px 4px 8px var(--btn-shadow),
    -4px -4px 8px #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow:
    6px 6px 12px var(--btn-shadow),
    -6px -6px 12px #ffffff;
  background: rgba(255, 255, 255, 1);
}

.btn:focus {
  outline: 2px solid rgba(36, 119, 209, 0.5);
}

/* „Ghost“-Variante (neben Select eher dezent) */
.btn-ghost {
  background: rgba(255, 255, 255, 0.65);
}

/* Reset optisch markanter (aber im selben Stil) */
.btn-reset {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.75));
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.btn-reset:hover {
  background: rgba(255, 255, 255, 1);
}

/* Ratio-Label rechts etwas dezenter */
.ratio-label {
  font-size: 0.85rem;
  opacity: 0.8;
  padding: 0.2rem 0.4rem;
}

.card-tools .dup-btn {
  position: static !important;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  border-radius: 8px;
}

.append-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: 14px;
  opacity: .9;
}

.append-toggle input {
  transform: translateY(1px);
}

/* === Neue UI-Elemente === */
.secondary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.undo-hint {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.15);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
}

/* Crop auf alle Button spezieller Stil */
#crop-apply-all {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.9));
  border: 1px solid rgba(80, 150, 220, 0.3);
}

#crop-apply-all:hover {
  background: rgba(240, 248, 255, 1);
  border-color: rgba(80, 150, 220, 0.5);
}

/* Name auf alle Button */
#apply-name-all {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 240, 0.85));
}

#apply-name-all:hover {
  background: rgba(255, 250, 240, 1);
}

/* Border-Erkennung Hinweis */
.border-hint {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(129, 199, 132, 0.85));
  color: white;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideIn 0.3s ease-out;
  margin-bottom: 0.5rem;
}

.border-hint.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}