/* ============================================================================
   tutorials.css — Lazy Podcaster Tutorials / Knowledge Base
   Single external stylesheet for the public KB + the admin panel.
   Reskinnable: adjust the variables in :root, classes stay stable.
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #eef2ff;
  --accent: #7c3aed;
  --success: #059669;
  --danger: #dc2626;
  --text: #1e1b4b;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --bg-sunken: #f3f4f6;
  --font-display: 'Manrope', 'Avenir Next', 'Segoe UI', sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(79, 70, 229, .10);
  --shadow-lg: 0 16px 48px rgba(79, 70, 229, .16);
}

html { scroll-behavior: smooth; }

.tut-body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg-alt);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.tut-container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.tut-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; font-size: .95rem;
  font-weight: 600; cursor: pointer; border: 1px solid transparent;
  transition: all .16s; white-space: nowrap; line-height: 1;
  font-family: var(--font-body);
}
.tut-btn:hover { text-decoration: none; }
.tut-btn-sm { padding: 7px 13px; font-size: .85rem; }
.tut-btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.30); }
.tut-btn-primary:hover { background: var(--primary-dark); }
.tut-btn-ghost { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.tut-btn-ghost:hover { background: var(--bg-sunken); }
.tut-btn-danger { background: var(--bg); color: var(--danger); border-color: var(--danger); }
.tut-btn-danger:hover { background: var(--danger); color: #fff; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.tut-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.tut-header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.tut-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; color: var(--text); }
.tut-brand:hover { text-decoration: none; }
.tut-brand-icon { width: 30px; height: 30px; border-radius: 7px; }
.tut-header-nav { display: flex; gap: 22px; font-weight: 600; font-size: .95rem; }
.tut-header-nav a { color: var(--text-muted); }
.tut-header-nav a:hover { color: var(--primary); text-decoration: none; }

/* ── Hero / search ───────────────────────────────────────────────────────── */
.tut-hero { background: var(--bg); border-bottom: 1px solid var(--border); padding: 48px 0 40px; text-align: center; }
.tut-hero-title { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; }
.tut-hero-sub { color: var(--text-muted); margin-top: 8px; font-size: 1.05rem; }
.tut-search { max-width: 560px; margin: 26px auto 0; }
.tut-search-input {
  width: 100%; padding: 14px 18px; font-size: 1rem; font-family: var(--font-body);
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-alt);
  color: var(--text); transition: border-color .16s, box-shadow .16s;
}
.tut-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); background: var(--bg); }

/* ── Main layout ─────────────────────────────────────────────────────────── */
.tut-main { display: grid; grid-template-columns: 240px 1fr; gap: 40px; padding-top: 40px; padding-bottom: 64px; }
.tut-empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); padding: 60px 0; }

/* Table of contents */
.tut-toc { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; }
.tut-toc ul { list-style: none; }
.tut-toc li { margin-bottom: 4px; }
.tut-toc a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: .92rem; }
.tut-toc a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }

/* ── Content / chapters / cards ──────────────────────────────────────────── */
.tut-content { min-width: 0; }
.tut-noresults { color: var(--text-muted); padding: 16px 0; }
.tut-chapter { margin-bottom: 44px; scroll-margin-top: 84px; }
.tut-chapter-title { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.tut-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.tut-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; transition: transform .14s, box-shadow .14s, border-color .14s;
}
.tut-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary-light); }
.tut-card-section { font-size: .8rem; font-weight: 700; color: var(--primary); letter-spacing: .01em; }
.tut-card-title { font-family: var(--font-display); font-size: 1.08rem; font-weight: 700; color: var(--text); }
.tut-card-excerpt { font-size: .9rem; color: var(--text-muted); line-height: 1.55; }
.tut-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.tut-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; background: var(--bg-sunken); color: var(--text-muted);
}
.tut-pill-video { background: var(--primary-light); color: var(--primary); }

/* ── Article view ────────────────────────────────────────────────────────── */
.tut-article-wrap { padding-top: 32px; padding-bottom: 64px; max-width: 820px; }
.tut-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; color: var(--text-muted); margin-bottom: 18px; }
.tut-breadcrumb-sep { color: var(--text-light); }

