/* ============================================================
   Binaya360 User Guide — guide.css
   Theme: Slate & Copper  |  Supports LTR (en) and RTL (ar, ku)
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  /* Brand */
  --c-primary:        #1B2A4A;
  --c-primary-dark:   #132040;
  --c-primary-light:  #2C3E6B;
  --c-copper:         #C8713D;
  --c-copper-dark:    #A85E30;
  --c-copper-light:   #D4894E;
  --c-sage:           #3D8B6E;
  --c-steel:          #4A7FC1;
  --c-warning:        #D4944A;
  --c-error:          #C23B3B;

  /* Page */
  --c-bg:             #FAF8F5;
  --c-surface:        #FFFFFF;
  --c-border:         #E2E8F0;
  --c-border-light:   #EEF2F7;
  --c-text:           #1E2938;
  --c-text-muted:     #5A6A7E;
  --c-text-faint:     #8FA0B5;

  /* Layout */
  --sidebar-width:    280px;
  --topbar-height:    58px;
  --content-max:      860px;
  --content-pad:      clamp(1.25rem, 4vw, 3rem);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'Noto Sans Arabic', 'Segoe UI', sans-serif;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);

  /* Radius */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-med:  250ms ease;
}

/* ── RTL overrides ─────────────────────────────────────────── */
[dir="rtl"] {
  --font-sans: 'Noto Sans Arabic', 'Segoe UI', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: .9375rem;
  line-height: 1.7;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-steel); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-inline-start: 1.4em; }

/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: var(--topbar-height);
  background: var(--c-primary);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-inline: 1.25rem 1.25rem;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.3px;
  text-decoration: none !important;
}

.topbar-logo svg { flex-shrink: 0; }

.topbar-title {
  font-size: .8rem;
  font-weight: 400;
  color: rgba(255,255,255,.55);
  border-inline-start: 1px solid rgba(255,255,255,.2);
  padding-inline-start: .9rem;
  margin-inline-start: .2rem;
  white-space: nowrap;
}

.topbar-spacer { flex: 1; }

.topbar-lang {
  display: flex;
  gap: .35rem;
}

.topbar-lang a {
  color: rgba(255,255,255,.65);
  font-size: .78rem;
  font-weight: 500;
  padding: .25rem .55rem;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none !important;
}

.topbar-lang a:hover,
.topbar-lang a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.topbar-lang a.active {
  background: var(--c-copper);
  color: #fff;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: .4rem;
  border-radius: var(--r-sm);
}

.menu-toggle:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset-block: var(--topbar-height) 0;
  inset-inline-start: 0;
  width: var(--sidebar-width);
  background: var(--c-primary);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 90;
  padding-block: 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
  transition: transform var(--t-med);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-section {
  margin-block-end: .25rem;
}

.sidebar-group-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-copper);
  padding: .9rem 1.25rem .35rem;
  opacity: .9;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem 1.25rem .4rem 1.5rem;
  color: rgba(255,255,255,.7);
  font-size: .835rem;
  font-weight: 400;
  text-decoration: none !important;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
  border-inline-start: 2px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.95);
}

.sidebar-link.active {
  background: rgba(200,113,61,.15);
  color: #fff;
  font-weight: 500;
  border-inline-start-color: var(--c-copper);
}

.sidebar-link .link-num {
  font-size: .7rem;
  color: var(--c-copper);
  font-weight: 600;
  min-width: 1.4rem;
  opacity: .8;
}

.sidebar-sub {
  padding-inline-start: 1rem;
}

.sidebar-sub .sidebar-link {
  font-size: .8rem;
  padding-block: .3rem;
  padding-inline-start: 2rem;
}

/* ── Page Layout ───────────────────────────────────────────── */
.page-wrap {
  margin-inline-start: var(--sidebar-width);
  padding-block-start: var(--topbar-height);
  min-height: 100dvh;
}

.content {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--content-pad);
  padding-block-start: 2.5rem;
}

/* ── Hero Banner ───────────────────────────────────────────── */
.guide-hero {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-light) 100%);
  color: #fff;
  padding: 3rem var(--content-pad) 2.5rem;
  margin-block-end: 2.5rem;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

.guide-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -.5px;
  margin-block-end: .5rem;
  color: #fff;
}

.guide-hero p {
  font-size: 1rem;
  color: rgba(255,255,255,.75);
  max-width: 600px;
}

