/* ===== Grillmeister – Design V2 (Ember) ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #120e0b;
  --bg-2: #1b1511;
  --card: #211a14;
  --card-2: #2c231b;
  --card-3: #382d22;
  --text: #f6efe5;
  --muted: #a3937f;
  --accent: #ff7a3c;
  --accent-deep: #e35c1f;
  --amber: #ffb347;
  --green: #79c97e;
  --yellow: #ffd166;
  --red: #e86a6a;
  --border: #3a2f24;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: radial-gradient(1200px 500px at 50% -10%, #241a12 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.55;
}

.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.error { color: var(--red); margin-top: 0.6rem; font-size: 0.9rem; }
.grow { flex: 1; }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.space-between { justify-content: space-between; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.1rem 0; }
h1, h2, h3 { letter-spacing: -0.02em; }

/* ===== Toasts ===== */
#toasts {
  position: fixed; top: calc(0.75rem + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 0.5rem;
  width: min(92vw, 420px); pointer-events: none;
}
.toast {
  background: var(--card-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  text-align: center;
}
.toast.ok { border-color: #3f5c41; }
.toast.err { border-color: #6e3a3a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ===== Login ===== */
#view-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 1rem; position: relative; overflow: hidden;
}
.login-glow {
  position: absolute; inset: auto 0 -40% 0; height: 70%;
  background: radial-gradient(50% 60% at 50% 100%, rgba(255, 122, 60, 0.18) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.25rem 1.75rem;
  width: 100%; max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
}
.logo-ring {
  width: 84px; height: 84px; margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #3a2415, #241710);
  border: 1px solid #4b3423;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 40px rgba(255, 122, 60, 0.25);
}
.logo { font-size: 2.6rem; }
.wordmark { font-size: 2rem; font-weight: 800; }
.login-card form { margin-top: 1.75rem; text-align: left; }
#admin-login-details { margin: 0.85rem 0; }
#admin-login-details summary { color: var(--muted); cursor: pointer; font-size: 0.9rem; }
#login-form .btn { width: 100%; margin-top: 0.75rem; }

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(18, 14, 11, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1rem;
  padding-top: calc(0.7rem + env(safe-area-inset-top));
}
.topbar-logo { font-size: 1.05rem; }
.topbar-right { display: flex; gap: 0.35rem; align-items: center; }
.topbar-user { color: var(--muted); font-size: 0.85rem; margin-right: 0.25rem; }

/* ===== Layout ===== */
main {
  max-width: 640px; margin: 0 auto;
  padding: 1rem;
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 1rem;
}
.tab-page { display: flex; flex-direction: column; gap: 1rem; }

/* ===== Tab-Bar ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: rgba(18, 14, 11, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 0.05rem;
  background: none; border: none;
  color: var(--muted);
  font-family: inherit; font-size: 1.35rem;
  padding: 0.3rem 1.4rem;
  border-radius: 12px;
  cursor: pointer;
}
.tab span { font-size: 0.68rem; font-weight: 700; }
.tab.active { color: var(--amber); background: rgba(255, 179, 71, 0.08); }
.tab-badge {
  position: absolute; top: 0; right: 0.7rem;
  background: var(--accent); color: #fff;
  font-size: 0.62rem !important; font-weight: 800;
  border-radius: 99px; padding: 0.05rem 0.35rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
}
.card h3 { margin-bottom: 0.85rem; font-size: 1.15rem; }
.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.5rem; margin-bottom: 0.35rem;
}
.card-head h3 { margin-bottom: 0; }

/* ===== Hero ===== */
.hero {
  position: relative;
  background:
    radial-gradient(140% 120% at 85% -20%, rgba(255, 122, 60, 0.28) 0%, transparent 55%),
    linear-gradient(160deg, #2b1f15 0%, var(--card) 70%);
  border: 1px solid #46331f;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-flames {
  position: absolute; right: -18px; top: -22px;
  font-size: 7rem; opacity: 0.09; transform: rotate(12deg);
  pointer-events: none; user-select: none;
}
.hero-inner { padding: 1.5rem 1.3rem 1.3rem; position: relative; }
.hero h2 { font-size: 1.7rem; font-weight: 800; margin: 0.4rem 0 0.35rem; }
.hero-meta { display: flex; flex-direction: column; gap: 0.15rem; }
.meta-row { color: #d8c9b4; font-size: 0.95rem; }
.hero-desc { margin-top: 0.6rem; white-space: pre-wrap; color: #cfc0ab; }
.hero-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1rem; gap: 0.5rem;
}

/* ===== Chips ===== */
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.chip.countdown { background: rgba(255, 179, 71, 0.14); border-color: #6b4d1e; color: var(--amber); }
.chip.people { background: rgba(255, 255, 255, 0.05); }
.chip.weather { background: rgba(120, 170, 255, 0.1); border-color: #33475f; color: #a9c8f5; }
.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn.full { width: 100%; }

/* ===== Buttons ===== */
.btn {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 0.62rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.15s, transform 0.06s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-color: var(--accent-deep);
  color: #fff;
  box-shadow: 0 4px 14px rgba(227, 92, 31, 0.35);
}
.btn.big { width: 100%; padding: 0.85rem 1rem; font-size: 1.05rem; }
.btn.ghost { background: transparent; }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.85rem; border-radius: 9px; }
.btn.icon { padding: 0.35rem 0.55rem; font-size: 1.05rem; background: transparent; border: none; }
.btn.ai {
  background: linear-gradient(180deg, #3a2c4a 0%, #2c2138 100%);
  border-color: #4d3a63;
}
.btn:disabled { opacity: 0.5; cursor: default; }

/* ===== Forms ===== */
label { display: block; margin-bottom: 0.8rem; font-size: 0.88rem; color: var(--muted); }
.inline-label { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
.inline-label select { width: auto; margin: 0; }
input, select, textarea {
  display: block; width: 100%;
  margin-top: 0.3rem;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: #6e6153; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.checkbox { display: flex; align-items: center; gap: 0.55rem; color: var(--text); font-size: 0.95rem; }
.checkbox input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); }

/* ===== Segmented (RSVP) ===== */
.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.3rem; gap: 0.3rem;
}
.seg {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  background: transparent; border: none; border-radius: 10px;
  padding: 0.6rem 0.3rem;
  color: var(--muted);
  font-family: inherit; font-size: 1.15rem; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.seg span { font-size: 0.78rem; }
.seg.on-yes { background: rgba(121, 201, 126, 0.16); color: var(--green); box-shadow: inset 0 0 0 1px #3f5c41; }
.seg.on-maybe { background: rgba(255, 209, 102, 0.13); color: var(--yellow); box-shadow: inset 0 0 0 1px #6b5a2a; }
.seg.on-no { background: rgba(232, 106, 106, 0.13); color: var(--red); box-shadow: inset 0 0 0 1px #6e3a3a; }
.rsvp-extra { margin-top: 0.8rem; }

/* ===== Teilnehmer ===== */
#attendees { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.att-group-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.35rem; }
.att-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.att-chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.25rem 0.75rem 0.25rem 0.3rem;
  font-size: 0.88rem;
}
.att-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; color: #fff;
}
.att-plus { color: var(--muted); font-size: 0.8rem; }

/* ===== Fortschritt ===== */
.progress {
  height: 7px; background: var(--bg-2);
  border-radius: 99px; overflow: hidden;
  margin: 0.4rem 0 0.9rem;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--amber) 100%);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ===== Aktionen & Filter ===== */
.actions-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.filter-row { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.chip.filter { cursor: pointer; color: var(--muted); font-weight: 600; background: transparent; }
.chip.filter.active { background: var(--card-3); color: var(--text); border-color: #55432f; }
.chip .count { color: var(--amber); font-size: 0.8rem; }

/* ===== KI-Hinweis & Callout ===== */
.ai-hint {
  background: rgba(93, 70, 128, 0.14);
  border: 1px solid #4d3a63;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}
.ai-hint a { color: var(--amber); }
.callout {
  background: var(--card-2);
  border: 1px solid #55432f;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.93rem;
  white-space: pre-wrap;
  animation: toast-in 0.25s ease;
}
.callout-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }

/* ===== Items ===== */
.category-group { margin-top: 1rem; }
.category-title {
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--amber);
  margin-bottom: 0.45rem;
}
.item {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.45rem;
  animation: item-in 0.2s ease;
}
@keyframes item-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.item.open { border-color: #7a4a22; background: linear-gradient(90deg, rgba(255, 122, 60, 0.07), var(--card-2) 40%); }
.item.mine { border-color: #3f5c41; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 700; }
.item-meta { font-size: 0.8rem; color: var(--muted); }
.item-assignee { font-size: 0.8rem; margin-top: 0.1rem; }
.item-assignee.open { color: var(--amber); font-weight: 700; }
.item-assignee.mine { color: var(--green); font-weight: 700; }
.item-actions { display: flex; gap: 0.3rem; flex-shrink: 0; align-items: center; }
.empty-state { text-align: center; padding: 1.5rem 0.5rem 0.5rem; color: var(--muted); }
.empty-state .big-emoji { font-size: 2.4rem; display: block; margin-bottom: 0.4rem; }
.claim-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.3rem; }
.claim-chip {
  font-size: 0.72rem; font-weight: 600;
  background: var(--card-3); border: 1px solid var(--border);
  border-radius: 99px; padding: 0.08rem 0.5rem;
}
.claim-chip.me { background: rgba(121, 201, 126, 0.15); border-color: #3f5c41; color: var(--green); }
.slot-info { font-size: 0.75rem; color: var(--amber); font-weight: 700; }

/* ===== Bottom Sheets ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 200; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--card);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 0.6rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto;
  max-width: 640px; margin: 0 auto;
  animation: sheet-up 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }
.sheet-handle {
  width: 42px; height: 4px; border-radius: 99px;
  background: var(--card-3); margin: 0.35rem auto 1rem;
}
.sheet h3 { margin-bottom: 0.75rem; }
.sheet form .btn.big, .sheet .btn.big { margin-top: 0.35rem; }

/* ===== KI im Sheet ===== */
.ai-loading { padding: 0.5rem 0; }
.shimmer {
  height: 52px; border-radius: 13px; margin-bottom: 0.5rem;
  background: linear-gradient(90deg, var(--card-2) 25%, var(--card-3) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.suggestion {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0.6rem 0.8rem;
  margin: 0.45rem 0;
}
.suggestion-info { flex: 1; min-width: 0; }
.suggestion-info .cat { font-size: 0.78rem; color: var(--muted); }
#btn-ai-again { width: 100%; margin-top: 0.6rem; }

/* ===== Overlay (Einstellungen) ===== */
.overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, 0.65);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 1.5rem 1rem; overflow-y: auto;
}
.overlay-card { width: 100%; max-width: 480px; box-shadow: var(--shadow); }
#admin-msg.ok { color: var(--green); }
#admin-msg.err { color: var(--red); }

.footer-note { text-align: center; margin-top: 0.5rem; }

/* ===== Install-Banner ===== */
.install-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  background: linear-gradient(90deg, rgba(255, 122, 60, 0.12), var(--card));
  border: 1px solid #6b4d1e;
  border-radius: 14px;
  padding: 0.75rem 1rem;
}
.install-text { display: flex; flex-direction: column; min-width: 0; }
.install-text span { line-height: 1.35; }

/* ===== Kommentare ===== */
.comments { display: flex; flex-direction: column; gap: 0.55rem; max-height: 340px; overflow-y: auto; margin-bottom: 0.8rem; }
.comment { display: flex; gap: 0.55rem; align-items: flex-start; }
.comment-bubble {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  padding: 0.45rem 0.75rem;
  font-size: 0.92rem;
  flex: 1; min-width: 0;
}
.comment.mine .comment-bubble { background: #33261a; border-color: #55432f; border-radius: 14px 4px 14px 14px; }
.comment-head { display: flex; justify-content: space-between; gap: 0.5rem; }
.comment-name { font-weight: 700; font-size: 0.8rem; color: var(--amber); }
.comment-time { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.comment-text { white-space: pre-wrap; word-break: break-word; }
.comment-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.75rem; padding: 0.1rem; }
.comment-form { display: flex; gap: 0.5rem; }
.comment-form input { margin: 0; flex: 1; }
.comment-form .btn { flex-shrink: 0; padding: 0.62rem 1.1rem; }
.comments-empty { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 0.5rem 0; }

/* ===== Terminfindung ===== */
.poll-option {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.5rem;
}
.poll-option.winner { border-color: #6b4d1e; background: rgba(255, 179, 71, 0.07); }
.poll-date { font-weight: 700; margin-bottom: 0.35rem; }
.poll-bar-track { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin: 0.35rem 0; }
.poll-bar { height: 100%; background: linear-gradient(90deg, var(--green), #a5d6a7); border-radius: 99px; }
.poll-meta { font-size: 0.78rem; color: var(--muted); }
.poll-votes { display: flex; gap: 0.35rem; margin-top: 0.5rem; }
.poll-votes .btn { flex: 1; padding: 0.4rem 0.3rem; font-size: 0.9rem; }
.poll-votes .btn.sel-yes { background: rgba(121, 201, 126, 0.18); border-color: #3f5c41; color: var(--green); }
.poll-votes .btn.sel-maybe { background: rgba(255, 209, 102, 0.14); border-color: #6b5a2a; color: var(--yellow); }
.poll-votes .btn.sel-no { background: rgba(232, 106, 106, 0.14); border-color: #6e3a3a; color: var(--red); }
.poll-fix { margin-top: 0.5rem; width: 100%; }
#poll-inputs input { margin-bottom: 0.5rem; }
#btn-poll-add-option { width: 100%; margin-bottom: 0.6rem; }

/* ===== Fotos ===== */
.upload-drop {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  background: var(--card-2);
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 1.2rem 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  color: var(--text);
  text-align: center;
  transition: border-color 0.15s;
}
.upload-drop:hover, .upload-drop.dragover { border-color: var(--accent); }
.upload-drop .big-emoji { font-size: 1.9rem; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-2);
  cursor: pointer;
  border: 1px solid var(--border);
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-by {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 0.62rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  padding: 0.7rem 0.35rem 0.2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photos-empty { text-align: center; color: var(--muted); padding: 0.5rem 0 1rem; }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.lightbox img { max-width: 100vw; max-height: calc(100dvh - 90px); object-fit: contain; }
.lightbox-close { position: absolute; top: calc(0.5rem + env(safe-area-inset-top)); right: 0.75rem; font-size: 1.4rem; color: #fff; }
.lightbox-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #ddd;
}

@media (min-width: 640px) {
  main { padding: 1.5rem; }
  .hero h2 { font-size: 2rem; }
}