.tut-article { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 40px; box-shadow: var(--shadow); }
.tut-article-section { font-size: .85rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.tut-article-title { font-family: var(--font-display); font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.tut-article-desc { margin-top: 20px; font-size: 1.02rem; line-height: 1.7; color: #2c2950; }
.tut-article-desc p { margin-bottom: 14px; }
.tut-article-desc ul, .tut-article-desc ol { margin: 0 0 14px 22px; }
.tut-article-desc li { margin-bottom: 6px; }
.tut-article-desc code { background: var(--bg-sunken); padding: 2px 6px; border-radius: 6px; font-size: .9em; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.tut-article-desc a { color: var(--primary); font-weight: 600; }

/* Videos */
.tut-videos { margin-top: 30px; display: flex; flex-direction: column; gap: 28px; }
.tut-video-label { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }
.tut-video-frame { position: relative; width: 100%; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.tut-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tut-video-open { margin-top: 10px; font-size: .92rem; font-weight: 600; }

.tut-article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.tut-article-back { margin-top: 24px; font-weight: 600; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.tut-footer { border-top: 1px solid var(--border); background: var(--bg); padding: 24px 0; text-align: center; color: var(--text-light); font-size: .88rem; }

/* ============================================================================
   ADMIN
   ============================================================================ */
.tut-admin-body { background: var(--bg-sunken); }

/* Login */
.tut-login { max-width: 360px; margin: 12vh auto 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 32px; box-shadow: var(--shadow); }
.tut-login-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 20px; }
.tut-login-err { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem; margin-bottom: 16px; }
.tut-login-form { display: flex; flex-direction: column; gap: 16px; }
.tut-login-form .tut-btn { justify-content: center; }

/* Admin header */
.tut-admin-header { background: var(--text); color: #fff; }
.tut-admin-header-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.tut-admin-logo { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.tut-admin-header-actions { display: flex; gap: 20px; font-weight: 600; font-size: .9rem; }
.tut-admin-header-actions a { color: #c7d2fe; }
.tut-admin-header-actions a:hover { color: #fff; text-decoration: none; }

.tut-admin-main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }
.tut-admin-panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }

.tut-admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.tut-admin-toolbar-left, .tut-admin-toolbar-right { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.tut-admin-edit-heading { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.tut-admin-status { color: var(--text-muted); font-size: .9rem; }

/* Admin table */
.tut-admin-table-wrap { overflow-x: auto; }
.tut-admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tut-admin-table th { text-align: left; padding: 10px 12px; color: var(--text-muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--border); }
.tut-admin-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tut-admin-table tr:hover td { background: var(--bg-alt); }
.tut-admin-row-title { font-weight: 700; color: var(--text); }
.tut-admin-row-id { font-size: .78rem; color: var(--text-light); font-family: ui-monospace, Menlo, Consolas, monospace; }
.tut-admin-row-sub { color: var(--text-muted); font-size: .85rem; }

.tut-status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.tut-status-published { background: #dcfce7; color: #166534; }
.tut-status-draft { background: #fef3c7; color: #92400e; }

/* ── Form ────────────────────────────────────────────────────────────────── */
.tut-edit-form { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.tut-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tut-field { display: flex; flex-direction: column; gap: 6px; }
.tut-field > span, .tut-field > legend { font-weight: 700; font-size: .88rem; color: var(--text); }
.tut-field-inline { flex-direction: row; align-items: center; gap: 12px; }
.tut-field-inline > span { white-space: nowrap; }
.tut-req { color: var(--danger); font-style: normal; }
.tut-hint { font-weight: 500; font-style: normal; color: var(--text-light); font-size: .8rem; }

.tut-field input[type="text"],
.tut-field input[type="url"],
.tut-field input[type="password"],
.tut-field select,
.tut-field textarea {
  width: 100%; padding: 10px 13px; font-size: .95rem; font-family: var(--font-body);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); transition: border-color .16s, box-shadow .16s;
}
.tut-field textarea { resize: vertical; line-height: 1.6; }
.tut-field input:focus, .tut-field select:focus, .tut-field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light);
}

.tut-videos-field { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; gap: 12px; }
.tut-videos-field legend { padding: 0 6px; }
#tut-video-rows { display: flex; flex-direction: column; gap: 10px; }
.tut-video-row { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 10px; align-items: center; }
.tut-video-row input { width: 100%; padding: 9px 12px; font-size: .9rem; font-family: var(--font-body); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.tut-video-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.tut-edit-actions { display: flex; align-items: center; gap: 12px; padding-top: 6px; }

@media (max-width: 860px) {
  .tut-main { grid-template-columns: 1fr; }
  .tut-toc { display: none; }
  .tut-form-grid { grid-template-columns: 1fr; }
  .tut-video-row { grid-template-columns: 1fr; }
  .tut-article { padding: 26px 22px; }
}
