/* ============================================================
   Party Potluck — modern glassmorphism theme, no dependencies
   ============================================================ */

:root {
  --bg-0: #0f0c29;
  --bg-1: #2a1b54;
  --accent: #a855f7;
  --accent-2: #ec4899;
  --accent-3: #38bdf8;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --text: #f5f3ff;
  --muted: #b9b2d6;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.14);
  --radius: 20px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win. Without this, the display rules on
   .login-view / .app-view (grid/flex) override [hidden], so toggling views in
   JS would have no effect and the app/form would stay visible without login. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 55%, #4c1d95 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- animated background orbs ---- */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}
.orb-1 { width: 420px; height: 420px; background: var(--accent);   top: -120px; left: -80px; }
.orb-2 { width: 380px; height: 380px; background: var(--accent-2); bottom: -140px; right: -60px; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: var(--accent-3); top: 40%; left: 55%; animation-delay: -11s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.1); }
  66%      { transform: translate(-30px, 25px) scale(0.95); }
}

/* ---- glass surfaces ---- */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.muted { color: var(--muted); }
.error { color: var(--bad); font-size: 0.9rem; margin: 0.6rem 0 0; }

/* ============ LOGIN ============ */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  animation: pop 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.login-emoji { font-size: 3.4rem; line-height: 1; animation: wiggle 2.5s ease-in-out infinite; }
.login-card h1 { margin: 0.6rem 0 0.2rem; font-size: 1.9rem; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 1.4rem; }

@keyframes wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50%      { transform: rotate(8deg); }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============ APP LAYOUT ============ */
.app-view {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.brand-emoji { font-size: 1.8rem; }
.brand h1 {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 2rem);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.card { border-radius: var(--radius); padding: 1.4rem 1.5rem; }

/* ---- event details ---- */
.event-description { margin: 0 0 1.1rem; font-size: 1.05rem; line-height: 1.55; white-space: pre-wrap; }
.event-meta { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.meta-item { display: flex; align-items: center; gap: 0.7rem; }
.meta-icon {
  font-size: 1.25rem;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 13px;
  background: var(--glass-strong);
}
.meta-item > div { display: flex; flex-direction: column; }
.meta-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.meta-value { font-size: 1rem; font-weight: 600; color: var(--text); text-decoration: none; }
a.meta-value:hover { text-decoration: underline; }
.event-map { margin-top: 1.2rem; }
.event-map iframe {
  display: block;
  width: 100%;
  height: 220px;
  border: 0;
  border-radius: 14px;
  background: var(--glass-strong);
}
.map-route { margin-top: 0.8rem; display: inline-flex; align-items: center; gap: 0.4rem; }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; }
.stat {
  border-radius: 16px;
  padding: 0.9rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(120deg, var(--accent-3), var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============ FORMS ============ */
.form-card h2, .list-section h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

input, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  resize: vertical;
}
input::placeholder, textarea::placeholder { color: rgba(185, 178, 214, 0.6); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}
input[type="datetime-local"] { color-scheme: dark; }

/* ---- status toggle ---- */
.status-toggle { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.status-opt {
  flex: 1;
  min-width: 110px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.5rem;
  transition: all 0.18s;
}
.status-opt:hover { color: var(--text); border-color: var(--accent); }
.status-opt.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4);
}
.form-actions { display: flex; gap: 0.6rem; align-items: center; }

/* ============ BUTTONS ============ */
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.7rem 1.2rem;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
  color: var(--text);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-block { width: 100%; }
.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(168, 85, 247, 0.45);
}
.btn-primary:hover { box-shadow: 0 14px 38px rgba(236, 72, 153, 0.5); }
.btn-primary:disabled { opacity: 0.55; cursor: progress; }
.btn-ghost {
  background: var(--glass-strong);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.18); }
.btn.icon { padding: 0.5rem 0.7rem; }

/* ============ LIST ============ */
.list-section { display: flex; flex-direction: column; gap: 0.7rem; }
.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.entry {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  border-radius: 16px;
  padding: 0.85rem 1.1rem;
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: slidein 0.35s ease;
}
@keyframes slidein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.entry .avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  flex-shrink: 0;
}
.entry .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.entry .name { font-weight: 700; }
.entry .item { color: var(--muted); font-size: 0.92rem; }
.entry .item.empty { font-style: italic; opacity: 0.7; }

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge.yes   { color: var(--good); background: rgba(52, 211, 153, 0.15); }
.badge.maybe { color: var(--warn); background: rgba(251, 191, 36, 0.15); }
.badge.no    { color: var(--bad);  background: rgba(251, 113, 133, 0.15); }

.entry-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.entry-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.35rem;
  border-radius: 8px;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.entry-actions button:hover { opacity: 1; background: var(--glass-strong); }

.empty { text-align: center; padding: 1.5rem; }
.app-footer {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}
.footer-credit { margin: 0; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(8, 5, 25, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius);
  padding: 1.6rem;
  animation: pop 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.3rem; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 14, 45, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.8rem 1.3rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { border-color: var(--bad); }

/* ============ RESPONSIVE ============ */
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .event-meta { gap: 1rem; }
  .status-opt { min-width: 0; }

  /* Header stapeln, damit der Titel nicht von den Buttons abgeschnitten wird. */
  .app-header { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .brand h1 { white-space: normal; overflow: visible; text-overflow: clip; }
  .header-actions { justify-content: flex-end; }
}
