/* ==========================================================================
   1. المتغيرات ونظام التصميم (CSS Variables & Design Tokens)
   ========================================================================== */
:root {
  --primary: #D82148;             /* قرمزي ياقوتي فخم مستلهم من DNRater */
  --primary-hover: #B81639;       /* درجة أعمق عند التمرير */
  --primary-glow: rgba(216, 33, 72, 0.15);
  --primary-soft: #FDF0F3;        /* وردي عاجي ناعم جداً للخلفيات والشارات */
  
  --success: #10b981;             /* أخضر للتحقق والتأكيد */
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  
  --bg-page: #f8fafc;             /* خلفية فاتحة مريحة للعين */
  --bg-card: #ffffff;             /* بطاقات بيضاء ناصعة */
  --bg-card-subtle: #f8fafc;      /* بطاقات رمادية فاتحة وهادئة ومتناسقة */
  --bg-input: #f1f5f9;
  
  --text-main: #1E293B;           /* فحمي دافئ وراقي */
  --text-muted: #64748b;          /* نصوص ثانوية ورمادية */
  --text-light: #94a3b8;
  
  --border: #e2e8f0;
  --border-focus: #D82148;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ==========================================================================
   2. إعادة التعيين والأنماط الأساسية (Reset & Base)
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: #ffffff; /* خلفية بيضاء ناصعة لوسط الصفحة بين الهيدر والفوتر */
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   3. الترويسة وشريط التنقل (Header & Navbar)
   ========================================================================== */
.site-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: all 0.2s ease;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  color: var(--primary);
  transition: opacity 0.15s ease;
}

.brand-logo:hover {
  opacity: 0.88;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--primary);
}

/* ==========================================================================
   4. قسم الأداة والبطاقة التفاعلية (Hero & Tool Area - Full-Width Pink)
   ========================================================================== */
.hero-section {
  background-color: var(--primary-soft); /* خلفية وردية ممتدة بعرض الشاشة بالكامل */
  border-bottom: 1px solid rgba(216, 33, 72, 0.1);
  padding: 3.5rem 0 4rem;
  text-align: center;
  margin-bottom: 3rem;
  width: 100%;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  color: var(--primary);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(216, 33, 72, 0.18);
  box-shadow: 0 1px 3px rgba(216, 33, 72, 0.05);
}

.hero-title {
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-bottom: 0.85rem;
  color: var(--text-main);
}

.hero-lead {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 2.5rem;
}

.tool-card {
  background: transparent;
  border: none;
  box-shadow: none;
  max-width: 780px;
  margin: 0 auto;
  padding: 0;
}

.input-box-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  padding: 0.4rem 0.5rem 0.4rem 1.25rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.input-box-wrapper:focus-within {
  border-color: #cbd5e1;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.url-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  padding: 0.5rem 0;
  min-width: 0;
}

.url-input::placeholder {
  color: var(--text-light);
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}

.btn-grab {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-grab:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(216, 33, 72, 0.3);
}

.btn-grab:active {
  transform: translateY(0);
}

/* ==========================================================================
   5. منطقة النتائج وكروت التحميل (Results & Thumbnail Cards)
   ========================================================================== */
.results-area {
  display: none;
  max-width: 960px;
  margin: 0 auto 4rem;
  animation: fadeIn 0.3s ease;
}

.results-area.active {
  display: block;
}

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

.featured-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 2.75rem;
}

.preview-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  overflow: hidden;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 0.95rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #ffffff;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.hd-tag {
  display: inline-block;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.725rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-specs {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-copy, .btn-copy-url, .btn-copy-img {
  background: #ffffff;
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.825rem;
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-copy:hover, .btn-copy-url:hover, .btn-copy-img:hover {
  background: var(--bg-input);
  border-color: #cbd5e1;
}

.btn-download {
  background: var(--primary);
  color: #ffffff;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.825rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-download:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(216, 33, 72, 0.25);
}

.sub-resolutions-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sub-resolutions-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.sub-resolutions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.sub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.sub-preview-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  overflow: hidden;
}

.sub-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 768px) {
  .sub-resolutions-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  
  .card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
  
  .card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .card-actions button {
    flex: 1;
    justify-content: center;
  }
}

/* ==========================================================================
   6. المحتوى التعليمي والـ SEO
   ========================================================================== */
.content-section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.content-article {
  max-width: 820px;
  margin: 0 auto;
}

.content-article h2,
.content-article h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.45;
  margin: 2rem 0 0.85rem;
  color: var(--text-main);
}

.content-article p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

.content-article ul, .content-article ol {
  margin: 0 0 1.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.content-article code {
  background: var(--bg-input);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.content-article a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.content-article a:hover {
  opacity: 0.8;
}

/* ==========================================================================
   7. الأسئلة الشائعة (FAQ)
   ========================================================================== */
.faq-section {
  max-width: 820px;
  margin: 2rem auto 4rem;
}

.faq-title {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-main);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.faq-item[open] {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.faq-question {
  padding: 1.1rem 1.25rem;
  font-weight: 600;
  font-size: 0.975rem;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-question::after {
  content: "−";
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

/* ==========================================================================
   8. الروابط الداخلية (Silo)
   ========================================================================== */
.related-section {
  max-width: 820px;
  margin: 0 auto 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.related-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.related-card {
  background: #f8fafc; /* خلفية رمادية فاتحة وأنيقة فوق البياض */
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.related-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   9. الفوتر (Footer)
   ========================================================================== */
/* ==========================================================================
   9. الفوتر (Footer) - خلفية وردية ناعمة مطابقة لأعلى الصفحة
   ========================================================================== */
.site-footer {
  background-color: var(--primary-soft); /* نفس لون خلفية الـ Hero في أعلى الصفحة exactly */
  color: var(--text-muted);
  padding: 4rem 0 2.5rem;
  font-size: 0.875rem;
  border-top: 1px solid rgba(216, 33, 72, 0.1);
}

.footer-content {
  max-width: 820px;
  margin: 0 auto;
}

.footer-disclaimer {
  background: #ffffff; /* بطاقة بيضاء ناصعة تحوي إخلاء المسؤولية لتبدو أنيقة فوق الوردي */
  border: 1px solid rgba(216, 33, 72, 0.12);
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 2.5rem;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
  box-shadow: 0 2px 8px rgba(216, 33, 72, 0.04);
}

.footer-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2.5rem;
  text-align: left;
}

.footer-col-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main); /* لون داكن وبارز للعناوين */
  margin-bottom: 0.85rem;
  letter-spacing: 0.02em;
}

.footer-col-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-col-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.footer-col-links a:hover {
  color: var(--primary); /* تتحول للون القرمزي عند المرور عليها */
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(216, 33, 72, 0.1);
  font-size: 0.825rem;
  color: var(--text-light);
  text-align: center;
}

@media (max-width: 640px) {
  .footer-nav-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.75rem;
  }
}

/* ==========================================================================
   10. التنبيهات المنبثقة
   ========================================================================== */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   11. التجاوب مع الهواتف
   ========================================================================== */
@media (max-width: 640px) {
  .input-box-wrapper {
    flex-wrap: wrap;
    padding: 0.65rem;
  }
  
  .btn-grab {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
  }
  
  .card-body {
    flex-direction: column;
    align-items: stretch;
  }
  
  .card-actions {
    flex-direction: column;
  }
  
  .btn-download, .btn-copy {
    width: 100%;
    justify-content: center;
  }
  
  .hero-section {
    padding: 2.25rem 0 1.5rem;
  }
}