/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2196F3;
  --primary-dark: #1565C0;
  --primary-light: #BBDEFB;
  --accent: #FF9800;
  --accent-light: #FFE0B2;
  --success: #4CAF50;
  --danger: #F44336;
  --bg: #F5F7FA;
  --bg-card: #FFFFFF;
  --text: #212121;
  --text-secondary: #616161;
  --text-light: #9E9E9E;
  --border: #E0E0E0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-ar: 'Noto Sans Arabic', 'Segoe UI', system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

body[dir="rtl"] {
  font-family: var(--font-ar);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== LANGUAGE SWITCHER (top bar) ===== */
.lang-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 10px 0;
  box-shadow: 0 2px 16px rgba(33,150,243,0.3);
}

.lang-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lang-bar-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-bar-title img {
  height: 28px;
}

.lang-buttons {
  display: flex;
  gap: 8px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 24px;
  background: transparent;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}

.lang-btn.active {
  background: #fff;
  color: var(--primary-dark);
  border-color: #fff;
  font-weight: 700;
}

.lang-btn .flag {
  font-size: 1.1rem;
}

/* ===== HERO ===== */
.hero {
  margin-top: 56px;
  background: linear-gradient(135deg, #1565C0 0%, #2196F3 40%, #42A5F5 100%);
  color: #fff;
  padding: 80px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(255,255,255,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(255,255,255,0.05) 0%, transparent 50%);
  animation: heroFloat 20s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -20px); }
}

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

.hero-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero .subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  margin-bottom: 24px;
  font-weight: 400;
}

.hero .version-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 6px 20px;
  border-radius: 24px;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

/* ===== TABLE OF CONTENTS ===== */
.toc {
  max-width: 1200px;
  margin: -30px auto 40px;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}

.toc-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.toc-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  border: 1px solid transparent;
}

.toc-item:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.toc-item .toc-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ===== SECTION ===== */
.guide-section {
  margin-bottom: 48px;
  scroll-margin-top: 80px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--primary);
}

.section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.section-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.section-intro {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.8;
}

/* ===== STEP CARDS ===== */
.step-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--border);
}

.step-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #f8faff, #eef4ff);
  border-bottom: 1px solid var(--border);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.step-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.step-body {
  padding: 24px;
}

.step-body p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.8;
}

.step-body ul, .step-body ol {
  margin: 12px 0 16px 24px;
  color: var(--text-secondary);
}

.step-body li {
  margin-bottom: 8px;
  line-height: 1.7;
}

body[dir="rtl"] .step-body ul,
body[dir="rtl"] .step-body ol {
  margin: 12px 24px 16px 0;
}

/* ===== SCREENSHOT CONTAINER ===== */
.screenshot-container {
  margin: 20px 0;
  text-align: center;
}

.screenshot-wrapper {
  display: inline-block;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 3px solid var(--border);
  max-width: 100%;
  cursor: pointer;
  transition: var(--transition);
}

.screenshot-wrapper:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transform: scale(1.01);
}

.screenshot-wrapper img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 450px;
  object-fit: contain;
}

.screenshot-caption {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
  animation: fadeIn 0.3s ease;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

body[dir="rtl"] .lightbox-close {
  right: auto;
  left: 20px;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.4);
}

/* ===== TIP / WARNING / INFO BOXES ===== */
.info-box {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 0.95rem;
  line-height: 1.7;
  align-items: flex-start;
}

.info-box .info-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box.tip {
  background: #E8F5E9;
  border-left: 4px solid var(--success);
  color: #2E7D32;
}

body[dir="rtl"] .info-box.tip {
  border-left: none;
  border-right: 4px solid var(--success);
}

.info-box.warning {
  background: #FFF3E0;
  border-left: 4px solid var(--accent);
  color: #E65100;
}

body[dir="rtl"] .info-box.warning {
  border-left: none;
  border-right: 4px solid var(--accent);
}

.info-box.info {
  background: #E3F2FD;
  border-left: 4px solid var(--primary);
  color: #1565C0;
}

body[dir="rtl"] .info-box.info {
  border-left: none;
  border-right: 4px solid var(--primary);
}

/* ===== FEATURE GRID ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.feature-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card .feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== FOOTER ===== */
.guide-footer {
  background: linear-gradient(135deg, var(--primary-dark), #0D47A1);
  color: #fff;
  text-align: center;
  padding: 40px 24px;
}

.guide-footer p {
  opacity: 0.9;
  margin-bottom: 8px;
}

.guide-footer .footer-version {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(33,150,243,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 100;
}

body[dir="rtl"] .back-to-top {
  right: auto;
  left: 30px;
}

.back-to-top.visible {
  display: flex;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: slideUp 0.5s ease forwards;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .hero .subtitle { font-size: 1rem; }
  .hero { padding: 60px 16px 40px; }
  
  .toc-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  
  .lang-bar-inner { flex-direction: column; gap: 8px; }
  .lang-bar-title { font-size: 0.85rem; }
  .lang-btn { padding: 4px 12px; font-size: 0.8rem; }
  
  .section-header h2 { font-size: 1.3rem; }
  .step-header h3 { font-size: 1rem; }
  .step-body { padding: 16px; }
  
  .screenshot-wrapper img { max-height: 300px; }
  
  .main-content { padding: 0 16px 60px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .lang-buttons { flex-wrap: wrap; justify-content: center; }
  .toc-card { padding: 20px; }
}

/* ===== PRINT ===== */
@media print {
  .lang-bar, .back-to-top, .lightbox { display: none !important; }
  .hero { background: #2196F3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .step-card { break-inside: avoid; }
  .screenshot-wrapper { box-shadow: none; border: 1px solid #ccc; }
}
