/* Weihnachts-Design für die Wichtel-Webapp */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #ffecd2 0, #fcb69f 25%, #e53935 60%, #5c0b0b 100%);
  color: #2b1b1b;
  min-height: 100vh;
}

.snow-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 10% 20%, rgba(255,255,255,0.8) 50%, transparent 51%),
    radial-gradient(2px 2px at 80% 30%, rgba(255,255,255,0.9) 50%, transparent 51%),
    radial-gradient(2px 2px at 50% 80%, rgba(255,255,255,0.7) 50%, transparent 51%);
  background-size: 200px 200px;
  opacity: 0.6;
}

.page { position: relative; z-index: 1; padding: 20px; }

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  padding: 10px 20px;
  max-width: 1100px;
  margin: 0 auto 10px;
}

.top-bar a {
  color: #ffe6e6;
  text-decoration: none;
  margin-left: 10px;
  font-weight: 500;
}
.top-bar a:hover { text-decoration: underline; }

.title-wrap { text-align: center; color: #fff; margin-bottom: 15px; }
.title-wrap h1 { margin: 0; font-size: 2.2rem; }
.title-wrap p { margin: 4px 0 0; opacity: 0.9; }

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr);
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto 40px;
}
@media (max-width: 900px) { .main-grid { grid-template-columns: 1fr; } }

.card {
  background: rgba(255,255,255,0.95);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
}

.card h2 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.4rem;
}

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge-open { background: #1b5e20; color: #c8facc; }
.badge-closed { background: #b71c1c; color: #ffdde0; }

.info-text { font-size: 0.9rem; margin-bottom: 12px; }
.info-text strong { color: #b71c1c; }

table.gift-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
table.gift-table th, table.gift-table td {
  border-bottom: 1px solid #f0c5c5;
  padding: 6px 4px;
  text-align: left;
  font-size: 0.9rem;
}
table.gift-table th { background: #fde0dc; font-weight: 600; }
table.gift-table tr:last-child td { border-bottom: none; }

input[type="text"], input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #e0b3b3;
  font-size: 0.9rem;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: #c62828;
  box-shadow: 0 0 0 2px rgba(198,40,40,0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
}
.btn-primary { background: linear-gradient(135deg, #c62828, #d84315); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border: 1px dashed #d32f2f; color: #d32f2f; }
.btn-ghost:hover { background: rgba(211,47,47,0.08); }
.btn-small { padding: 5px 10px; font-size: 0.8rem; }

.message { padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 10px; }
.message-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.message-error { background: #ffebee; color: #b71c1c; border: 1px solid #ffcdd2; }

.assigned-user { font-size: 1rem; margin-bottom: 8px; }
.assigned-user span { font-weight: 700; color: #b71c1c; }
.assigned-list ul { padding-left: 18px; margin: 8px 0 0; font-size: 0.9rem; }
.assigned-list li { margin-bottom: 4px; }
.assigned-list a { color: #c62828; text-decoration: none; }
.assigned-list a:hover { text-decoration: underline; }

.status-text { font-size: 0.9rem; opacity: 0.9; }

.footer-note {
  text-align: center;
  font-size: 0.8rem;
  color: #ffe0e0;
  margin-bottom: 10px;
}
.footer-note a { color: #ffe0e0; text-decoration: underline; }
.footer-note a:hover { opacity: 0.9; }

/* zentrierte Karten für Login/Registrierung/Admin */
.center-wrap { max-width: 420px; margin: 40px auto; }

/* Kleine Überschrift in Karten */
.card h1 { font-size: 1.6rem; margin-top: 0; }

/* ===========================
   Mobile-Optimierung (Smartphone)
   =========================== */
@media (max-width: 900px) {
  .page { padding: 10px; }
  .card { padding: 15px; }
  .title-wrap h1 { font-size: 1.6rem; }
  .title-wrap p { font-size: 0.9rem; }
  .top-bar { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; }
  .main-grid { gap: 15px; }
  .center-wrap { max-width: 100%; margin: 20px auto; }
  .btn { width: 100%; justify-content: center; }
  .btn-small { width: auto; }
}

/* Wrapper bleibt ok */
.table-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ===============================
   Mobile Fix: Tabelle stapeln
   =============================== */
@media (max-width: 900px) {
  .mobile-stack,
  .mobile-stack thead,
  .mobile-stack tbody,
  .mobile-stack th,
  .mobile-stack td,
  .mobile-stack tr {
    display: block;
    width: 100%;
  }

  .mobile-stack thead { display: none; }

  .mobile-stack tr {
    background: #fff;
    border: 1px solid #f0c5c5;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
  }

  .mobile-stack td {
    border: none;
    padding: 6px 0;
  }

  .mobile-stack td::before {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #b71c1c;
    margin-bottom: 2px;
  }

  .mobile-stack td:nth-child(1)::before { content: "🎁 Geschenk"; }
  .mobile-stack td:nth-child(2)::before { content: "🔗 Link (optional)"; }
  .mobile-stack td:nth-child(3)::before { content: "💶 Preis (€)"; }
  .mobile-stack td:nth-child(4)::before { content: ""; }

  .mobile-stack td:last-child { text-align: right; }

  /* iOS/Android: besseres Tippen, verhindert Safari Auto-Zoom bei kleinen Fonts */
  input[type="text"], input[type="password"], textarea {
    font-size: 16px !important;
  }
}

/* iOS Text Autoscaling */
html { -webkit-text-size-adjust: 100%; }

/* Lange Links sauber umbrechen */
.assigned-list a, .card a, code, a { word-break: break-word; overflow-wrap: anywhere; }
