
:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #111827 100%);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #ec4899;
  --cyan: #06b6d4;
  --danger: #ef4444;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --glass-card: rgba(15, 23, 42, 0.8);
  --glass-border: rgba(255, 255, 255, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Tajawal', sans-serif;
}

body {
  background: var(--bg-gradient);
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* النافبار */
.navbar {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 900;
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.nav-btn:hover,
.nav-btn.active {
  color: #fff;
  background: var(--primary);
}

.disclaimer-banner {
  background: rgba(234, 179, 8, 0.15);
  border-bottom: 1px solid rgba(234, 179, 8, 0.3);
  color: #fef08a;
  font-size: 0.85rem;
  text-align: center;
  padding: 8px 15px;
}

.main-container {
  max-width: 950px;
  margin: 30px auto;
  padding: 0 20px;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.35s ease-in-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-card,
.info-card,
.quiz-card,
.result-card,
.history-card {
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 35px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.3);
  backdrop-filter: blur(12px);
  margin-bottom: 25px;
}

/* تثبيت حجم كارت الأسئلة لمنع الحركة عند تغيير السؤال */
.fixed-quiz-card {
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.question-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.badge {
  background: rgba(236,72,153,0.2);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.hero-card h1 {
  font-size: 2rem;
  margin: 15px 0;
  color: #fff;
}

.hero-card p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 25px;
}

.hero-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.features-grid,
.quiz-cards-grid,
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.feature-box,
.catalog-card,
.article-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 22px;
  border-radius: 14px;
  transition: transform 0.25s ease;
}

.catalog-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.catalog-card h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  color: var(--cyan);
}

.catalog-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* الأزرار */
.btn {
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-glow {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--cyan);
}

.progress-bar-container {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 25px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--accent));
  transition: width 0.3s ease;
}

.question-body h2 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 25px;
}

.option-btn {
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--glass-border);
  border-radius: 10px;
  padding: 14px 18px;
  color: #fff;
  text-align: right;
  cursor: pointer;
  transition: 0.2s;
}

.option-btn:hover {
  border-color: var(--cyan);
  background: rgba(6,182,212,0.1);
}

.option-btn.selected {
  border-color: var(--accent);
  background: rgba(236,72,153,0.18);
  font-weight: 700;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
}

/* النتائج */
.result-badge {
  color: var(--cyan);
  font-weight: 700;
}

.result-title {
  font-size: 1.8rem;
  color: var(--accent);
  margin: 10px 0;
}

.result-desc {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 25px;
}

.traits-breakdown {
  background: rgba(0,0,0,0.25);
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 25px;
}

.bar-outer {
  height: 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  overflow: hidden;
  margin: 5px 0 12px;
}

.bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  font-size: 0.75rem;
  text-align: center;
  line-height: 16px;
  font-weight: 700;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 25px;
}

.detail-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  padding: 18px;
  border-radius: 12px;
}

.detail-box h3 {
  color: var(--cyan);
  margin-bottom: 10px;
  font-size: 1rem;
}

.detail-box ul {
  padding-right: 18px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* قسم السجل المحفوظ */
.history-header {
  margin-bottom: 25px;
}

.history-header h2 {
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 8px;
}

.history-header p {
  color: var(--text-muted);
}

.saved-item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}

.saved-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.saved-item-title {
  font-size: 1.2rem;
  color: var(--cyan);
  font-weight: 700;
}

.saved-item-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}


.footer {
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
}

/* ========================================= */
/* تنسيقات التجاوب مع الشاشات الصغيرة والهواتف */
/* ========================================= */

@media (max-width: 768px) {
  /* 1. ضبط شريط التنقل (النافبار) ليسمح بالتمرير الأنيق بدون تشويه */
  .nav-container {
    flex-direction: column;
    gap: 12px;
    padding: 10px 15px;
  }
  
  .nav-links {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    overflow-x: auto; /* شريط تمرير أفقي مرن لأزرار النافبار */
    padding-bottom: 6px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-btn {
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  /* 2. تصغير الهوامش والمسافات الداخلية للبطاقات */
  .main-container {
    padding: 0 12px;
    margin: 15px auto;
  }
  
  .hero-card,
  .info-card,
  .quiz-card,
  .result-card,
  .saved-item-card {
    padding: 20px 15px;
    border-radius: 12px;
  }

  /* 3. جعل ارتفاع كارت الأسئلة مرناً لمنع خروج النصوص */
  .fixed-quiz-card {
    min-height: auto;
  }

  /* 4. ضبط أبعاد الخطوط لتبدو مناسبة للهواتف */
  .hero-card h1 {
    font-size: 1.4rem;
    line-height: 1.4;
  }
  
  .hero-card p,
  .result-desc {
    font-size: 0.92rem;
  }
  
  .question-body h2 {
    font-size: 1.05rem;
    line-height: 1.5;
  }
  
  .result-title {
    font-size: 1.35rem;
  }

  /* 5. تحويل الشبكات لتظهر في عمود واحد متناسق */
  .features-grid,
  .quiz-cards-grid,
  .articles-grid,
  .details-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* 6. جعل أزرار الخيارات والتنقل بعرض الشاشة وسهلة الضغط */
  .option-btn {
    padding: 12px 14px;
    font-size: 0.88rem;
  }
  
  .hero-actions,
  .action-buttons,
  .quiz-footer {
    flex-direction: column;
    gap: 10px;
  }
  
  .btn {
    width: 100%;
    text-align: center;
    padding: 12px;
  }
}