/* Kreta Drinks - mediterranes Theme, mobile first */
:root {
  --sea: #0d3d58;
  --sea-deep: #072a3f;
  --sky: #2b7fa6;
  --sun: #e2a03c;
  --coral: #d4566f;
  --olive: #6f8f52;
  --ink: #102f42;
  --muted: #5f7789;
  --paper: #f7f3e9;
  --paper-2: #efe9dc;
  --panel: #ffffff;
  --panel-soft: #fbf9f4;
  --line: rgba(13, 61, 88, .13);
  --line-strong: rgba(13, 61, 88, .26);
  --shadow-sm: 0 2px 8px rgba(7, 42, 63, .06);
  --shadow: 0 14px 34px rgba(7, 42, 63, .10);
  --shadow-lg: 0 26px 60px rgba(7, 42, 63, .16);
  --radius: 18px;
  --radius-sm: 12px;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky: #4fa6cf;
    --sun: #efb75c;
    --coral: #ef7f95;
    --olive: #8fb56c;
    --ink: #eaf3f7;
    --muted: #8fa8b8;
    --paper: #08202c;
    --paper-2: #0b2836;
    --panel: #0f2f3f;
    --panel-soft: #123748;
    --line: rgba(160, 205, 225, .16);
    --line-strong: rgba(160, 205, 225, .32);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
    --shadow: 0 14px 34px rgba(0, 0, 0, .38);
    --shadow-lg: 0 26px 60px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(900px 460px at 88% -8%, rgba(226, 160, 60, .26), transparent 62%),
    radial-gradient(760px 520px at 4% 4%, rgba(43, 127, 166, .20), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.shell {
  max-width: 1080px;
  margin: auto;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Kopf & Navigation ---------- */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 18px;
  background: linear-gradient(150deg, var(--sky), var(--sea));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.brand-text { font: 600 19px/1 var(--display); letter-spacing: -.01em; }
.brand-muted { color: var(--muted); font-weight: 500; }
.brand-muted::before { content: "/"; margin: 0 1px; opacity: .55; }

nav { display: flex; flex: none; gap: 2px; font-size: 13px; font-weight: 500; }
nav a {
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .18s, background .18s;
}
nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--sky) 12%, transparent); }
nav a.active { color: #f6fbfe; background: var(--sea); }
nav a.nav-stats { display: inline-flex; align-items: center; gap: 6px; color: var(--sky); font-weight: 600; }
@media (prefers-color-scheme: dark) { nav a.active { color: var(--paper); background: var(--sky); } }

main { flex: 1; padding: 34px 0 40px; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.08;
}
h1 { font-size: clamp(2rem, 8vw, 3.4rem); }
h2 { font-size: 1.2rem; letter-spacing: -.01em; }
p { margin: 0; color: var(--muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--sky);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .16em;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--sun); }

/* ---------- Startseite ---------- */
.hero { display: grid; gap: 22px; }
.hero-copy p { margin-top: 14px; max-width: 46ch; font-size: 17px; }
.hero h1 em { font-style: normal; color: var(--sky); }
.hero-card {
  display: block;
  position: relative;
  overflow: hidden;
  padding: 26px 24px;
  border-radius: var(--radius);
  color: #f4fbff;
  background: linear-gradient(155deg, var(--sea) 0%, var(--sea-deep) 100%);
  box-shadow: var(--shadow);
  transition: transform .16s, box-shadow .16s;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -56px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 186, 96, .5), transparent 68%);
}
.hero-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.hero-card strong { position: relative; display: block; margin-bottom: 8px; font: 600 20px/1.25 var(--display); }
.hero-card span { position: relative; color: rgba(233, 243, 248, .78); font-size: 15px; }
.hero-card .hero-card-cta { display: block; margin-top: 16px; color: var(--sun); font-weight: 600; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform .16s, border-color .16s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--sky); }
.chip-accent { border-color: transparent; color: #f6fbfe; background: linear-gradient(150deg, var(--sky), var(--sea)); }
.chip-accent:hover { border-color: transparent; }

/* ---------- Personenseite ---------- */
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  color: #f6fbfe;
  font: 600 22px/1 var(--display);
  background: linear-gradient(150deg, var(--sky), var(--sea));
  box-shadow: var(--shadow-sm);
}
.person-head h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); }
.person-head p { margin-top: 4px; }

.drink-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.drink-button {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease;
}
.drink-button:hover { transform: translateY(-3px); border-color: var(--sky); box-shadow: var(--shadow); }
.drink-button:active { transform: scale(.97); }
.drink-button:disabled { transform: none; opacity: .75; cursor: wait; }
.drink-icon { font-size: 26px; line-height: 1; }
.drink-name { font: 600 17px/1.2 var(--display); }
.drink-amount {
  margin-top: auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sky) 14%, transparent);
  color: var(--sky);
  font-size: 12px;
  font-weight: 600;
}
.drink-button.done { border-color: var(--olive); }
.drink-button.done::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--olive);
  color: #fff;
  font-size: 40px;
  font-weight: 700;
  animation: pop .45s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }

.recent { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head span { color: var(--muted); font-size: 13px; }

/* ---------- Listen ---------- */
.card-list { display: grid; gap: 8px; }
.log-row, .admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-main > div { min-width: 0; }
.row-main strong { display: block; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.row-icon { flex: none; font-size: 20px; }
.log-time { color: var(--muted); font-size: 13px; }
.pill {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sky) 14%, transparent);
  color: var(--sky);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Verwaltung ---------- */
.admin-head { margin-bottom: 24px; }
.admin-head p { margin-top: 8px; }
.admin-section {
  padding: 20px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  box-shadow: var(--shadow-sm);
}
.form-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
input, select {
  flex: 1 1 160px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  transition: border-color .16s, box-shadow .16s;
}
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 22%, transparent);
}
.name-input { flex: 2 1 200px; }
select { flex: 1 1 100%; }

/* Feld mit Einheit bzw. Präfix: der Rahmen sitzt am Label, nicht am Input */
.amount-field, .slug-field {
  display: flex;
  align-items: center;
  flex: 1 1 150px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: border-color .16s, box-shadow .16s;
}
.amount-field:focus-within, .slug-field:focus-within {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 22%, transparent);
}
.amount-field input, .slug-field input { flex: 1 1 auto; border: 0; background: transparent; }
.amount-field input:focus, .slug-field input:focus { box-shadow: none; }
.amount-field input { padding-right: 6px; text-align: right; }
.slug-field input { padding-left: 2px; }
.unit { flex: none; color: var(--muted); font-size: 13px; white-space: nowrap; }
.amount-field .unit { padding-right: 14px; }
.slug-field .unit { padding-left: 14px; }

.admin-section .card-list { margin-top: 14px; }
.edit-row { flex-wrap: wrap; gap: 8px; }
.edit-row input { padding: 10px 12px; }
.edit-row .name-input { flex: 3 1 120px; }
.edit-row .amount-field { flex: 1 1 92px; }
.edit-row .slug-field { flex: 1 1 100%; }
.edit-row .row-icon { align-self: center; }
.row-actions { display: flex; gap: 6px; margin-left: auto; }
.ghost {
  padding: 10px 14px;
  background: transparent;
  color: var(--sky);
  font-size: 14px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.ghost:hover { background: color-mix(in srgb, var(--sky) 12%, transparent); color: var(--sky); }

button, .button-link {
  flex: none;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--sea);
  color: #f6fbfe;
  font: 600 15px var(--sans);
  cursor: pointer;
  transition: background .16s, transform .12s;
}
button:hover, .button-link:hover { background: var(--sky); }
button:active { transform: scale(.97); }
.danger { padding: 8px 12px; background: transparent; color: var(--coral); font-size: 14px; }
.danger:hover { background: color-mix(in srgb, var(--coral) 14%, transparent); color: var(--coral); }

.empty {
  padding: 28px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-align: center;
}

.loader {
  width: 26px;
  height: 26px;
  margin: 40px auto;
  border: 3px solid var(--line-strong);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: min(92vw, 420px);
  padding: 13px 20px;
  border: 1px solid rgba(160, 205, 225, .22);
  border-radius: 999px;
  background: var(--sea-deep);
  color: #f4fbff;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

main > * { animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Kleine Handys ---------- */
@media (max-width: 430px) {
  .shell { padding: 14px 14px calc(20px + env(safe-area-inset-bottom)); }
  .topbar { gap: 8px; padding: 8px 8px 8px 12px; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; }
  .brand-text { font-size: 17px; }
  .brand-muted { display: none; }
  nav { font-size: 12.5px; }
  nav a { padding: 6px 8px; }
  nav a.nav-stats .nav-label { display: none; }
  .drink-grid { gap: 10px; }
  .log-row, .admin-row { padding: 12px 14px; }
}

/* ---------- Ab Tablet ---------- */
@media (min-width: 640px) {
  .shell { padding: 24px 28px 30px; }
  main { padding: 56px 0; }
  nav { gap: 4px; font-size: 14px; }
  nav a { padding: 7px 12px; }
  .drink-grid { grid-template-columns: repeat(3, 1fr); }
  .drink-button { min-height: 132px; }
  .recent .card-list { max-width: 720px; }
}

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 48px; }
  .hero-card { padding: 32px 30px; }
  .drink-grid { grid-template-columns: repeat(4, 1fr); }
}
