:root {
  --primary:#6e48aa;
  --secondary:#9d32fa;
  --accent:#ff00ff;
  --light:#f5f5f5;
  --dark:#2c3e50;
  --white:#ffffff;
  --gray:#888;
}

/* الأساسيات */
* {
  margin:0;
  padding:0;
  box-sizing:border-box;
  font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
  background-color: var(--light);
  color: var(--dark);
}

/* الهيدر */
header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 1rem 2rem;
  display:flex;
  justify-content:space-between;
  align-items:center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: relative;
}
.logo {
  display:flex;
  align-items:center;
  gap:.5rem;
  font-weight:bold;
  color:white;
  font-size:1.2rem;
}
nav ul {
  display:flex;
  list-style:none;
  gap:2rem;
}
nav a {
  color:white;
  text-decoration:none;
  font-size:.9rem;
}
.download-btn {
  background:white;
  color:var(--primary);
  border:2px solid var(--primary);
  padding:.5rem 1rem;
  border-radius:20px;
  font-weight:bold;
  cursor:pointer;
  transition:.3s;
}
.download-btn:hover {
  background:var(--primary);
  color:white;
}

/* قسم البطل */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 3rem 2rem;
  text-align:center;
  color:white;
}
.hero h1 {
  font-size:2.3rem;
  margin-bottom:1rem;
}

