/* docs.css - Elegant & Professional Documentation Styling */
:root {
  /* Elegant Color Palette */
  --primary-color: #0F172A; /* Deep sophisticated slate */
  --primary-accent: #2563EB; /* Vibrant blue for links/accents */
  --primary-light: #EFF6FF;
  
  --text-main: #111827; /* Near black for headings */
  --text-body: #4B5563; /* Softer gray for comfortable reading */
  --text-muted: #9CA3AF;
  
  --bg-main: #F9FAFB; /* Very subtle off-white for the background */
  --bg-surface: #FFFFFF; /* Pure white for content */
  
  --border-color: #E5E7EB;
  
  --sidebar-width: 320px;
  
  /* Refined Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
  --shadow-img: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  
  /* Smooth Border Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.5rem;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 2rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

h4 {
  font-size: 1.25rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

p {
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

a {
  color: var(--primary-accent);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: #1D4ED8;
}

/* Main Layout */
.docs-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 3rem 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background-color: var(--bg-main); /* Blends with body */
  border-right: 1px solid var(--border-color);
}

[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border-color);
}

/* Sidebar Header Controls */
.sidebar-header {
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-header .logo {
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--primary-color);
  letter-spacing: -0.03em;
}

.sidebar-header .logo i {
  color: var(--primary-accent);
  font-size: 1.5rem;
}

.sidebar-header .search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  gap: 0.75rem;
  width: 100%;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.sidebar-header .search-bar:focus-within {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.sidebar-header .search-bar i {
  color: var(--text-muted);
}

.sidebar-header .search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
}

.sidebar-header .lang-switch {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-body);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  transition: color 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-header .lang-switch:hover {
  color: var(--primary-accent);
}

/* Table of Contents */
.table-of-contents h2 {
  font-size: 0.8rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.table-of-contents ol {
  list-style: none;
  padding-left: 0;
  width: 100%;
}

[dir="rtl"] .table-of-contents ol {
  padding-right: 0;
}

.table-of-contents li {
  margin-bottom: 0.1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.table-of-contents .level-2,
.table-of-contents .level-3 {
  padding-left: 1rem;
  display: none;
  margin-top: 0.15rem;
  border-left: 1px solid var(--border-color);
  margin-left: 0.5rem;
}

[dir="rtl"] .table-of-contents .level-2,
[dir="rtl"] .table-of-contents .level-3 {
  padding-left: 0;
  padding-right: 1rem;
  border-left: none;
  border-right: 1px solid var(--border-color);
  margin-left: 0;
  margin-right: 0.5rem;
}

.table-of-contents .show {
  display: block;
  animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.table-of-contents a {
  display: block;
  flex-grow: 1;
  padding: 0.35rem 0.5rem;
  color: var(--text-body);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  transition: all 0.2s ease;
}

.table-of-contents .level-2 a,
.table-of-contents .level-3 a {
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  font-weight: 400;
  color: var(--text-muted);
}

.table-of-contents .level-2 a:hover,
.table-of-contents .level-3 a:hover {
  color: var(--primary-color);
}

.table-of-contents a:hover {
  background-color: var(--bg-surface);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.table-of-contents a.active-title,
.table-of-contents a.active-subtitle {
  background-color: var(--bg-surface);
  color: var(--primary-accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.table-of-contents i {
  margin-right: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  width: 12px;
  text-align: center;
}

[dir="rtl"] .table-of-contents i {
  margin-right: 0;
  margin-left: 0.75rem;
}

/* Main Content */
.main-content {
  flex-grow: 1;
  padding: 3rem 4rem;
  background-color: var(--bg-surface);
}

@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin: 0;
    border-radius: 0;
    padding: 2.5rem;
    max-width: 100%;
    box-shadow: none;
  }
}

/* Modules / Sections */
.module {
  margin-bottom: 5rem;
  padding-top: 1rem;
}

.module:not(:first-child) {
  border-top: 1px solid var(--border-color);
  padding-top: 3rem;
}

.module h3 {
  font-size: 2.25rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.module h3 i {
  color: var(--primary-accent);
  background: var(--primary-light);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 1.5rem;
}

.module h4 {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-top: 3.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--bg-main);
}

/* Image Presentation */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-img) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  margin: 2rem auto;
  display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 500px;
  object-fit: contain;
  background-color: var(--bg-main);
}

img:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

/* Lists inside modules */
.module ul {
  list-style: none;
  padding: 0;
  margin-bottom: 2rem;
}

.module ul li {
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text-main);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  position: relative;
  padding-left: 2rem;
}

[dir="rtl"] .module ul li {
  padding-left: 0;
  padding-right: 2rem;
}

.module ul li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--primary-accent);
  font-size: 1rem;
  top: 2px;
}

[dir="rtl"] .module ul li::before {
  left: auto;
  right: 0;
}

/* Icons Grid */
.icon-container {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
  gap: 1.5rem !important;
  margin: 3rem 0;
}

.icon-box {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  background: var(--bg-surface);
  padding: 2rem 1rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-box:hover {
  border-color: var(--primary-accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.icon-box img {
  width: 56px !important;
  height: 56px !important;
  box-shadow: none !important;
  border: none !important;
  margin: 0 0 1.25rem 0 !important;
  background-color: transparent;
}

.icon-box span {
  font-size: 0.9rem !important;
  font-weight: 600;
  color: var(--text-main);
}

/* Image Grid Overrides */
.imgDiv, .imgDiv2 {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)) !important;
  gap: 2rem !important;
  margin: 3rem 0 !important;
  align-items: center !important;
}

.imgDiv img, .imgDiv2 img {
  width: 100% !important;
  margin: 0 !important;
}

/* Scrollbar Refinement */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* Back to Top Button */
#backToTopBtn {
  display: none;
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  z-index: 99;
  font-size: 1.1rem;
  border: none;
  outline: none;
  background-color: var(--text-main);
  color: white;
  cursor: pointer;
  padding: 1rem;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
}

[dir="rtl"] #backToTopBtn {
  right: auto;
  left: 2.5rem;
}

#backToTopBtn.visible {
  opacity: 1;
  visibility: visible;
  display: flex;
}

#backToTopBtn:hover {
  background-color: var(--primary-accent);
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.3);
}
