/* ==========================================================================
   Snoopys4FUN Backend – Design-System (ohne Framework, mobil zuerst)
   ========================================================================== */
:root {
  --bg: #faf6ee;
  --surface: #ffffff;
  --surface-2: #f4efe4;
  --ink: #221e17;
  --muted: #6d6659;
  --line: #e6dfcf;
  --brand: #f26a00;
  --brand-ink: #ffffff;
  --brand-soft: #fff0e0;
  --sun: #ffd800;
  --header: #1f1a14;
  --header-ink: #fdf6e8;
  --ok: #1e8e3e;   --ok-soft: #e5f5ea;
  --bad: #c62828;  --bad-soft: #fdeaea;
  --warn: #b26a00; --warn-soft: #fff3d6;
  --info: #1f5fa8; --info-soft: #e6f0fb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(34, 30, 23, .06), 0 6px 20px rgba(34, 30, 23, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120e; --surface: #201b15; --surface-2: #2a241c; --ink: #f4ede0; --muted: #a79f8f;
    --line: #3a3326; --brand-soft: #3a2410; --header: #0d0b08;
    --ok-soft: #12301b; --bad-soft: #3a1717; --warn-soft: #3a2a0c; --info-soft: #14283f;
    --ok: #5fd07f; --bad: #ff7b7b; --warn: #ffb74d; --info: #7db6f5;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { vertical-align: -.2em; flex: none; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }

/* ---- Header / Navigation ------------------------------------------------ */
.site-header { background: var(--header); color: var(--header-ink); position: sticky; top: 0; z-index: 50; border-bottom: 3px solid var(--brand); }
.site-header__inner { display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; max-width: 1200px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.brand img { height: 34px; width: auto; display: block; }
.brand span { font-weight: 700; font-size: .95rem; opacity: .85; display: none; }
.nav-toggle { margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,.25); color: inherit; border-radius: 10px; padding: .45rem .6rem; cursor: pointer; }
.main-nav { display: none; flex-direction: column; width: 100%; padding: .25rem 0 .75rem; }
.site-header.is-open .main-nav { display: flex; }
.site-header__inner { flex-wrap: wrap; }
.main-nav a, .main-nav button.nav-link {
  display: flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; padding: .7rem .75rem;
  border-radius: 10px; font: inherit; background: none; border: 0; cursor: pointer; width: 100%; text-align: left;
}
.main-nav a:hover, .main-nav button.nav-link:hover { background: rgba(255,255,255,.1); }
.main-nav a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.main-nav form { margin: 0; }
.nav-sep { height: 1px; background: rgba(255,255,255,.15); margin: .35rem 0; }
@media (min-width: 900px) {
  .brand span { display: inline; }
  .nav-toggle { display: none; }
  .main-nav { display: flex; flex-direction: row; width: auto; margin-left: auto; padding: 0; align-items: center; gap: .15rem; flex-wrap: wrap; justify-content: flex-end; }
  .main-nav a, .main-nav button.nav-link { width: auto; padding: .5rem .65rem; }
  .nav-sep { width: 1px; height: 1.4rem; margin: 0 .35rem; }
}

/* ---- Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; flex: 1; }
.container--narrow { max-width: 760px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.site-footer { text-align: center; padding: 1.25rem 1rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.site-footer a { color: inherit; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.15rem; }
.card + .card { margin-top: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 760px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600;
  padding: .6rem 1.05rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 44px; transition: transform .05s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { background: #d95f00; }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger:hover { background: #a91f1f; }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 36px; padding: .35rem .8rem; font-size: .9rem; }
.btn--block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn--danger { color: var(--bad); }
.icon-btn--brand { color: var(--brand); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

/* ---- Formulare ----------------------------------------------------------- */
.form-group { margin-bottom: 1rem; }
label, .label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.hint { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=search],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .65rem .8rem; min-height: 46px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--sun) 70%, transparent); border-color: var(--brand); }
.choice { display: flex; align-items: center; gap: .55rem; font-weight: 500; margin: 0; padding: .55rem .75rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); flex: none; }
.choices { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.choices--inline { display: flex; flex-wrap: wrap; }
.form-grid { display: grid; gap: 0 1.25rem; }
@media (min-width: 760px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } }
.check-line { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.check-line input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }

/* ---- Hinweise ------------------------------------------------------------ */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 1rem; }
.alert--success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.alert--error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.alert--warning { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert--info { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.alert > div { color: var(--ink); }
.alert .icon { margin-top: .2rem; }
.alert a { color: inherit; font-weight: 600; }

/* ---- Badges / Smilies ---------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge--yes { background: var(--ok-soft); color: var(--ok); }
.badge--no { background: var(--bad-soft); color: var(--bad); }
.badge--maybe { background: var(--warn-soft); color: var(--warn); }
.badge--brand { background: var(--brand-soft); color: var(--brand); }
.smilie { display: inline-block; vertical-align: middle; }
.smilie-btn { background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 50%; line-height: 0; }
.smilie-btn:hover { background: var(--surface-2); }

/* ---- Dashboard: Event-Karten -------------------------------------------- */
.stat-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.25rem; }
.stat { display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .4rem 1rem .4rem .5rem; font-weight: 600; text-decoration: none; color: inherit; }
.stat b { font-size: 1.15rem; }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.event-card { display: grid; grid-template-columns: auto 1fr auto; gap: .85rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .85rem 1rem; }
.event-card--private .event-card__title { font-style: italic; color: var(--muted); }
.event-card--archived { opacity: .7; }
.datebox { width: 58px; text-align: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); padding: .3rem 0; line-height: 1.1; }
.datebox__wd { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.datebox__day { font-size: 1.6rem; font-weight: 800; }
.datebox__mon { font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.event-card__title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.event-card__meta { color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .1rem .9rem; }
.event-card__meta span { display: inline-flex; align-items: center; gap: .3rem; }
.event-card__info { font-size: .9rem; margin-top: .25rem; }
.mini-pills { display:flex; flex-wrap:wrap; gap:.3rem; margin-top:.4rem; }

/* ---- Tabellen (Desktop) / Karten (Mobil) -------------------------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: .7rem .9rem; }
.table td { padding: .8rem .9rem; border-top: 1px solid var(--line); vertical-align: top; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }
.row-archived td { color: var(--muted); }
@media (max-width: 859px) {
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: .75rem 1rem; border-top: 1px solid var(--line); }
  .table tr:first-child { border-top: 0; }
  .table td { border: 0; padding: .2rem 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: .35rem; }
  .table td.actions-cell { padding-top: .6rem; }
  .table .actions { justify-content: flex-start; }
}
.hide-mobile { display: none; }
@media (min-width: 860px) { .hide-mobile { display: revert; } }

.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tab { padding: .45rem 1rem; border-radius: 999px; text-decoration: none; color: var(--ink); border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: .92rem; }
.tab[aria-current="true"], .tab.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.toolbar form { display: flex; gap: .5rem; flex: 1 1 260px; max-width: 420px; }
.pagination { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; }

/* ---- Dialog (Event-Details) --------------------------------------------- */
dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); width: min(640px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20, 15, 8, .55); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.dialog__head h2 { margin: 0; font-size: 1.1rem; }
.dialog__body { padding: 1rem 1.1rem 1.25rem; overflow: auto; max-height: calc(100vh - 7rem); }
@media (max-width: 600px) { dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92vh; } }

