/* ==========================================================================
   Adventskalender (js/app/advent.js)
   ==========================================================================
   Eigene Datei, damit er nach Weihnachten mit einer Zeile in index.html
   wieder verschwindet - und damit in styles.css nichts von ihm hängen
   bleibt. Alles beginnt mit "advent-".

   Reines CSS, keine Bilddatei, keine Bibliothek: Die Seite lädt nur eigene
   Dateien (Content-Security-Policy in index.html).

   Ebenen: Anrufknopf 1020, Warenkorb 1050, Kalender 1250, Bestätigung 1300,
   Meldungen 2000. Der Kalender liegt also über dem Warenkorb, aber unter
   dem Bestätigungsdialog und den Meldungen.
   ========================================================================== */

body.advent-offen { overflow: hidden; }

/* ---- Der schwebende Knopf: unten links, gegenüber dem Anrufknopf ---- */
.advent-fab {
  position: fixed;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 1020;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 56px;
  padding: 0 1.1rem 0 0.9rem;
  border: 2px solid rgba(214, 175, 92, 0.7);
  border-radius: 28px;
  background: linear-gradient(160deg, #2a6a4c, #163a2c);
  color: #f3dfa6;
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.advent-fab svg { width: 22px; height: 22px; animation: advent-glimmen 2.4s ease-in-out infinite; }
.advent-fab:active { transform: scale(0.96); }
.advent-fab:focus-visible { outline: 3px solid #1d4a3a; outline-offset: 3px; }
@keyframes advent-glimmen { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
/* Wie der Anrufknopf: Er weicht der Warenkorb-Leiste aus, die es nur
   unter 768px gibt, und wird am Telefon rund - der Stern sagt genug. */
@media (max-width: 767.98px) {
  body.has-cart-bar .advent-fab { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 576px) {
  .advent-fab { width: 56px; padding: 0; justify-content: center; }
  .advent-fab-text { display: none; }
}

/* ---- Abdunkeln ---- */
.advent-overlay {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 16, 13, 0.62);
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow-y: auto;
}
.advent-overlay.da { opacity: 1; }

/* ---- Der Kalender: Tannengrün, Lichterkette, Schnee ---- */
.advent-kalender {
  position: relative;
  width: min(680px, 100%);
  margin: auto;
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  border: 2px solid rgba(214, 175, 92, 0.55);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 0 1px, transparent 1.6px) 0 0 / 34px 34px,
    radial-gradient(circle, rgba(243, 223, 166, 0.08) 0 1px, transparent 1.6px) 17px 17px / 34px 34px,
    linear-gradient(180deg, #22573f 0%, #163a2c 70%, #12301f 100%);
  font-family: 'Raleway', sans-serif;
}
.advent-lichter {
  position: relative;
  height: 26px;
  display: flex;
  justify-content: space-around;
  padding: 0 6px;
  z-index: 2;
}
.advent-lichter svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.advent-lichter i {
  position: relative;
  width: 9px;
  height: 12px;
  margin-top: 9px;
  border-radius: 50% 50% 45% 45%;
  background: var(--c);
  box-shadow: 0 0 9px 2px var(--c);
  animation: advent-funkeln 1.8s ease-in-out infinite;
  animation-delay: var(--d);
}
.advent-lichter i::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 2px;
  width: 5px;
  height: 4px;
  background: #2b2b2b;
  border-radius: 1px;
}
@keyframes advent-funkeln { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; box-shadow: 0 0 2px 0 var(--c); } }

.advent-kopf { position: relative; z-index: 2; padding: 4px 56px 10px; text-align: center; }
.advent-kopf h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  font-size: 2rem;
  margin: 0;
  color: #f3dfa6;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.advent-kopf h2 svg { width: 22px; height: 22px; vertical-align: -2px; margin: 0 8px; color: #f3dfa6; }
.advent-kopf p { margin: 2px 0 0; color: #cfe0d6; font-size: 0.9rem; }
.advent-kopf .advent-vorschau-hinweis {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f3dfa6;
  color: #3a2c08;
  font-weight: 700;
  font-size: 0.78rem;
}
.advent-zu {
  position: absolute;
  top: 0;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.advent-schnee { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.advent-schnee span {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: var(--g);
  height: var(--g);
  border-radius: 50%;
  background: #fff;
  opacity: var(--o);
  filter: blur(var(--b));
  animation: advent-fallen var(--t) linear infinite;
  animation-delay: var(--d);
}
@keyframes advent-fallen { to { transform: translate(var(--w), 760px); } }

/* ---- Die Türen ---- */
.advent-tuerchen {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 11px;
  padding: 8px 20px 10px;
}
.advent-tuer {
  position: relative;
  aspect-ratio: 5 / 4;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  perspective: 650px;
  border-radius: 9px;
}
.advent-hinten {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #5a3c06;
  font-size: 0.62rem;
  background: radial-gradient(circle at 50% 42%, #fff2c4, #e2b04c 58%, #9a6a16);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25), inset 0 7px 16px rgba(0, 0, 0, 0.35);
}
.advent-hinten svg { width: 42%; height: 42%; }
.advent-hinten b { font-family: 'Playfair Display', Georgia, serif; font-size: 1.15rem; opacity: 0.75; }
.advent-fluegel {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 1.05s cubic-bezier(0.22, 1.3, 0.42, 1);
}
.advent-vorne,
.advent-rueck {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.advent-vorne {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 8px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.55rem;
  background: var(--holz);
  color: var(--zahl);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16), inset 0 0 0 5px rgba(0, 0, 0, 0.1),
              0 3px 6px rgba(0, 0, 0, 0.35);
}
.advent-vorne::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3c4, #c9962e);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.advent-rueck {
  transform: rotateY(180deg);
  background: var(--rueck);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18), inset -10px 0 14px rgba(0, 0, 0, 0.25);
}
.advent-deko { position: absolute; top: 6px; left: 7px; width: 17px; height: 17px; opacity: 0.9; color: var(--deko); }
.advent-vorne small {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Raleway', sans-serif;
  font-size: 0.58rem;
  opacity: 0.9;
  letter-spacing: 0.02em;
}
.advent-tuer.rot   { --holz: linear-gradient(155deg, #c0453e, #831f23); --rueck: #6e1a1d; --zahl: #fbe7b8; --deko: #fbe7b8; }
.advent-tuer.gruen { --holz: linear-gradient(155deg, #357a5d, #1b4634); --rueck: #163a2b; --zahl: #f3dfa6; --deko: #f3dfa6; }
.advent-tuer.creme { --holz: linear-gradient(155deg, #fff8e6, #eadbb6); --rueck: #d3c39b; --zahl: #8b6914; --deko: #b33a35; }
.advent-tuer.auf .advent-fluegel { transform: rotateY(-116deg); }
.advent-tuer.vorbei { cursor: default; }
/* Vergangene: nur noch die leere Nische - offene Klappen überall wären zu unruhig. */
.advent-tuer.vorbei .advent-fluegel { display: none; }
.advent-tuer.vorbei .advent-hinten {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(243, 223, 166, 0.55);
  box-shadow: inset 0 0 0 1px rgba(243, 223, 166, 0.25), inset 0 6px 12px rgba(0, 0, 0, 0.3);
}
.advent-tuer.heute .advent-vorne { box-shadow: 0 0 0 2px #f3dfa6, 0 0 20px 5px rgba(243, 223, 166, 0.6); }
.advent-tuer.heute .advent-fluegel { animation: advent-locken 2.6s ease-in-out infinite; }
@keyframes advent-locken { 0%, 82%, 100% { transform: rotateY(0); } 88% { transform: rotateY(-16deg); } 94% { transform: rotateY(-5deg); } }
.advent-tuer.heute.auf .advent-fluegel { animation: none; transform: rotateY(-116deg); }
.advent-tuer.ruhetag .advent-vorne small { color: #ffd3c9; }
.advent-tuer.creme.ruhetag .advent-vorne small { color: #9e2a2b; }
.advent-tuer.wackeln .advent-fluegel { animation: advent-wackeln 0.42s ease; }
@keyframes advent-wackeln { 25% { transform: rotateZ(-3deg); } 50% { transform: rotateZ(3deg); } 75% { transform: rotateZ(-1.5deg); } }
.advent-tuer:focus-visible { outline: 3px solid #f3dfa6; outline-offset: 3px; }
.advent-hinweis {
  position: relative;
  z-index: 2;
  min-height: 22px;
  padding: 2px 22px 16px;
  font-size: 0.86rem;
  color: #d9e7de;
  text-align: center;
}

/* ---- Die Karte, die aus dem Türchen springt ---- */
.advent-ueberraschung {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 18, 12, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.advent-ueberraschung.da { opacity: 1; pointer-events: auto; }
.advent-karte {
  position: relative;
  width: min(420px, 100%);
  background: #fffdf6;
  color: #3a2c08;
  border-radius: 16px;
  padding: 34px 24px 20px;
  text-align: center;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.45);
  transform: scale(0.55) translateY(40px) rotate(-4deg);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.2, 1.55, 0.4, 1), opacity 0.25s;
}
.da .advent-karte { transform: none; opacity: 1; }
.advent-karte::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(184, 134, 11, 0.45);
  border-radius: 11px;
  pointer-events: none;
}
.advent-schleife { position: absolute; top: -34px; left: 50%; width: 84px; height: 58px; transform: translateX(-50%); }
.advent-klein { font-size: 0.8rem; color: #8b6914; font-weight: 600; }
.advent-karte h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.7rem;
  line-height: 1.15;
  margin: 6px 0 8px;
  font-weight: 500;
}
.advent-karte p { margin: 0 0 4px; font-size: 0.92rem; color: #6a5a33; }
.advent-ticket { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 4px; flex-wrap: wrap; }
.advent-ticket b {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  background: #fff6dd;
  border: 2px dashed #b8860b;
  border-radius: 8px;
  padding: 6px 14px;
  color: #3a2c08;
}
.advent-ticket button {
  border: 1px solid #d9c38e;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: 'Raleway', sans-serif;
  font-size: 0.8rem;
  color: #6a5a33;
}
.advent-knopf-gold {
  width: 100%;
  margin-top: 12px;
  background: #b8860b;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.advent-knopf-gold:hover { background: #a5780a; }
.advent-karte button:focus-visible { outline: 3px solid #1d4a3a; outline-offset: 2px; }
.advent-leise {
  background: none;
  border: 0;
  margin-top: 8px;
  color: #6a5a33;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.advent-bed { display: block; margin-top: 10px; font-size: 0.76rem; color: #8a7a55; }

.advent-funken { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 7; pointer-events: none; }
.advent-funken span {
  position: absolute;
  width: var(--s);
  height: var(--s);
  background: var(--c);
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
  animation: advent-funke 1.15s cubic-bezier(0.12, 0.7, 0.3, 1) forwards;
}
@keyframes advent-funke {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--r)); opacity: 0; }
}

/* ---- Kurze Meldung, wenn der Code ohne Warenkorb übernommen wurde ---- */
.advent-merkzettel {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1260;
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #163a2c;
  color: #f3dfa6;
  font-size: 0.92rem;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  transition: opacity 0.6s ease;
}
.advent-merkzettel.weg { opacity: 0; }

/* ---- Aktionscode im Warenkorb ---- */
.aktionscode-box {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.85rem;
  border: 1px dashed rgba(184, 134, 11, 0.6);
  border-radius: 10px;
  background: #fffaf0;
}
.aktionscode-box.hidden { display: none; }
.aktionscode-box label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #6a4a08;
}
.aktionscode-box label i { color: #b33a35; margin-right: 0.3rem; }
.aktionscode-reihe { display: flex; gap: 0.5rem; }
.aktionscode-reihe input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid #d9c38e;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #fff;
}
.aktionscode-knopf {
  min-height: 44px;
  padding: 0 1rem;
  border: 0;
  border-radius: 8px;
  background: #1d4a3a;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.aktionscode-meldung { margin: 0.45rem 0 0; font-size: 0.85rem; min-height: 0; }
.aktionscode-meldung:empty { display: none; }
.aktionscode-meldung.ist-ok { color: #1d6a43; font-weight: 600; }
.aktionscode-meldung.ist-fehler { color: #a52a2a; }

/* Die Zwischensumme und der Abzug über "Gesamt" - nur mit gültigem Code. */
.cart-rabatt {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: #1d6a43;
  margin-bottom: 0.25rem;
}
.cart-rabatt.hidden { display: none; }
.cart-zwischen { color: var(--text-muted); }

/* ---- Telefon ---- */
@media (max-width: 767.98px) {
  .advent-overlay { align-items: flex-start; padding: 12px; }
  .advent-tuerchen { grid-template-columns: repeat(4, 1fr); gap: 9px; padding: 8px 14px; }
  .advent-tuer { aspect-ratio: 1 / 1; }
  .advent-vorne { font-size: 1.3rem; }
  .advent-kopf { padding: 4px 48px 8px; }
  .advent-kopf h2 { font-size: 1.55rem; }
  .advent-kopf h2 svg { display: none; }
}

/* ---- Wer weniger Bewegung eingestellt hat ---- */
@media (prefers-reduced-motion: reduce) {
  .advent-schnee, .advent-funken { display: none; }
  .advent-lichter i, .advent-fab svg,
  .advent-tuer.heute .advent-fluegel, .advent-tuer.wackeln .advent-fluegel { animation: none; }
  .advent-fluegel, .advent-karte, .advent-ueberraschung, .advent-overlay { transition: none; }
}
