/* ============================================================
   KitchenSensei Web-App – Style
   Design-Referenz: dark / teal – app.kitchen-sensei.org
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f0e;
  --bg2:       #131614;
  --bg3:       #1a1d1b;
  --card:      #181b19;
  --card2:     #1f2320;
  --border:    #2a2f2c;
  --teal:      #00c896;
  --teal-dim:  #009e77;
  --teal-glow: rgba(0,200,150,.12);
  --red:       #e05555;
  --yellow:    #e0b544;
  --text:      #e8ede9;
  --text2:     #9aaa9e;
  --text3:     #5c6b60;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'Fira Code', monospace;
  --nav-h:     60px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: #fff; }

img { max-width: 100%; }

/* ---------- Layout ---------- */
.page-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* full-width variant */
main.full { max-width: 100%; padding: 0; }

/* ---------- Navigation ---------- */
nav.topnav {
  height: var(--nav-h);
  background: rgba(13,15,14,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}

.nav-logo-box {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: var(--teal);
  color: #000;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -.5px;
  font-family: var(--font);
}

.nav-brand img { width: 32px; height: 32px; border-radius: 8px; }

.nav-brand .dot { color: var(--teal); }

.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text2);
  font-size: .875rem;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--bg3);
  color: var(--text);
}

.nav-links a.active { color: var(--teal); }

/* dropdown */
.nav-group { position: relative; }

.nav-group > .nav-label {
  color: var(--text2);
  font-size: .875rem;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3rem;
  user-select: none;
  transition: background .15s, color .15s;
}

.nav-group:hover > .nav-label {
  background: var(--bg3);
  color: var(--text);
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  padding: .4rem;
  box-shadow: var(--shadow);
}

.nav-group:hover .nav-dropdown { display: flex; flex-direction: column; }

.nav-dropdown a {
  font-size: .85rem;
  color: var(--text2);
  padding: .45rem .75rem;
  border-radius: 6px;
}

.nav-dropdown a:hover { background: var(--bg3); color: var(--text); }

.nav-end {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}

.nav-user {
  font-size: .8rem;
  color: var(--text3);
}

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .8rem;
  color: var(--text3);
  flex-wrap: wrap;
}

footer .footer-brand { color: var(--text2); font-weight: 600; }
footer .footer-links { display: flex; gap: 1rem; }
footer .footer-links a { color: var(--text3); }
footer .footer-links a:hover { color: var(--teal); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: #000;
}
.btn-primary:hover { background: #00dfaa; color: #000; }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--card2); border-color: var(--teal); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text3); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(224,85,85,.3);
}
.btn-danger:hover { background: rgba(224,85,85,.1); }

.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-sm { padding: 1rem 1.25rem; }
.card-lg { padding: 2rem; }

.card:hover { border-color: #3a3f3c; }

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .5rem;
}

.card-sub {
  font-size: .85rem;
  color: var(--text2);
}

/* ---------- Badges / Chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
}

.badge-teal   { background: rgba(0,200,150,.15); color: var(--teal); border: 1px solid rgba(0,200,150,.25); }
.badge-gray   { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.badge-red    { background: rgba(224,85,85,.12); color: var(--red); border: 1px solid rgba(224,85,85,.25); }
.badge-yellow { background: rgba(224,181,68,.12); color: var(--yellow); border: 1px solid rgba(224,181,68,.25); }

.label-chip {
  display: inline-block;
  padding: .15rem .6rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .72rem;
  color: var(--text2);
  font-family: var(--mono);
}

/* ---------- Page Header ---------- */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.page-header .eyebrow {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--teal);
  margin-bottom: .5rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.page-header p {
  margin-top: .5rem;
  color: var(--text2);
  font-size: .95rem;
  max-width: 680px;
}

/* ---------- Section headings inside docs ---------- */
.doc-section {
  margin-top: 2.5rem;
}

.doc-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.doc-section h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1.1em;
  background: var(--teal);
  border-radius: 2px;
}

.doc-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.25rem 0 .6rem;
}

.doc-section p,
.doc-section li {
  color: var(--text2);
  font-size: .9rem;
  line-height: 1.75;
}

.doc-section ul,
.doc-section ol {
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

/* ---------- Table of Contents ---------- */
.toc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.toc-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  margin-bottom: .75rem;
  font-weight: 600;
}