dl.kv { display: grid; grid-template-columns: 1fr; gap: .1rem 1rem; margin: 0 0 1rem; }
dl.kv dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-top: .6rem; }
dl.kv dd { margin: 0; }
@media (min-width: 560px) { dl.kv { grid-template-columns: 150px 1fr; } dl.kv dt { margin-top: 0; padding-top: .15rem; } dl.kv dd { margin-bottom: .55rem; } }
.decision { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.decision button { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1rem .5rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; font-weight: 700; color: var(--ink); }
.decision button:hover { background: var(--surface-2); }
.decision button.is-current { border-color: var(--brand); background: var(--brand-soft); }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.people li { display: flex; align-items: center; gap: .5rem; }

/* ---- Rating -------------------------------------------------------------- */
.rating { display: flex; gap: .5rem; flex-wrap: wrap; }
.rating label { margin: 0; }
.rating input { position: absolute; opacity: 0; }
.rating span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--line); font-weight: 800; font-size: 1.2rem; cursor: pointer; background: var(--surface); }
.rating input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.rating input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---- Login / Gast-Seiten ------------------------------------------------- */
.guest-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background:
  radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--sun) 40%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--brand) 30%, transparent), transparent 60%), var(--bg); }
.guest-card { width: 100%; max-width: 420px; }
.guest-card .logo { display: block; margin: 0 auto 1rem; width: 240px; }
.guest-card h1 { text-align: center; font-size: 1.5rem; }
.guest-card .lead { text-align: center; color: var(--muted); margin-bottom: 1.25rem; }
.center { text-align: center; }

/* ---- Einstellungen ------------------------------------------------------- */
.settings-layout { display: grid; gap: 1rem; }
.settings-nav { display: flex; flex-wrap: wrap; gap: .4rem; }
.settings-nav a { padding: .4rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
@media (min-width: 960px) {
  .settings-layout { grid-template-columns: 220px 1fr; align-items: start; }
  .settings-nav { flex-direction: column; position: sticky; top: 5rem; }
  .settings-nav a { border-radius: var(--radius-sm); }
}
.settings-sections > section { scroll-margin-top: 5rem; }
.photo-preview { display: block; width: 100%; max-width: 280px; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); margin-bottom: .8rem; }
.photo-preview--square { aspect-ratio: 1; max-width: 220px; }

/* Mini-Editor (ersetzt CKEditor) */
.editor { border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.editor:focus-within { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--sun) 60%, transparent); }
.editor__bar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .35rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.editor__bar button { min-width: 38px; height: 38px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 700; color: var(--ink); }
.editor__bar button:hover { background: var(--line); }
.editor__area { padding: .8rem; min-height: 220px; outline: none; }
.editor__area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor__area p { margin: 0 0 .8em; }

/* ---- System / Diagnose --------------------------------------------------- */
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: grid; grid-template-columns: 70px 1fr; gap: .25rem .75rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.check-list li:first-child { border-top: 0; }
.check-list .detail { grid-column: 2; color: var(--muted); font-size: .9rem; word-break: break-word; }
.check-list .name { font-weight: 600; }

@media print {
  .site-header, .site-footer, .btn, .page-head__actions, .tabs, .toolbar, .icon-btn, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .table-wrap, .event-card { box-shadow: none; border-color: #bbb; }
}
.row-inquiry td { background: var(--bad-soft); }

/* ---- Galerien ------------------------------------------------------------ */
.gallery-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 1rem; }
.gallery-card + .gallery-card { margin-top: 0; }
.gallery-strip { display: flex; gap: .4rem; overflow: hidden; min-height: 64px; align-items: center; margin: .6rem 0; }
.gallery-strip img { height: 64px; width: auto; border-radius: 6px; }
.gallery-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gallery-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem; background: var(--surface-2); position: relative; }
.gallery-item img { width: 100%; height: 150px; object-fit: cover; border-radius: 6px; display: block; }
.gallery-item__cover { position: absolute; top: 1rem; left: 1rem; }
.gallery-item form { margin: .5rem 0 0; }
.gallery-item input[type=text] { width: 100%; margin-bottom: .4rem; }
.gallery-item details { margin-bottom: .4rem; font-size: .9rem; }
.gallery-item__actions { display: flex; gap: .4rem; margin-top: .5rem; }
.gallery-item__actions form { margin: 0; }
.gallery-item__actions .icon-btn[disabled] { opacity: .35; cursor: default; }
