/* ============================================================
 * Help Pages – Die Schützenapp
 * Integrated into the main website design system.
 *
 * Key design decisions:
 * - `.website-nav` and `.website-footer` are shown on the web
 *   but hidden when the page is loaded inside the app's WebView
 *   (WebView appends ?source=app to the URL, and the JS below
 *   adds the class `in-app` to <html>, which hides those elements).
 * - Content remains readable in the narrow WebView viewport.
 * - Anchor-based sections (#list, #details, #edit) are preserved.
 * ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:        #1C5040;
  --primary-light:  #216550;
  --primary-dark:   #143D30;
  --primary-faded:  rgba(28, 80, 64, 0.08);
  --primary-faded2: rgba(28, 80, 64, 0.14);
  --gold:           #C5A55A;
  --gold-light:     #d4b97a;
  --text-primary:   #1a1a1a;
  --text-secondary: #4a5568;
  --text-muted:     #718096;
  --background:     #ffffff;
  --surface:        #f8faf9;
  --border:         #e2e8f0;
  --border-light:   #f0f4f2;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --nav-height:     64px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ── In-app mode: hide website chrome ──────────────────────── */
html.in-app .website-nav,
html.in-app .website-footer,
html.in-app .breadcrumb-bar {
  display: none !important;
}

html.in-app body {
  padding-top: 0;
}

/* ── Website Navigation ─────────────────────────────────────── */
.website-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.website-nav .nav-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.website-nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.website-nav .nav-brand .nav-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
}

.website-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.website-nav .nav-links a {
  display: block;
  padding: 6px 14px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}

.website-nav .nav-links a:hover,
.website-nav .nav-links a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.website-nav .nav-links a.active {
  background: rgba(197,165,90,.25);
  color: var(--gold-light);
}

.website-nav .nav-cta {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.website-nav .nav-cta a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity .15s, transform .1s;
}

.website-nav .nav-cta a:hover { opacity: .9; transform: translateY(-1px); }

.website-nav .btn-store {
  background: var(--gold);
  color: #fff;
}

/* ── Breadcrumb bar ─────────────────────────────────────────── */
.breadcrumb-bar {
  background: var(--primary-dark);
  padding: 10px 24px;
}

.breadcrumb-bar .breadcrumb-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.breadcrumb-bar a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  transition: color .15s;
}

.breadcrumb-bar a:hover { color: #fff; }

.breadcrumb-bar .sep {
  color: rgba(255,255,255,.35);
  font-size: 0.75rem;
}

.breadcrumb-bar .current {
  color: #fff;
  font-weight: 500;
}

/* ── Page layout ────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Help header hero ───────────────────────────────────────── */
.help-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 40px 24px 36px;
}

.help-header .header-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.help-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -.02em;
}

.help-header p {
  font-size: 1rem;
  opacity: .85;
}

.help-header .header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.9);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}

/* ── Legacy .help-nav (app-only breadcrumb) ─────────────────── */
/* Only shown in-app (website-nav is hidden there, but help-nav
   is the old-style breadcrumb kept for app context). */
.help-nav {
  display: none; /* hidden on website; shown only in-app via override below */
  background: var(--primary-dark);
  padding: 8px 16px;
  font-size: 0.8rem;
}

html.in-app .help-nav { display: block; }

.help-nav a { color: rgba(255,255,255,.7); text-decoration: none; }
.help-nav a:hover { color: #fff; }
.help-nav .separator { color: rgba(255,255,255,.35); margin: 0 6px; }
.help-nav .current { color: #fff; }

/* ── Main content area ──────────────────────────────────────── */
.help-content {
  padding: 32px 24px 40px;
  max-width: 800px;
  margin: 0 auto;
}

/* When viewed in-app, remove side padding (WebView is narrow) */
html.in-app .help-content {
  padding: 16px;
  max-width: 100%;
}

/* ── Section ────────────────────────────────────────────────── */
.help-section {
  margin-bottom: 36px;
  scroll-margin-top: 80px; /* account for sticky nav */
}

.help-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-faded);
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-section h2 .section-icon {
  width: 26px;
  height: 26px;
  background: var(--primary-faded2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.help-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 20px;
  margin-bottom: 8px;
}

.help-section p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ── Section tabs (on website only) ─────────────────────────── */
.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

html.in-app .section-tabs { display: none; }

.section-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}

.section-tab:hover {
  background: var(--primary-faded);
  color: var(--primary);
}

.section-tab.active {
  background: var(--primary);
  color: #fff;
}

/* ── Feature list ───────────────────────────────────────────── */
.features {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.features li {
  position: relative;
  padding: 9px 12px 9px 36px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: border-color .15s;
}

.features li:hover {
  border-color: var(--primary-faded2);
}

.features li::before {
  content: "✓";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-light);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ── Step list ──────────────────────────────────────────────── */
.steps {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.steps li {
  position: relative;
  padding: 10px 14px 10px 46px;
  background: var(--primary-faded);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.steps li::before {
  content: attr(data-step);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Tip box ────────────────────────────────────────────────── */
.tip {
  background: var(--primary-faded);
  border-left: 3px solid var(--primary-light);
  padding: 12px 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 14px 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.tip strong { color: var(--primary); }

/* ── Home page – topic grid ─────────────────────────────────── */
.help-home-intro {
  padding: 32px 24px 0;
  max-width: 800px;
  margin: 0 auto;
}

.help-home-intro p {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  padding: 0 24px 40px;
  max-width: 1100px;
  margin: 0 auto;
}

.topic-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .18s, border-color .18s, transform .18s;
  box-shadow: var(--shadow-sm);
}

.topic-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-faded2);
  transform: translateY(-2px);
}

.topic-card .topic-icon {
  width: 42px;
  height: 42px;
  background: var(--primary-faded);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.topic-card .topic-text h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.topic-card .topic-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* In-app: single-column list instead of grid */
html.in-app .topic-grid {
  grid-template-columns: 1fr;
  padding: 12px 16px 24px;
  gap: 10px;
}

html.in-app .topic-card {
  padding: 14px;
}

html.in-app .help-home-intro {
  padding: 12px 16px 0;
}

/* ── Website footer ─────────────────────────────────────────── */
.website-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.75);
  padding: 36px 24px;
  margin-top: 48px;
}

.website-footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.website-footer .footer-brand {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.website-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  font-size: 0.83rem;
}

.website-footer .footer-links a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  transition: color .15s;
}

.website-footer .footer-links a:hover { color: #fff; }

.website-footer .footer-copy {
  font-size: 0.78rem;
  color: rgba(255,255,255,.45);
}

/* ── Legacy .help-footer (app only) ─────────────────────────── */
.help-footer {
  padding: 16px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.help-footer a {
  color: var(--primary-light);
  text-decoration: none;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --nav-height: 56px; }

  .website-nav .nav-links { display: none; }
  .website-nav .nav-brand { font-size: 0.95rem; }
  .website-nav .nav-cta .btn-store { display: none; }

  .help-header { padding: 28px 16px 24px; }
  .help-header h1 { font-size: 1.4rem; }

  .breadcrumb-bar { padding: 8px 16px; }

  .help-content { padding: 20px 16px 32px; }
  .help-home-intro { padding: 20px 16px 0; }
  .topic-grid { padding: 12px 16px 32px; }
}

/* ── Inline JS inserts in-app class ─────────────────────────── */
/* (No additional CSS needed; logic is in the <script> tag
   included in every page head.) */