.toc ol {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.toc a {
  font-size: .875rem;
  color: var(--text2);
}
.toc a:hover { color: var(--teal); }

/* ---------- Info / Warning boxes ---------- */
.info-box {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: .875rem;
  line-height: 1.6;
  margin: 1rem 0;
}

.info-box.teal  { background: var(--teal-glow); border-left: 3px solid var(--teal); color: var(--text2); }
.info-box.red   { background: rgba(224,85,85,.08); border-left: 3px solid var(--red); color: var(--text2); }
.info-box.gray  { background: var(--bg3); border-left: 3px solid var(--border); color: var(--text2); }
.info-box.yellow{ background: rgba(224,181,68,.08); border-left: 3px solid var(--yellow); color: var(--text2); }

/* ---------- Code blocks ---------- */
pre, code {
  font-family: var(--mono);
  font-size: .82rem;
}

pre {
  background: #0a0c0b;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  color: #b0c4b8;
  line-height: 1.65;
  margin: .75rem 0;
}

code:not(pre code) {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .4em;
  font-size: .82em;
  color: var(--teal);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  text-align: left;
  padding: .6rem 1rem;
  background: var(--bg3);
  color: var(--text2);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--bg3); }

td code { font-size: .8rem; }

/* ---------- Grid helpers ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }

/* ---------- Stat cards ---------- */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.stat-card .stat-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-note {
  font-size: .8rem;
  color: var(--text2);
}

/* ---------- Step list ---------- */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  counter-reset: step;
}

.step-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: #000;
  font-weight: 700;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .15rem;
}

.step-content h4 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}

.step-content p {
  font-size: .85rem;
  color: var(--text2);
  margin-top: .2rem;
}

/* ---------- Tag list ---------- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .5rem;
}

/* ---------- Divider ---------- */
hr.doc-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ---------- Forms ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}

label {
  font-size: .825rem;
  font-weight: 500;
  color: var(--text2);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=search],
textarea,
select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .875rem;
  padding: .55rem .9rem;
  width: 100%;
  font-family: var(--font);
  transition: border-color .15s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

input::placeholder, textarea::placeholder { color: var(--text3); }

textarea { resize: vertical; min-height: 80px; }

/* ---------- Checkbox / Status items ---------- */
.check-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  background: var(--bg3);
  border: 1px solid var(--border);
}

.check-row input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
  cursor: pointer;
}

/* ---------- Status indicator ---------- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.green  { background: var(--teal); box-shadow: 0 0 6px var(--teal); }
.status-dot.red    { background: var(--red); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.gray   { background: var(--text3); }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 2rem;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2rem;
}

.login-logo img { width: 44px; height: 44px; border-radius: 10px; }

.login-logo span {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .35rem;
}

.login-sub {
  font-size: .875rem;
  color: var(--text2);
  margin-bottom: 1.75rem;
}

/* ---------- Dashboard ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* ---------- Recipe list ---------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.recipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}

.recipe-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.recipe-card-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

.recipe-card-meta {
  font-size: .8rem;
  color: var(--text2);
}

/* ---------- Shopping list items ---------- */
.shopping-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .9rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .4rem;
  transition: background .1s;
}

.shopping-item.checked {
  opacity: .5;
  text-decoration: line-through;
}

.shopping-item-name {
  flex: 1;
  font-size: .875rem;
}

/* ---------- Admin status block ---------- */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.status-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: .9rem;
}

.status-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--teal-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text3);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text3); }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb .sep { color: var(--text3); }

/* ---------- Error page ---------- */
.error-wrap {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 1rem;
  padding: 2rem;
}

.error-code {
  font-size: 5rem;
  font-weight: 800;
  color: var(--teal);
  line-height: 1;
}

.error-msg {
  font-size: 1.1rem;
  color: var(--text2);
}

/* ---------- DB diagram ---------- */
.db-diagram {
  background: #0a0c0b;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  overflow-x: auto;
}

/* ---------- Architecture diagram ---------- */
.arch-layer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.arch-layer-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  min-width: 100px;
}

.arch-node {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .35rem .8rem;
  font-size: .82rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: .4rem;
}

.arch-node.highlight { border-color: var(--teal); color: var(--teal); }
.arch-node.warn { border-color: var(--yellow); color: var(--yellow); }

/* ---------- Progress bar ---------- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: .35rem;
}

.progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 3px;
  transition: width .3s;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root { --nav-h: 56px; }
  main { padding: 1.25rem 1rem; }
  .nav-links { display: none; }
  .page-header h1 { font-size: 1.35rem; }
}
