/* ==========================================================================
   Pitmaster HFU — BBQ-Theme
   Dunkles Grillkohle-Design mit Glut/Flammen-Akzenten.
   ========================================================================== */

:root {
  --bg: #171310;
  --bg-elevated: #211a15;
  --bg-card: #241d17;
  --bg-input: #2b221b;
  --border: #3a2e24;
  --text: #f3e9dd;
  --text-dim: #b8a795;
  --text-faint: #8a7862;
  --accent: #ff6a1a;
  --accent-2: #ffb100;
  --accent-deep: #c73e1d;
  --accent-gradient: linear-gradient(135deg, var(--accent-2), var(--accent), var(--accent-deep));
  --success: #6fbf6a;
  --danger: #e05252;
  --warning: #e0a83c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(ellipse at top, rgba(255, 106, 26, 0.10), transparent 55%),
    radial-gradient(ellipse at bottom, rgba(199, 62, 29, 0.08), transparent 60%);
  background-attachment: fixed;
}

a { color: var(--accent-2); text-decoration: none; }

h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.8rem; }
p { line-height: 1.5; color: var(--text-dim); }

#app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 84px; /* space for bottom nav */
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(36, 29, 23, 0.95), rgba(23, 19, 16, 0.85));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}
.topbar img.logo { width: 34px; height: 34px; border-radius: 8px; }
.topbar .title { font-weight: 800; font-size: 1.1rem; background: var(--accent-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn {
  background: none; border: none; color: var(--text-dim); font-size: 1.3rem; cursor: pointer; padding: 6px;
}

/* ---------- Main content ---------- */
.page { padding: 16px; display: flex; flex-direction: column; gap: 16px; flex: 1; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-box .value { font-size: 1.6rem; font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-box .label { font-size: 0.75rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 12px 22px;
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-gradient); color: #1a0f06; box-shadow: 0 6px 18px rgba(255, 106, 26, 0.35); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(224, 82, 82, 0.15); color: var(--danger); border: 1px solid rgba(224, 82, 82, 0.4); }
.btn-success { background: rgba(111, 191, 106, 0.15); color: var(--success); border: 1px solid rgba(111, 191, 106, 0.4); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-round {
  width: 96px; height: 96px; border-radius: 50%; font-size: 1.05rem; flex-direction: column;
}
.btn-round.running { background: linear-gradient(135deg, #e05252, #c73e1d); box-shadow: 0 0 0 8px rgba(224, 82, 82, 0.15), 0 6px 20px rgba(224,82,82,.4); }
.btn-round.idle { background: var(--accent-gradient); box-shadow: 0 0 0 8px rgba(255, 106, 26, 0.12), 0 6px 20px rgba(255,106,26,.4); }

.btn-group { display: flex; gap: 10px; }
.icon-round {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text); font-size: 1.1rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Forms ---------- */
label { display: block; font-size: 0.82rem; color: var(--text-dim); margin: 12px 0 6px; }
label:first-child { margin-top: 0; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text);
  font-size: 0.95rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 90px; }
.field-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.form-error-banner {
  background: rgba(224, 82, 82, 0.12); border: 1px solid rgba(224, 82, 82, 0.4); color: #ffb3b3;
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem;
}
.form-success-banner {
  background: rgba(111, 191, 106, 0.12); border: 1px solid rgba(111, 191, 106, 0.4); color: #c9edc4;
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.88rem;
}
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 999px; transition: 0.2s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute; height: 20px; width: 20px; left: 2px; top: 2px;
  background: var(--text-faint); border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent-deep); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); background: var(--accent-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 480px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg-elevated); color: var(--text-dim); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr.today-row { background: rgba(255, 106, 26, 0.08); }
tfoot td { font-weight: 800; background: var(--bg-elevated); }

/* ---------- Badges / status pills ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-open { background: rgba(224, 168, 60, 0.15); color: var(--warning); }
.badge-done { background: rgba(111, 191, 106, 0.15); color: var(--success); }
.badge-accepted { background: rgba(111, 191, 106, 0.15); color: var(--success); }
.badge-declined { background: rgba(224, 82, 82, 0.15); color: var(--danger); }
.badge-pending { background: rgba(184, 167, 149, 0.15); color: var(--text-dim); }
.badge-admin { background: rgba(255, 106, 26, 0.18); color: var(--accent-2); }
.badge-chef { background: rgba(255, 177, 0, 0.18); color: var(--accent-2); }
.badge-pitmaster { background: rgba(184, 167, 149, 0.18); color: var(--text-dim); }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 22px; text-align: center;
}
.login-screen img.logo-big { width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--shadow); }
.login-screen h1 { font-size: 1.8rem; }
.login-card { width: 100%; max-width: 360px; text-align: left; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(23, 19, 16, 0.97); border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text-faint); font-size: 0.62rem; padding: 6px 8px; border-radius: 10px;
  flex: 1; text-align: center;
}
.bottom-nav a .nav-icon { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--accent-2); }

/* ---------- Recipe scaling controls ---------- */
.scale-control { display: flex; align-items: center; gap: 12px; justify-content: center; }
.scale-control input { width: 70px; text-align: center; }

/* ---------- Misc ---------- */
.muted { color: var(--text-faint); font-size: 0.85rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--bg-input); border: 1px solid var(--border); }
.avatar-placeholder {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #1a0f06;
}
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.timer-display { font-size: 2.1rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.tag-chip {
  display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-dim); font-size: 0.8rem; cursor: pointer; margin: 4px 4px 0 0;
}
.tag-chip.active { background: var(--accent-gradient); color: #1a0f06; border-color: transparent; font-weight: 700; }
.fab-add {
  position: fixed; bottom: 92px; right: calc(50% - 360px + 20px);
  width: 54px; height: 54px; border-radius: 50%; background: var(--accent-gradient);
  color: #1a0f06; font-size: 1.6rem; border: none; box-shadow: var(--shadow); cursor: pointer; z-index: 25;
}
@media (max-width: 760px) {
  .fab-add { right: 20px; }
}
.empty-state { text-align: center; padding: 30px 10px; color: var(--text-faint); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: 8px; }
footer.app-footer { text-align: center; padding: 16px; }
footer.app-footer a { color: var(--text-faint); font-size: 0.78rem; margin: 0 8px; }
