/* ═══════════════════════════════════════════════
   Pizza Mittwoch – Global Stylesheet
   ═══════════════════════════════════════════════ */

:root {
  --bg:           #0d0b09;
  --surface:      #181410;
  --card:         #211d18;
  --card-hover:   #2a2420;
  --border:       #342e27;
  --border-light: #433b32;

  --primary:      #e8520a;
  --primary-h:    #ff6522;
  --primary-dim:  rgba(232, 82, 10, 0.18);

  --text:         #f0ebe0;
  --text-2:       #c4b9a8;
  --text-muted:   #7a6e62;

  --success:      #4ade80;
  --success-dim:  rgba(74, 222, 128, 0.12);
  --danger:       #f87171;
  --danger-dim:   rgba(248, 113, 113, 0.12);
  --info:         #60a5fa;
  --info-dim:     rgba(96, 165, 250, 0.12);
  --warn:         #fbbf24;

  --radius:       14px;
  --radius-sm:    8px;
  --radius-xs:    5px;
  --shadow:       0 6px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm:    0 2px 12px rgba(0, 0, 0, 0.3);

  --transition:   0.18s ease;
  --nav-h:        62px;
}

/* ─── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ─── Typography ─────────────────────────────────── */
h1 { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.4rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
p  { color: var(--text-2); }

/* ─── Navigation ──────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(13, 11, 9, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin-right: auto;
}
.nav-brand span { color: var(--primary); }
.nav-brand .emoji { font-size: 1.4rem; }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
  background: var(--card);
  color: var(--text);
}
.nav-link.active { color: var(--primary); }
.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 0.85rem;
  color: var(--text-2);
}
.nav-user .uname { color: var(--text); font-weight: 500; }
.nav-sep { width: 1px; height: 20px; background: var(--border); }
.nav-logout {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: var(--transition);
}
.nav-logout:hover { color: var(--danger); background: var(--danger-dim); }

/* ─── Layout ─────────────────────────────────────── */
.page { max-width: 1240px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.page-title { margin-bottom: 0.35rem; }
.page-sub { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 2rem; }
.section-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ─── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card); color: var(--text); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid transparent; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); }
.btn-success { background: var(--success-dim); color: var(--success); border: 1px solid transparent; }
.btn-success:hover { background: rgba(74, 222, 128, 0.22); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: 0.4rem; border-radius: var(--radius-xs); }

/* ─── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 0.4rem;
}
.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ─── Pizza Cards Grid ────────────────────────────── */
.pizza-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.pizza-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.pizza-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border-light);
}
.pizza-card.ordered {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.pizza-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface);
}
.pizza-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--surface) 0%, var(--card-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.pizza-body { padding: 1rem 1.1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.pizza-name { font-size: 1rem; font-weight: 600; color: var(--text); }
.pizza-desc { font-size: 0.85rem; color: var(--text-muted); flex: 1; }
.pizza-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }
.tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.pizza-footer {
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pizza-footer .btn { flex: 1; }
.ordered-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 500;
}

/* ─── Panels / Cards ─────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.panel + .panel { margin-top: 1rem; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

/* ─── Order List ─────────────────────────────────── */
.order-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.order-item:last-child { border-bottom: none; }
.order-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.order-info { flex: 1; min-width: 0; }
.order-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-user { font-size: 0.78rem; color: var(--text-muted); }
.order-qty {
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}

/* ─── Shopping List ──────────────────────────────── */
.shop-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.shop-item:last-child { border-bottom: none; }
.shop-count {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.shop-name { font-size: 0.9rem; color: var(--text); }

/* ─── Ingredient Tag Input ────────────────────────── */
.tag-input-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.4rem;
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  cursor: text;
  transition: border-color var(--transition);
}
.tag-input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.tag-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--card-hover);
  border: 1px solid var(--border-light);
  border-radius: 99px;
  padding: 0.15rem 0.55rem;
  font-size: 0.82rem;
  color: var(--text);
}
.tag-item button {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.tag-item button:hover { color: var(--danger); }
.tag-input-field {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 0.88rem;
  flex: 1;
  min-width: 120px;
  padding: 0.2rem 0.2rem;
}
.tag-input-field::placeholder { color: var(--text-muted); }

/* ─── Alerts / Toasts ────────────────────────────── */
.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.alert-error { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.alert-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(74,222,128,0.3); }
.alert-info { background: var(--info-dim); color: var(--info); border: 1px solid rgba(96,165,250,0.3); }

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  pointer-events: auto;
  max-width: 320px;
}
.toast-success { background: #1a3320; color: var(--success); border: 1px solid rgba(74,222,128,0.25); }
.toast-error { background: #331a1a; color: var(--danger); border: 1px solid rgba(248,113,113,0.25); }
.toast-info { background: #1a2233; color: var(--info); border: 1px solid rgba(96,165,250,0.25); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ─── Upload Zone ────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 0.88rem;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--text);
}
.upload-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
}

/* ─── Modal ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-16px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ─── Table ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--card-hover); }
.code-badge {
  font-family: monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  background: var(--surface);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--warn);
}
.used { opacity: 0.45; text-decoration: line-through; }

/* ─── Tabs ───────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Quantity Stepper ────────────────────────────── */
.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}
.qty-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.qty-btn:hover { background: var(--primary); }
.qty-val { min-width: 24px; text-align: center; font-weight: 600; font-size: 0.9rem; }

/* ─── Empty State ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

/* ─── Divider ────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ─── Login Page ─────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(232, 82, 10, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(232, 82, 10, 0.05) 0%, transparent 50%),
    var(--bg);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo .big-emoji { font-size: 3rem; margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.5rem; }
.login-logo h1 span { color: var(--primary); }
.login-logo p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ─── Spinner ────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Badge ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-admin { background: rgba(251,191,36,0.15); color: var(--warn); }
.badge-primary { background: var(--primary-dim); color: var(--primary); }

/* ─── Date Banner ────────────────────────────────── */
.date-banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.date-banner .emoji { font-size: 1.5rem; }
.date-banner-text { flex: 1; }
.date-banner-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.date-banner-date { font-size: 1.1rem; font-weight: 600; }
.date-banner-countdown { font-size: 0.85rem; color: var(--primary); font-weight: 500; }

/* ─── Two-col layout ─────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  .nav { padding: 0 1rem; gap: 0.5rem; }
  .nav-links .nav-link span { display: none; }
  .page { padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.5rem; }
  .pizza-grid { grid-template-columns: 1fr; }
  .login-card { padding: 1.75rem 1.25rem; }
}

/* ─── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Skeleton ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ─── Search ──────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input { padding-left: 2.25rem !important; }
