/* ===== BOOTSTRAP REFERENCE - SHARED STYLES ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --border: #334155;
  --border2: #475569;
  --accent: #3b82f6;
  --accent2: #8b5cf6;
  --green: #10b981;
  --text: #f8fafc;
  --muted: #94a3b8;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
}

/* ---- TOPBAR ---- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem;
  gap: 1rem;
}
.topbar-brand {
  font-size: 1.2rem; font-weight: 800;
  color: var(--text);
  text-decoration: none;
}
.topbar-brand i { color: var(--accent); }
.topbar-title {
  font-size: 1rem; color: var(--muted);
  border-right: 1px solid var(--border2);
  padding-right: 1rem;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: 60px; right: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto; padding: 1.5rem 0;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-section-title {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 1px;
  color: var(--muted); text-transform: uppercase;
  padding: 0.5rem 1.2rem 0.3rem;
}
.sidebar a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1.2rem;
  color: var(--muted); font-size: 0.95rem; text-decoration: none;
  border-right: 3px solid transparent;
  transition: all 0.2s;
}
.sidebar a:hover { color: var(--text); background: var(--surface2); }
.sidebar a.active {
  color: var(--text); background: rgba(59, 130, 246, 0.15);
  border-right-color: var(--accent);
  font-weight: 600;
}
.sidebar a i { width: 20px; text-align: center; }

/* ---- MAIN CONTENT ---- */
.main {
  margin-right: var(--sidebar-w);
  margin-top: 60px;
  padding: 3rem 2rem;
  max-width: 1000px;
}

/* ---- PAGE HEADER ---- */
.page-header { margin-bottom: 3rem; }
.page-header h1 {
  font-size: 2.2rem; font-weight: 800; color: var(--text);
}
.page-header h1 i { color: var(--accent); margin-left: 0.5rem; }
.page-header .description {
  color: var(--muted); margin-top: 0.8rem; font-size: 1.1rem; line-height: 1.8;
}
.page-header .bs-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1rem; color: var(--accent); font-size: 0.95rem;
  text-decoration: none; font-weight: 600;
  background: rgba(59, 130, 246, 0.1); padding: 0.4rem 1rem; border-radius: 50px;
  transition: background 0.2s;
}
.page-header .bs-link:hover { background: rgba(59, 130, 246, 0.2); }

/* ---- SECTION ---- */
.doc-section { margin-bottom: 4rem; scroll-margin-top: 90px; }

.section-header { margin-bottom: 1.5rem; }
.section-header h2 {
  font-size: 1.5rem; font-weight: 700; color: var(--text);
}
.section-header .section-desc {
  color: var(--muted); font-size: 1rem; line-height: 1.7; margin-top: 0.4rem;
}

/* ---- COMPONENT CARD ---- */
.comp-card {
  border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  background: var(--surface);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.comp-label {
  padding: 0.8rem 1.2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem; color: var(--muted); font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}

.comp-preview {
  padding: 2.5rem;
  background: var(--surface);
  min-height: 100px;
}
/* If preview is forced to light mode */
.comp-preview[data-bs-theme="light"] {
  background: #f8fafc;
  color: #0f172a;
}

/* ---- EXPLANATION BLOCK ---- */
.comp-explanation {
  border-top: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.95);
  padding: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  display: none;
}
.comp-explanation h5 {
  color: var(--accent);
  margin-bottom: 0.8rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.comp-explanation ul {
  padding-right: 1.2rem;
  margin-bottom: 0;
}
.comp-explanation li {
  margin-bottom: 0.4rem;
}
.comp-explanation code {
  color: #a5b4fc;
  background: rgba(0,0,0,0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

/* ---- CODE BLOCK ---- */
.comp-code {
  border-top: 1px solid var(--border);
  position: relative;
  background: #0d1117; /* Very dark for code */
}
.comp-code pre {
  margin: 0; padding: 1.5rem;
  overflow-x: auto; font-size: 0.9rem;
  line-height: 1.6; max-height: 400px;
  direction: ltr; /* Code is LTR */
}
.comp-code code { font-family: 'Consolas', 'Monaco', monospace; }

/* Syntax highlighting simple colors */
.tk-tag    { color: #7ee787; }
.tk-attr   { color: #79c0ff; }
.tk-val    { color: #a5d6ff; }
.tk-txt    { color: #c9d1d9; }
.tk-cmt    { color: #8b949e; font-style: italic; }

/* ---- TOOLBAR BUTTONS ---- */
.comp-toolbar {
  display: flex; gap: 0.5rem;
}
.tbtn {
  padding: 0.3rem 0.8rem;
  border-radius: 6px; border: 1px solid var(--border2);
  background: transparent; color: var(--text);
  font-family: 'Cairo', sans-serif; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 0.4rem;
}
.tbtn:hover { background: var(--surface2); }
.tbtn.copied { color: #fff; background: var(--green); border-color: var(--green); }
.tbtn.primary-action { color: #fff; background: var(--accent); border-color: var(--accent); }
.tbtn.primary-action:hover { background: #2563eb; }
.tbtn.explain-active { color: #fff; background: var(--accent2); border-color: var(--accent2); }
.tbtn.explain-active:hover { background: #7c3aed; }

/* ---- NOTE BOX ---- */
.note-box {
  margin-top: 1rem; padding: 1rem 1.2rem;
  border-radius: 8px; font-size: 0.95rem; line-height: 1.6;
  display: flex; gap: 0.8rem; align-items: flex-start;
}
.note-box i { font-size: 1.2rem; margin-top: 0.1rem; }
.note-box.info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.2); color: #93c5fd; }
.note-box.tip  { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.note-box.warn { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); color: #fcd34d; }

/* ---- CLASS TABLE ---- */
.class-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.95rem; }
.class-table th, .class-table td {
  padding: 0.8rem 1rem; text-align: right;
  border: 1px solid var(--border);
}
.class-table th { background: var(--bg); color: var(--text); font-weight: 700; }
.class-table tr:nth-child(even) td { background: rgba(30, 41, 59, 0.4); }
.class-table code { background: var(--bg); padding: 0.2rem 0.5rem; border-radius: 4px; color: #a5b4fc; font-size: 0.85rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-right: 0; padding: 1.5rem 1rem; }
}