/* ── Section Headers ───────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding-block: 1rem .6rem;
  border-block-end: 2px solid var(--c-border);
  margin-block-end: 1.5rem;
  margin-block-start: 2.5rem;
}

.section-header:first-child { margin-block-start: 0; }

.section-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: rgba(27,42,74,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--c-primary);
}

.section-header h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--c-primary);
  letter-spacing: -.3px;
  margin: 0;
}

.section-header h2 .section-num {
  color: var(--c-copper);
  font-size: 1rem;
  font-weight: 600;
  margin-inline-end: .4rem;
}

/* ── Sub-section headers ───────────────────────────────────── */
h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--c-primary);
  margin-block: 2rem .75rem;
  padding-block-end: .4rem;
  border-block-end: 1px solid var(--c-border-light);
}

h4 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--c-text);
  margin-block: 1.25rem .5rem;
}

/* ── Body Text ─────────────────────────────────────────────── */
p { margin-block-end: .85rem; }
p:last-child { margin-block-end: 0; }

/* ── Callout Boxes ─────────────────────────────────────────── */
.callout {
  display: flex;
  gap: .85rem;
  padding: .9rem 1.1rem;
  border-radius: var(--r-md);
  border-inline-start: 4px solid;
  margin-block: 1.25rem;
  font-size: .88rem;
  line-height: 1.6;
}

.callout-icon {
  flex-shrink: 0;
  margin-block-start: .1rem;
}

.callout-body strong { display: block; margin-block-end: .2rem; font-size: .9rem; }
.callout-body p { margin: 0; }

.callout-note   { background: #EFF6FF; border-color: var(--c-steel); color: #1e3a5f; }
.callout-note   .callout-icon { color: var(--c-steel); }
.callout-tip    { background: #ECFDF5; border-color: var(--c-sage);  color: #14432d; }
.callout-tip    .callout-icon { color: var(--c-sage); }
.callout-warning{ background: #FFFBEB; border-color: var(--c-warning); color: #5a3a05; }
.callout-warning .callout-icon { color: var(--c-warning); }
.callout-important { background: #FEF2F2; border-color: var(--c-error); color: #5c1111; }
.callout-important .callout-icon { color: var(--c-error); }

/* ── Step Lists ────────────────────────────────────────────── */
ol.steps {
  list-style: none;
  padding: 0;
  margin-block: 1rem 1.5rem;
  counter-reset: step-counter;
}

ol.steps li {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  padding: .7rem 0;
  border-block-end: 1px solid var(--c-border-light);
  counter-increment: step-counter;
}

ol.steps li:last-child { border-block-end: none; }

ol.steps li::before {
  content: counter(step-counter);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-copper);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block-start: .15rem;
}

ol.steps li .step-body { flex: 1; }
ol.steps li .step-body strong { font-weight: 600; }
ol.steps li .step-body p { margin-block: .2rem 0; color: var(--c-text-muted); font-size: .875rem; }

/* ── Role / Permission Badges ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border-radius: 99px;
  vertical-align: middle;
  margin-inline: .15rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-admin      { background: #EEF2FF; color: #3730A3; border: 1px solid #C7D2FE; }
.badge-finance    { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.badge-engineering{ background: #FFF7ED; color: #9A3412; border: 1px solid #FED7AA; }
.badge-pm         { background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE; }
.badge-client     { background: #F0F9FF; color: #0C4A6E; border: 1px solid #BAE6FD; }
.badge-sysadmin   { background: #FFF1F2; color: #881337; border: 1px solid #FECDD3; }

/* ── Screenshot Placeholders ───────────────────────────────── */
figure.screenshot {
  margin-block: 1.75rem;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--c-border);
}

figure.screenshot img {
  width: 100%;
  display: block;
}

.screenshot-placeholder {
  background: linear-gradient(145deg, #f0f4fa 0%, #e8eef8 100%);
  border: 2px dashed #c4d0e3;
  border-radius: var(--r-lg);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .75rem;
  min-height: 180px;
  justify-content: center;
}

.screenshot-placeholder svg { color: #8fa8cf; opacity: .6; }

.screenshot-placeholder .placeholder-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--c-primary);
  opacity: .8;
}

.screenshot-placeholder .placeholder-file {
  font-size: .75rem;
  font-family: 'Courier New', monospace;
  color: var(--c-copper);
  background: rgba(200,113,61,.08);
  padding: .2rem .55rem;
  border-radius: var(--r-sm);
}

figcaption {
  background: var(--c-surface);
  padding: .6rem 1rem;
  font-size: .8rem;
  color: var(--c-text-muted);
  border-block-start: 1px solid var(--c-border);
  font-style: italic;
}

/* ── Key / UI Element highlight ────────────────────────────── */
kbd, .ui-key {
  display: inline-block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-block-end-width: 2px;
  border-radius: var(--r-sm);
  padding: .1rem .45rem;
  font-size: .8rem;
  font-family: inherit;
  color: var(--c-text);
  white-space: nowrap;
}

.ui-path {
  font-size: .85rem;
  color: var(--c-primary);
  background: rgba(27,42,74,.06);
  padding: .15rem .45rem;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
}

/* ── Tables ────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  margin-block: 1.25rem;
}

.data-table th {
  background: var(--c-primary);
  color: rgba(255,255,255,.9);
  font-weight: 600;
  padding: .65rem .85rem;
  text-align: start;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.data-table td {
  padding: .65rem .85rem;
  border-block-end: 1px solid var(--c-border-light);
  vertical-align: top;
}

.data-table tr:nth-child(even) td { background: rgba(27,42,74,.025); }
.data-table tr:hover td { background: rgba(200,113,61,.04); }

/* ── Section Divider ───────────────────────────────────────── */
.section-divider {
  border: none;
  border-block-start: 1px solid var(--c-border);
  margin-block: 3rem;
}

/* ── Back to Top ───────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  inset-block-end: 1.5rem;
  inset-inline-end: 1.5rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--c-copper);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--t-med), transform var(--t-med);
  z-index: 80;
}

#back-to-top.visible { opacity: 1; transform: translateY(0); }
#back-to-top:hover { background: var(--c-copper-dark); }

/* ── Progress Indicator ────────────────────────────────────── */
#read-progress {
  position: fixed;
  inset-block-start: var(--topbar-height);
  inset-inline: 0;
  height: 3px;
  background: var(--c-copper);
  transform-origin: inline-start;
  transform: scaleX(0);
  z-index: 95;
  transition: transform .1s linear;
}

/* ── Intro Overview Box ────────────────────────────────────── */
.intro-overview {
  background: linear-gradient(135deg, rgba(27,42,74,.045) 0%, rgba(200,113,61,.045) 100%);
  border: 1px solid rgba(27,42,74,.1);
  border-radius: var(--r-xl);
  padding: 1.75rem 2rem;
  margin-block-end: 2rem;
}

.intro-overview > p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-text);
  margin-block-end: 1.25rem;
}

