:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #EFF6FF;
  --secondary: #0D9488;
  --secondary-light: #F0FDFA;
  --accent: #F59E0B;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --danger-border: #FCA5A5;
  --dark: #0F172A;
  --text: #1E293B;
  --text-muted: #64748B;
  --bg-main: #F8FAFC;
  --card-bg: #FFFFFF;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  background-color: var(--bg-main);
  color: var(--text);
  line-height: 1.8;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-btn-danger {
  color: var(--danger);
  background: var(--danger-light);
}
.nav-btn-danger:hover, .nav-btn-danger.active {
  color: white;
  background: var(--danger);
}

/* Header Banner */
.hero-banner {
  background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 50%, #0D9488 100%);
  color: white;
  padding: 3.5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -40px;
  right: -40px;
  width: 250px;
  height: 250px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.18);
  padding: 0.4rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(8px);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 650px;
  margin: 0 auto;
}

/* Main Container */
.main-wrapper {
  max-width: 1140px;
  margin: -2rem auto 4rem;
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
}

.grid-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
}

@media (max-width: 860px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar / Quick Nav */
.sidebar-sticky {
  position: sticky;
  top: 5.5rem;
  height: fit-content;
}

.toc-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.toc-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-item a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.toc-item a:hover {
  color: var(--primary);
  background: var(--primary-light);
  transform: translateX(-4px);
}

/* Content Area */
.content-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.section-block {
  margin-bottom: 2.5rem;
  scroll-margin-top: 6rem;
}

.section-block:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--dark);
}

.section-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.text-paragraph {
  color: var(--text);
  font-size: 0.98rem;
  margin-bottom: 1rem;
  line-height: 1.85;
}

/* Feature Boxes */
.box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.info-box {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: transform 0.2s;
}

.info-box:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.info-box h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.info-box p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Alert Boxes */
.alert-box {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.alert-danger {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: #991B1B;
}

.alert-info {
  background: var(--primary-light);
  border: 1px solid #BFDBFE;
  color: #1E40AF;
}

.alert-success {
  background: var(--secondary-light);
  border: 1px solid #A7F3D0;
  color: #065F46;
}

/* Interactive Form */
.form-card {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 2rem;
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-main);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: white;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #DC2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Footer */
.footer {
  background: var(--dark);
  color: #94A3B8;
  padding: 3rem 1.5rem;
  text-align: center;
  margin-top: 5rem;
  border-top: 1px solid #334155;
}

.footer-container {
  max-width: 1140px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.footer-link {
  color: #E2E8F0;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #60A5FA;
}

.footer-copy {
  font-size: 0.85rem;
  opacity: 0.8;
}
