/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8f7f4;
  color: #1a1a1a;
  min-height: 100vh;
}

/* ─── Suite Nav ─────────────────────────────────────────────────────────────── */
.suite-nav {
  background: #1a1a1a;
  display: flex;
  gap: .25rem;
  padding: .4rem .75rem;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.suite-nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: .75rem;
  padding: .25rem .5rem;
  border-radius: 4px;
}
.suite-nav a.active { color: #fff; background: #e85d04; }
.suite-nav a:hover { color: #fff; }

/* ─── Top Header ─────────────────────────────────────────────────────────────── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: .5rem;
}
.who { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; font-weight: 600; }
.logo-icon { font-size: 1.4rem; }
.switcher { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.nav-link { color: #e85d04; text-decoration: none; font-size: .9rem; }
.nav-link:hover { text-decoration: underline; }
.logout { color: #94a3b8; font-size: .85rem; text-decoration: none; }

/* ─── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: #e85d04;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .45rem .9rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.btn-primary:hover { background: #c74e03; }
.btn-sec {
  background: #f1f5f9;
  color: #374151;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: .45rem .9rem;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-sec:hover { background: #e2e8f0; }
.btn-del {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 6px;
  padding: .45rem .7rem;
  font-size: .9rem;
  cursor: pointer;
}
.btn-del:hover { background: #fca5a5; }

/* ─── Flash ───────────────────────────────────────────────────────────────────── */
.flash-wrap { padding: .5rem 1rem; background: #dcfce7; }
.flash { color: #166534; font-size: .9rem; }

/* ─── Login ───────────────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 80px); padding: 2rem;
}
.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-icon { font-size: 3rem; margin-bottom: .5rem; }
.login-card h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.login-card .muted { color: #64748b; margin-bottom: 1.5rem; font-size: .9rem; }
.login-card input[type=password] {
  width: 100%; padding: .7rem 1rem; border: 1px solid #e2e8f0;
  border-radius: 8px; font-size: 1.1rem; margin-bottom: 1rem; text-align: center;
  letter-spacing: .15em;
}
.login-card .btn-primary { width: 100%; justify-content: center; padding: .75rem; font-size: 1rem; }

/* ─── Search Bar ─────────────────────────────────────────────────────────────── */
.search-bar { padding: .75rem 1rem; background: #fff; border-bottom: 1px solid #e2e8f0; }
.search-row { display: flex; gap: .5rem; margin-bottom: .6rem; }
.search-input {
  flex: 1; padding: .5rem .75rem; border: 1px solid #e2e8f0;
  border-radius: 8px; font-size: .95rem;
}
.sort-select {
  padding: .5rem .5rem; border: 1px solid #e2e8f0;
  border-radius: 8px; font-size: .85rem; background: #fff;
}
.tag-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0;
  border-radius: 20px; padding: .2rem .65rem; font-size: .78rem;
  text-decoration: none; cursor: pointer; transition: background .15s;
}
.chip:hover { background: #e2e8f0; }
.chip-active { background: #e85d04; color: #fff; border-color: #e85d04; }
.chip-sm { font-size: .72rem; padding: .15rem .5rem; }

/* ─── Recipe Grid ───────────────────────────────────────────────────────────── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1rem;
}
.recipe-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
}
.recipe-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }
.card-img {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: #fef3c7;
}
.card-img-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: #d97706;
}
.card-body { padding: .8rem; flex: 1; display: flex; flex-direction: column; gap: .35rem; }
.card-title { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.card-desc { font-size: .82rem; color: #64748b; line-height: 1.4; }
.card-meta { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .78rem; color: #64748b; margin-top: auto; }
.tag-protein { color: #16a34a; font-weight: 600; }
.card-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: #64748b;
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 1.5rem; font-size: 1.1rem; }

/* ─── Recipe Detail ──────────────────────────────────────────────────────────── */
.recipe-hero {
  width: 100%; height: 240px;
  background-size: cover; background-position: center;
}
.recipe-detail { max-width: 720px; margin: 0 auto; padding: 1.5rem 1rem; }
.recipe-title { font-size: 1.8rem; font-weight: 700; margin-bottom: .75rem; }
.recipe-meta-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.meta-badge {
  background: #f1f5f9; color: #374151;
  border-radius: 6px; padding: .25rem .6rem; font-size: .82rem;
}
.meta-badge.muted { color: #94a3b8; }
.recipe-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: .75rem;
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.macro-item { text-align: center; }
.macro-val { font-size: 1.4rem; font-weight: 700; }
.macro-label { font-size: .75rem; color: #64748b; margin-top: .1rem; }
.macro-protein .macro-val { color: #16a34a; }
.recipe-section { margin-bottom: 1.5rem; }
.recipe-section h2 { font-size: 1.1rem; margin-bottom: .75rem; padding-bottom: .4rem; border-bottom: 2px solid #f1f5f9; }
.recipe-desc { color: #374151; line-height: 1.6; font-size: .95rem; }
.ingredients-list { display: flex; flex-direction: column; gap: .4rem; }
.ingredient {
  padding: .5rem .75rem;
  background: #fff;
  border-radius: 8px;
  border-left: 3px solid #e85d04;
  font-size: .9rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.steps-list { padding-left: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.steps-list li { line-height: 1.6; font-size: .9rem; padding: .4rem 0; }
.video-wrap {
  position: relative; padding-bottom: 56.25%;
  height: 0; overflow: hidden; margin-bottom: .75rem;
  border-radius: 8px; overflow: hidden;
}
.video-wrap iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.source-link { color: #e85d04; font-size: .85rem; word-break: break-all; text-decoration: none; }
.source-link:hover { text-decoration: underline; }

/* ─── Add/Edit Form ───────────────────────────────────────────────────────────── */
.form-wrap { max-width: 720px; margin: 0 auto; padding: 1.5rem 1rem; }
.form-wrap h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.form-section h3 { font-size: 1rem; margin-bottom: 1rem; color: #374151; }
label { display: block; font-size: .85rem; color: #64748b; margin-bottom: .75rem; }
label input, label textarea, label select {
  display: block; width: 100%; margin-top: .3rem;
  padding: .55rem .75rem; border: 1px solid #e2e8f0;
  border-radius: 8px; font-size: .95rem; font-family: inherit;
  background: #fafafa;
}
label textarea { resize: vertical; min-height: 100px; }
label input:focus, label textarea:focus {
  outline: none; border-color: #e85d04; background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) { .form-row-4 { grid-template-columns: 1fr 1fr; } }
.tag-check-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-check {
  display: flex !important; align-items: center; gap: .35rem;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 20px; padding: .3rem .7rem;
  font-size: .82rem; color: #374151; cursor: pointer;
  margin-bottom: 0 !important;
  width: auto !important;
}
.tag-check input { display: none !important; margin: 0 !important; width: auto !important; }
.tag-check:has(input:checked) { background: #e85d04; color: #fff; border-color: #e85d04; }
.hint { font-size: .78rem; color: #94a3b8; margin-top: .25rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; }

/* --- Video Import Box --- */
.video-import-box {
  background: linear-gradient(135deg, #fff8f0, #fff);
  border: 2px dashed #e85d04;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.video-import-label {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: .75rem;
  color: #e85d04;
}
.video-import-row {
  display: flex;
  gap: .5rem;
}
.video-url-input {
  flex: 1;
  padding: .55rem .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: .9rem;
}
.import-status {
  margin-top: .6rem;
  font-size: .85rem;
  padding: .4rem .6rem;
  border-radius: 6px;
  display: none;
}
.import-status:not(:empty) { display: block; }
.import-loading { background: #eff6ff; color: #1d4ed8; }
.import-ok { background: #dcfce7; color: #166534; }
.import-error { background: #fee2e2; color: #991b1b; }
