/* ── Reset & Basis ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --purple: #a855f7;
  --purple-dark: #7c3aed;
  --pink: #f472b6;
  --yellow: #fbbf24;
  --green: #34d399;
  --bg: #fdf4ff;
  --card-bg: #ffffff;
  --text: #374151;
  --muted: #9ca3af;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(124, 58, 237, 0.1);
}

body {
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Banner ─────────────────────────────────────────────────────────────────── */
.banner {
  background: linear-gradient(135deg, #f3e8ff 0%, #fce7f3 50%, #fef9c3 100%);
  border-bottom: 3px solid #e9d5ff;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}

.twins-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.twin-emoji {
  font-size: 3.5rem;
  display: block;
  animation: wobble 3s ease-in-out infinite;
}
.twin-emoji:last-child {
  animation-delay: 1.5s;
}

.banner-text h1 {
  font-family: "Fredoka One", cursive;
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--purple-dark);
  line-height: 1.1;
  letter-spacing: 0.5px;
}

.banner-text .subtitle {
  color: #6b7280;
  font-size: 1.05rem;
  margin-top: 0.4rem;
}

.balloons {
  margin-top: 0.75rem;
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
}

/* ── Haupt-Container ─────────────────────────────────────────────────────────── */
.container {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Counter ─────────────────────────────────────────────────────────────────── */
.counter {
  background: linear-gradient(90deg, #ede9fe, #fce7f3);
  border: 2px dashed #c4b5fd;
  border-radius: 99px;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--purple-dark);
  font-size: 1rem;
  justify-content: center;
}

/* ── Karten ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  border: 1.5px solid #f3e8ff;
}

.card h2 {
  font-family: "Fredoka One", cursive;
  color: var(--purple-dark);
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Formular ────────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

label {
  font-weight: 700;
  font-size: 0.9rem;
  color: #4b5563;
}

input[type="text"] {
  padding: 0.7rem 1rem;
  border: 2px solid #e9d5ff;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  background: #fdfaff;
}
input[type="text"]:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.btn-icon {
  display: inline-block;
}

.btn-submit:hover .btn-icon {
  animation: wobble 0.6s ease-in-out infinite;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.75rem;
  font-size: 1.05rem;
  font-family: "Nunito", inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    opacity 0.15s;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
  margin-top: 0.5rem;
}
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.45);
}
.btn-submit:active {
  transform: translateY(0);
}
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Feedback-Meldungen ──────────────────────────────────────────────────────── */
.message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  animation: fadeIn 0.25s ease;
}
.message.success {
  background: #dcfce7;
  color: #15803d;
  border: 1.5px solid #bbf7d0;
}
.message.error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1.5px solid #fecaca;
}
.message.hidden {
  display: none;
}

/* ── Beitragsliste ───────────────────────────────────────────────────────────── */
.contributions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.list-placeholder {
  color: var(--muted);
  text-align: center;
  padding: 2rem 0;
  font-style: italic;
}

.contribution-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(90deg, #faf5ff, #fdf4f9);
  border: 1.5px solid #f3e8ff;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  animation: fadeSlideIn 0.35s ease;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    border-color 0.15s;
  cursor: default;
  position: relative;
}
.contribution-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 12px rgba(168, 85, 247, 0.12);
  border-color: #c4b5fd;
}

/* Farbige Nummerierung */
.item-num {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--purple-dark);
  display: flex;
  align-items: flex-start;
  gap: 0.3em;
}

.item-thing {
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 0.3em;
}

.item-emoji {
  flex-shrink: 0;
}

.item-name > span,
.item-thing > span {
  word-break: break-word;
  min-width: 0;
}

/* Aktions-Buttons am Item (Bearbeiten / Löschen) */
.item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.contribution-item:hover .item-actions {
  opacity: 1;
}

.btn-action {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  transition: background 0.12s;
  line-height: 1;
}
.btn-edit-item {
  color: var(--purple);
}
.btn-edit-item:hover {
  background: #ede9fe;
}
.btn-delete {
  color: #ef4444;
}
.btn-delete:hover {
  background: #fee2e2;
}

/* Speichern / Abbrechen im Edit-Modus */
.btn-save {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  color: #16a34a;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  white-space: nowrap;
}
.btn-save:hover {
  background: #dcfce7;
}
.btn-cancel {
  color: #9ca3af;
}
.btn-cancel:hover {
  background: #f3f4f6;
}
.btn-save:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Eingabefelder im Edit-Modus */
.edit-fields {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.edit-fields input {
  border: 1.5px solid #c4b5fd;
  border-radius: 7px;
  padding: 0.3rem 0.55rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  background: white;
  transition: border-color 0.15s;
}
.edit-fields input:focus {
  border-color: var(--purple);
}

/* Bearbeitungs-Zustand des Items */
.contribution-item.editing {
  border-color: var(--purple);
  background: #fdf4ff;
}
.contribution-item.editing .item-actions {
  opacity: 1;
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid #f3e8ff;
}

/* ── Animationen ─────────────────────────────────────────────────────────────── */
@keyframes wobble {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Party Popper Animation ─────────────────────────────────────────────────── */
.party-popper-anim {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  transform: translate(-50%, -50%) scale(0);
  animation: partyPopperPop 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 4px 12px rgba(124, 58, 237, 0.35));
}

@keyframes partyPopperPop {
  0%   { transform: translate(-50%, -50%) scale(0)    rotate(-20deg); opacity: 0; }
  30%  { transform: translate(-50%, -65%) scale(1.35) rotate(12deg);  opacity: 1; }
  50%  { transform: translate(-50%, -60%) scale(0.92) rotate(-6deg);  opacity: 1; }
  65%  { transform: translate(-50%, -63%) scale(1.08) rotate(3deg);   opacity: 1; }
  78%  { transform: translate(-50%, -61%) scale(1.0)  rotate(-1deg);  opacity: 1; }
  88%  { transform: translate(-50%, -62%) scale(1.0)  rotate(0deg);   opacity: 0.85; }
  100% { transform: translate(-50%, -95%) scale(0.5)  rotate(10deg);  opacity: 0; }
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card {
    padding: 1.25rem;
  }
  .banner {
    padding: 1.5rem 1rem 1rem;
  }
  .twin-emoji {
    font-size: 2.5rem;
  }
}