/* حقل الإدخال */
.input-group {
  max-width: 820px;
  margin: 0 auto;
  display:flex;
  gap:.5rem;
  background: rgba(255,255,255,0.18);
  padding:.5rem;
  border-radius:12px;
  backdrop-filter: blur(10px);
  align-items: center;
}
.input-wrapper {
  position:relative;
  flex:1;
}
.input-wrapper input {
  width:100%;
  padding:.85rem 3rem .85rem 1rem;
  border:none;
  border-radius:8px;
  font-size:1rem;
  background:rgba(255,255,255,0.95);
  color:var(--dark);
  outline:none;
}
.paste-btn {
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  background:var(--accent);
  color:white;
  border:none;
  border-radius:6px;
  padding:0.45rem 0.7rem;
  font-weight:bold;
  cursor:pointer;
  font-size:1rem;
  transition:background 0.3s;
}
.paste-btn:hover { background:#e600e6; }
.download-main {
  background:var(--accent);
  color:white;
  border:none;
  border-radius:8px;
  padding:.85rem 1.5rem;
  font-size:1rem;
  font-weight:bold;
  cursor:pointer;
  transition:background 0.3s;
}
.download-main:hover { background:#e600e6; }

/* الأقسام */
.features {
  padding: 2.5rem 2rem;
  display:flex;
  justify-content:center;
  gap:1.5rem;
  flex-wrap:wrap;
}
.feature {
  background:white;
  padding:1.3rem;
  border-radius:10px;
  box-shadow:0 4px 12px rgba(0,0,0,0.05);
  max-width:300px;
  text-align:center;
}

/* قسم How To */
#howto {
  max-width:950px;
  margin:0 auto;
  padding-bottom:50px;
}
.how-to {
  padding: 2.8rem 2rem;
  background:white;
}
.how-to h2 {
  text-align:center;
  margin-bottom:1.5rem;
  color:var(--dark);
}
.how-intro {
  max-width:900px;
  margin:0 auto 1.2rem;
  text-align:center;
}
.steps {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding:2rem;
  border-radius:20px;
  color:white;
}
.step {
  display:flex;
  align-items:flex-start;
  gap:1rem;
  margin-bottom:1.3rem;
}
.step-number {
  font-size:2.4rem;
  font-weight:bold;
  color:rgba(255,255,255,0.6);
  min-width:44px;
}

/* FAQ */
#faq {
  max-width:950px;
  margin:0 auto;
  padding-bottom:50px;
}
.faq {
  padding:2.8rem 2rem;
}
.faq h2 {
  text-align:center;
  margin-bottom:1.5rem;
  color:var(--dark);
}
.faq-item {
  background:white;
  margin:.5rem 0;
  padding:1rem;
  border-radius:10px;
  box-shadow:0 2px 8px rgba(0,0,0,0.05);
  cursor:pointer;
  transition:.25s;
}
.faq-item:hover { background:#f7f7f7; }
.faq-question {
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-weight:bold;
}
.faq-answer {
  margin-top:.5rem;
  display:none;
  text-align:left;
}

/* النتيجة */
.result {
  max-width:650px;
  margin:1.5rem auto;
  background:white;
  border-radius:14px;
  box-shadow:0 4px 18px rgba(0,0,0,.06);
  padding:1.2rem;
  display:flex;
  flex-direction:column;
  align-items:center;
}
.result-head {
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:1.2rem;
  width:100%;
  margin-bottom:1rem;
}
.thumb {
  width:180px;
  height:220px;
  background:#eee;
  border-radius:10px;
  overflow:hidden;
  flex-shrink:0;
}
.thumb img {
  width:100%;
  height:100%;
  object-fit:cover;
}
.result-info {
  flex:1;
  min-width:240px;
  text-align:left;
}
.result-title {
  font-weight:700;
  margin-bottom:.2rem;
  font-size:1.1rem;
}
.result-author {
  color:#666;
  margin-bottom:.8rem;
  font-size:0.95rem;
}

/* الأزرار */
.btns {
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:.6rem;
  width:100%;
  margin-top:0.8rem;
}
.btn {
  display:inline-block;
  padding:.7rem 1rem;
  border-radius:10px;
  font-weight:600;
  text-decoration:none;
  background:var(--primary);
  color:#fff;
  transition:0.2s;
  min-width:140px;
  text-align:center;
}
.btn:hover { opacity:0.9; }
.btn.alt { background:#111827; }
.btn.gray { background:#6b7280; }
.btn.hd { background:#0e7490; }

/* الأخطاء */
.error {
  max-width:820px;
  margin:1rem auto;
  background:#fee2e2;
  color:#7f1d1d;
  padding:.9rem 1rem;
  border-radius:10px;
  border:1px solid #fecaca;
}

/* الفوتر */
footer {
  background: var(--dark);
  color:white;
  padding:2rem;
  text-align:center;
}
footer ul {
  list-style:none;
  display:flex;
  justify-content:center;
  gap:2rem;
  margin-bottom:1rem;
  flex-wrap:wrap;
}
footer a {
  color:white;
  text-decoration:none;
}
.disclaimer {
  font-size:.9rem;
  margin:1rem 0;
  opacity:.8;
}
.language-selector select {
  background:#fff;
  border:1px solid #ccc;
  color:#333;
  font-size:1rem;
  padding:0.45rem 0.8rem;
  border-radius:8px;
  cursor:pointer;
  transition:all 0.3s;
}
.language-selector select:hover,
.language-selector select:focus {
  border-color:var(--primary);
  color:var(--primary);
  outline:none;
}
.copyright {
  font-size:.8rem;
  opacity:.75;
  margin-top:1rem;
}

/* الزر المتجاوب */
.menu-toggle {
  display:none;
  font-size:1.8rem;
  color:white;
  cursor:pointer;
}

/* الهواتف */
@media (max-width:900px) {
  header {
    flex-direction:row;
    align-items:center;
    justify-content:space-between;
  }
  .menu-toggle { display:block; }
  nav {
    width:100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display:none;
    position:absolute;
    top:60px;
    left:0;
    z-index:1000;
    box-shadow:0 2px 10px rgba(0,0,0,0.2);
  }
  nav.open { display:block; }
  nav ul {
    flex-direction:column;
    width:100%;
    gap:0;
  }
  nav ul li { border-bottom:1px solid rgba(255,255,255,0.2); }
  nav a {
    display:block;
    padding:0.9rem 1rem;
    width:100%;
    color:white;
  }
  .download-btn {
    border:none;
    background:rgba(255,255,255,0.1);
    color:#fff;
    width:100%;
    border-radius:0;
  }
  .download-btn:hover { background:rgba(255,255,255,0.3); }
}

/* تحسين الهاتف */
@media (max-width:700px) {
  .hero h1 { font-size:1.8rem; }
  .input-group {
    flex-direction:column;
    align-items:stretch;
    gap:0.7rem;
  }
  .download-main { width:100%; }
  .download-btn {
    display:block;
    width:100%;
    text-align:center;
    margin-top:0.5rem;
  }
  .result-head {
    flex-direction:column;
    align-items:center;
    text-align:center;
  }
  .result-info { text-align:center; }
  .thumb { width:100%; max-width:280px; }
}


/* ===== AJAX helpers ===== */
.result-mount { max-width: 980px; margin: 1.5rem auto; }
.fade-in { animation: fadeIn .35s ease-out both; }
@keyframes fadeIn { from {opacity:0; transform: translateY(6px);} to {opacity:1; transform: none;} }

.loader {
  display:flex;
  align-items:center;
  gap:.7rem;
  justify-content:center;
  background:#fff;
  border-radius:12px;
  padding:1rem;
  box-shadow:0 4px 18px rgba(0,0,0,.06);
  max-width: 360px;
  margin: 1rem auto;
}
.spinner {
  width:18px;height:18px;border-radius:50%;
  border:3px solid #e5e7eb;border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg);} }
.loader-text { color:#374151; font-weight:600; }