.intro-stats {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  padding-block-start: 1rem;
  border-block-start: 1px solid rgba(27,42,74,.1);
}

.intro-stat .stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-copper);
  line-height: 1;
}

.intro-stat .stat-label {
  font-size: .78rem;
  color: var(--c-text-muted);
  margin-block-start: .25rem;
  font-weight: 500;
}

/* ── Feature Cards Grid ────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 1rem;
  margin-block: 1.25rem 2rem;
}

.feature-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  transition: box-shadow var(--t-med), transform var(--t-med), border-block-start-color var(--t-med);
  border-block-start: 3px solid transparent;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-block-start-color: var(--c-copper);
}

.feature-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: rgba(27,42,74,.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-primary);
  margin-block-end: .85rem;
  flex-shrink: 0;
}

.feature-card h4 {
  font-size: .92rem;
  font-weight: 600;
  color: var(--c-primary);
  margin-block: 0 .35rem;
  border: none;
  padding: 0;
}

.feature-card p {
  font-size: .83rem;
  color: var(--c-text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ── Role Cards Grid ───────────────────────────────────────── */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .85rem;
  margin-block: 1rem 1.5rem;
}

.role-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 1rem 1.1rem;
  border-inline-start: 4px solid;
}

.role-card.rc-admin      { border-inline-start-color: #3730A3; }
.role-card.rc-pm         { border-inline-start-color: #5B21B6; }
.role-card.rc-engineering{ border-inline-start-color: #9A3412; }
.role-card.rc-finance    { border-inline-start-color: #065F46; }
.role-card.rc-client     { border-inline-start-color: #0C4A6E; }
.role-card.rc-sysadmin   { border-inline-start-color: #881337; }

.role-card .role-badge-wrap {
  margin-block-end: .55rem;
}

.role-card .role-desc {
  font-size: .815rem;
  color: var(--c-text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ── Print Styles ──────────────────────────────────────────── */
@media print {
  .topbar, .sidebar, #back-to-top, #read-progress { display: none !important; }
  .page-wrap { margin-inline-start: 0 !important; }
  .content { padding: 1rem; max-width: 100%; }
  .screenshot-placeholder { border: 1px solid #ccc; background: #f5f5f5; }
  body { font-size: 11pt; }
  h2 { page-break-before: always; }
  h2:first-child { page-break-before: avoid; }
  figure.screenshot { page-break-inside: avoid; }
  ol.steps li { page-break-inside: avoid; }
  .callout { page-break-inside: avoid; border: 1px solid #ccc; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .page-wrap {
    margin-inline-start: 0;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .topbar-title { display: none; }
}

@media (max-width: 600px) {
  .topbar-lang { gap: .2rem; }
  .topbar-lang a { padding: .2rem .4rem; font-size: .72rem; }
  .guide-hero { padding: 2rem 1.25rem; }
}
