/* ==========================================================================
   School-App User Guide — shared stylesheet
   RTL Hebrew, matches school_base.html design tokens.
   ========================================================================== */

:root {
  --bg-page: #f5f0e6;
  --bg-card: #ffffff;
  --bg-soft: #faf6ee;
  --bg-muted: #ede6d6;
  --text-primary: #1a2332;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-inverse: #ffffff;
  --accent-primary: #2e4a7d;
  --accent-primary-hover: #1f3562;
  --accent-soft: #dfe7f5;
  --success: #2d7a4a;
  --success-bg: #d6ecdc;
  --warning: #b8761b;
  --warning-bg: #fdecc8;
  --danger: #b42c38;
  --danger-bg: #f7d4d8;
  --info: #2e4a7d;
  --info-bg: #dfe7f5;
  --border: #e5dcc8;
  --border-strong: #d4c7aa;
  --focus-ring: rgba(46,74,125,0.25);
  --font-body: 'Assistant','Segoe UI',Tahoma,Arial,sans-serif;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(26,35,50,0.06);
  --shadow-md: 0 4px 12px rgba(26,35,50,0.08);
  --shadow-lg: 0 12px 32px rgba(26,35,50,0.12);
  --ease: cubic-bezier(0.4,0,0.2,1);
}

*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html,body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.doc-hero {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: var(--text-inverse);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.doc-hero .breadcrumb {
  font-size: 14px; opacity: 0.85; margin-bottom: 8px;
}
.doc-hero .breadcrumb a { color: var(--text-inverse); text-decoration: underline; }
.doc-hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.doc-hero p { font-size: 17px; opacity: 0.95; max-width: 720px; margin: 0 auto; }
.doc-hero .hero-icon { font-size: 48px; margin-bottom: 10px; display: block; }

/* ---------- Layout ---------- */
.doc-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  max-width: 1240px;
  margin: 28px auto;
  padding: 0 20px;
}
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; gap: 16px; }
  .doc-sidebar { position: static !important; order: 2; }
}

.doc-sidebar {
  position: sticky; top: 20px;
  align-self: start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.doc-sidebar h3 {
  font-size: 14px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 10px; font-weight: 700;
}
.doc-toc { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.doc-toc a {
  display: block; padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  border-inline-start: 3px solid transparent;
  transition: all 0.15s var(--ease);
}
.doc-toc a:hover {
  background: var(--accent-soft); color: var(--accent-primary);
  text-decoration: none; border-inline-start-color: var(--accent-primary);
}
.doc-toc a.active {
  background: var(--accent-soft); color: var(--accent-primary);
  font-weight: 700; border-inline-start-color: var(--accent-primary);
}

/* ---------- Main content ---------- */
.doc-main { min-width: 0; }

.doc-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  box-shadow: var(--shadow-sm);
}
.doc-search {
  flex: 1; min-width: 220px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 15px; font-family: var(--font-body);
  direction: rtl; background: var(--bg-soft);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.doc-search:focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--bg-card);
}
.doc-btn {
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--accent-primary);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.doc-btn:hover { background: var(--accent-soft); border-color: var(--accent-primary); }
.doc-btn-primary { background: var(--accent-primary); color: var(--text-inverse); border-color: var(--accent-primary); }
.doc-btn-primary:hover { background: var(--accent-primary-hover); border-color: var(--accent-primary-hover); }

/* ---------- Section card ---------- */
.doc-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 26px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 20px;
}
.doc-section .sec-head {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.doc-section h2 {
  font-size: 22px; font-weight: 700;
  color: var(--text-primary);
  display: inline-flex; align-items: center; gap: 10px;
}
.doc-section h2 .sec-emoji { font-size: 26px; }
.doc-chip {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.02em;
}
.doc-chip.ck-admin { background: var(--danger-bg); color: var(--danger); }
.doc-chip.ck-finance { background: var(--warning-bg); color: var(--warning); }
.doc-chip.ck-core { background: var(--success-bg); color: var(--success); }
.doc-chip.ck-optional { background: var(--bg-muted); color: var(--text-muted); }

.doc-section .sec-summary {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.doc-section .sec-link {
  display: inline-block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--accent-primary);
  font-weight: 600;
}
.doc-section .sec-link::before { content: "↗ "; }

/* ---------- Details / accordion ---------- */
details.doc-details {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-soft);
  transition: background 0.15s;
}
details.doc-details[open] { background: var(--bg-card); box-shadow: var(--shadow-sm); }
details.doc-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--accent-primary);
  user-select: none;
  display: flex; align-items: center; gap: 8px;
  font-size: 15px;
}
details.doc-details > summary::-webkit-details-marker { display: none; }
details.doc-details > summary::before {
  content: "▾";
  display: inline-block;
  transition: transform 0.2s var(--ease);
  font-size: 12px;
}
details.doc-details[open] > summary::before { transform: rotate(180deg); }
details.doc-details > summary:hover { color: var(--accent-primary-hover); }

.doc-details-body { padding: 8px 20px 18px; }
.doc-details-body h4 {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
  margin: 12px 0 6px;
}
.doc-details-body ul {
  padding-inline-start: 22px;
  list-style: disc;
}
.doc-details-body ul li {
  margin: 4px 0;
  color: var(--text-secondary);
  line-height: 1.65;
}
.doc-details-body ul li strong { color: var(--text-primary); }
.doc-details-body .doc-note {
  background: var(--warning-bg);
  color: var(--warning);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin: 10px 0;
  font-size: 14px;
  border-inline-start: 3px solid var(--warning);
}
.doc-details-body .doc-tip {
  background: var(--info-bg);
  color: var(--accent-primary);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin: 10px 0;
  font-size: 14px;
  border-inline-start: 3px solid var(--accent-primary);
}
.doc-details-body code {
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  color: var(--text-primary);
}

/* ---------- Landing page cards ---------- */
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}
.landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s var(--ease);
  text-decoration: none;
  color: var(--text-primary);
  display: flex; flex-direction: column; gap: 10px;
}
.landing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
  text-decoration: none;
}
.landing-card .lc-icon { font-size: 42px; }
.landing-card h2 { font-size: 20px; color: var(--accent-primary); }
.landing-card p { color: var(--text-secondary); font-size: 15px; line-height: 1.6; }
.landing-card .lc-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-size: 12px; font-weight: 600;
  align-self: flex-start;
}

/* ---------- Footer ---------- */
.doc-footer {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.doc-footer a { color: var(--accent-primary); }

/* ---------- Search "no results" ---------- */
.doc-no-results {
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  display: none;
}
.doc-section.hidden-by-search { display: none; }

/* ---------- Print ---------- */
@media print {
  .doc-sidebar, .doc-toolbar, .doc-hero .breadcrumb, .doc-footer,
  .doc-btn, .doc-search { display: none !important; }
  .doc-layout { display: block; padding: 0; margin: 0; }
  .doc-section { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  details.doc-details { background: #fff !important; }
  details.doc-details > summary { color: #000 !important; }
  details.doc-details:not([open]) > .doc-details-body { display: block !important; }
  details.doc-details > summary::before { display: none; }
}
