/* ==========================================================================
   HerzFotos Galerie & Login - Haupt-Style (css/galerie.css)
   ========================================================================= */
:root {
  --cream: #f7f2e9;
  --paper: #fffdf8;
  --ink: #514c45;
  --muted: #777066;
  --olive: #737762;
  --olive2: #5e624f;
  --sand: #e4d5c5;
  --rose: #dbc4b1;
  --line: rgba(81,76,69,.14);
  --shadow: 0 24px 70px rgba(67,59,48,.13);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* FIX: Garantiert perfekte vertikale und horizontale Zentrierung der Login-Box auf allen Geräten */
body.login-view,
body.login-body {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100vh;
  padding: 20px;
}

body.gallery-view {
  display: block;
  padding: 90px 0 120px 0;
}

body:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .05;
  background-image: url("../images/papier.jpg");
  background-size: 600px;
  mix-blend-mode: multiply;
  z-index: -1;
}

body:after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: var(--rose);
  filter: blur(80px);
  opacity: .2;
  right: -100px;
  top: -100px;
  z-index: -1;
}

.selection-panel label {
  display: block;
  font-weight: 700;
  margin: 20px 0 10px 0;
  text-align: left;
  color: var(--muted);
}

.selection-panel textarea {
  width: 100%;
  height: 100px;
  border: 1px solid #cfc5b7;
  background: #fffdfa;
  border-radius: 13px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  margin-bottom: 25px;
  transition: all 0.25s ease;
}

.selection-panel textarea:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(115, 119, 98, .12);
}

.gallery-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(67,59,48,.04);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
}

.logo {
  font: 600 32px/1 "Caveat", cursive;
  color: #62574d;
  text-decoration: none;
}

.logo span {
  color: var(--olive);
}

.logout-btn {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
  background: transparent;
}

.logout-btn:hover {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--muted);
}

.gallery-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 20px;
}

.welcome-box {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 30px;
  border-radius: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 40px;
  text-align: center;
  position: relative;
}

.welcome-box h2 {
  font: 600 36px/1.2 "Caveat", cursive;
  color: #675b50;
  margin-bottom: 6px;
}

.welcome-box h2 span {
  color: var(--olive);
}

.welcome-box p {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 12px;
}

.limit-hint {
  display: inline-block;
  font-size: 13px;
  background: var(--cream);
  padding: 4px 14px;
  border-radius: 999px;
  color: var(--ink);
  border: 1px solid rgba(81,76,69,.08);
}

/* ==========================================================================
   FIX: Formschöne Login Box (Hingucker-Effekt)
   ========================================================================= */
.login-box {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(30px, 6vw, 50px);
  border-radius: 30px;
  width: min(460px, 100%);
  box-shadow: var(--shadow);
  transform: rotate(-1deg);
  transition: transform 0.3s ease;
  animation: boxReveal 0.6s ease forwards;
  position: relative;
}

@keyframes boxReveal {
  from { opacity: 0; transform: translateY(20px) rotate(0deg); }
  to { opacity: 1; transform: translateY(0) rotate(-1deg); }
}

.login-box:before {
  content: "♡";
  position: absolute;
  right: 30px;
  top: -25px;
  font: 55px "Caveat", cursive;
  color: #8a7565;
}

.login-box h2 {
  font: 600 32px/1.1 "Caveat", cursive;
  color: #675b50;
  margin-bottom: 12px;
  text-align: center;
}

.login-box p {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 25px;
  text-align: center;
}

form {
  display: flex;
  flex-direction: column;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 7px;
  color: var(--muted);
}

input[type="password"],
input[type="text"] {
  width: 100%;
  border: 1px solid #cfc5b7;
  background: #fffdfa;
  border-radius: 13px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  outline: none;
  margin-bottom: 20px;
  transition: all 0.25s ease;
}

input[type="password"]:focus,
input[type="text"]:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(115, 119, 98, .12);
}

.submit-btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--olive);
  color: white;
  box-shadow: 0 12px 28px rgba(94,98,79,.25);
  transition: .25s;
}

.submit-btn:hover {
  transform: translateY(-3px);
  background: var(--olive2);
}

/* ==========================================================================
   Bilder-Grid & Karten-Struktur
   ========================================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(67,59,48,.05);
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  z-index: 999 !important;
}

.img-wrapper {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #fdfcf7;
  overflow: hidden;
  border-radius: 17px 17px 0 0;
}

.img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.filename-box {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--paper);
  border-top: 1px solid rgba(81,76,69,.05);
  border-radius: 0 0 17px 17px;
}

/* FLACKERFREIE CSS-PREVIEW (Eingebettet als Kind-Element der Karte) */
.hover-preview-box {
  display: block;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px) scale(0.9);
  width: 340px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 20px 50px rgba(67,59,48,.25);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out, visibility 0.15s;
}

.card:hover .hover-preview-box {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-10px) scale(1);
}

.hover-preview-title {
  font: 600 20px/1.2 "Caveat", cursive;
  color: #675b50;
  margin-bottom: 8px;
  text-align: center;
}

.hover-preview-img-wrap {
  width: 100%;
  background: var(--cream);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.hover-preview-img-wrap img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.checkbox-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: var(--olive);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 15;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.hidden-checkbox {
  display: none !important;
}

.card.selected {
  border-color: var(--olive);
  box-shadow: 0 12px 40px rgba(115, 119, 98, 0.2);
}

.card.selected .checkbox-overlay {
  opacity: 1;
  transform: scale(1);
}

.card:hover:not(.selected) .checkbox-overlay {
  opacity: 0.4;
  transform: scale(0.9);
  background: var(--muted);
}

.selection-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 25px;
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 40px auto 0 auto;
  text-align: center;
}
.welcome-box.limit-warning {
    background: #fffbeb !important; /* Zartes Pastell-Gelb */
    border: 1px solid #fde68a !important; /* Passender Rahmen */
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.1);
}
@media(max-width: 650px) {
  body.gallery-view {
    padding-top: 80px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
  }
  .gallery-header {
    padding: 12px 20px;
  }
  .hover-preview-box {
    display: none !important;
  }
}
