/* المتغيرات الأساسية */
:root {
  --primary-gold: #c2a35d;
  --dark-bg: #0b0e14;
  --card-bg: #151921;
  --text-color: #d1d4dc;
  --border-color: #2a2e39;
  --transition: 0.3s ease;
}

/* تنسيقات عامة */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  background-color: var(--dark-bg);
  color: var(--text-color);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

/* الهيدر والقائمة */
.site-header {
  border-bottom: 1px solid var(--border-color);
  background: #131722;
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
}
.logo-image {
  width: 55px;
  height: 55px;
  border-radius: 8px;
  object-fit: cover;
}
.logo-text {
  font-weight: bold;
  color: #fff;
  font-size: 1.5rem;
  letter-spacing: 1px;
}
.logo-plus {
  color: var(--primary-gold);
  font-size: 1.2rem;
}

.main-nav {
  display: flex;
  gap: 20px;
}
.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--primary-gold);
}

.login-section {
  display: flex;
  align-items: center;
  gap: 15px;
}
.login-btn,
.user-menu {
  background: var(--primary-gold);
  color: #000;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.login-btn:hover,
.user-menu:hover {
  background: #a09056;
  transform: translateY(-2px);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22d3ee, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

/* زر الموبايل (Hamburger) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}
.nav-toggle span {
  display: block;
  width: 25px;
  height: 2px;
  background: #fff;
  margin: 6px 0;
  transition: var(--transition);
}

/* قسم Hero */
.hero {
  background: radial-gradient(circle at center, #1e222d 0%, #0b0e14 100%);
  padding: 80px 0;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}
.hero-text h1 {
  font-size: 2.8rem;
  color: #fff;
  margin-bottom: 20px;
  line-height: 1.2;
}
.hero-text h1 span {
  color: var(--primary-gold);
}
.hero-text p {
  font-size: 1.1rem;
  margin-bottom: 30px;
  color: #9db2bd;
}

.hero-actions {
  display: flex;
  gap: 15px;
}
.btn {
  padding: 12px 25px;
  border-radius: 6px;
  font-weight: bold;
  display: inline-block;
}
.btn.primary {
  background: var(--primary-gold);
  color: #000;
}
.btn.ghost {
  border: 1px solid var(--border-color);
  color: #fff;
}
.btn:hover {
  transform: translateY(-3px);
  opacity: 0.9;
}

.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* الشبكة والأقسام */
.section {
  padding: 60px 0;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.section-link {
  color: var(--primary-gold);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  gap: 25px;
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 25px;
  border-radius: 10px;
  transition: var(--transition);
}
.card:hover {
  border-color: var(--primary-gold);
  transform: translateY(-5px);
}
.card-tag {
  display: inline-block;
  background: rgba(194, 163, 93, 0.1);
  color: var(--primary-gold);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 15px;
}
.card h3 {
  color: #fff;
  margin-bottom: 12px;
}
.card p {
  font-size: 0.9rem;
  color: #9db2bd;
  margin-bottom: 20px;
}
.card-link {
  color: var(--primary-gold);
  font-weight: bold;
  font-size: 0.85rem;
}

/* قسم دليل المتداول - المقالات التعليمية المتعمقة */
.articles-section {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
}
.articles-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 30px;
}
.articles-emoji {
  font-size: 1.3rem;
}
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 25px;
}

/* بطاقة المقال - مع إصلاح مشكلة الصور المكسورة */
.article-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.article-card:hover {
  border-color: var(--primary-gold);
  transform: translateY(-6px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}
.article-card-image {
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: #1a1f2b;
  flex-shrink: 0; /* يمنع انكماش/تمدد الصورة مهما حصل خطأ تحميل */
  display: flex;
  align-items: center;
  justify-content: center;
}
.article-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.article-card:hover .article-card-image img {
  transform: scale(1.06);
}
/* حالة فشل تحميل الصورة نهائياً (fallback SVG) */
.article-card-image img.img-broken {
  object-fit: contain;
  padding: 30px;
  opacity: 0.3;
  transform: none !important;
}
.article-card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.article-card-body h3 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 12px;
  line-height: 1.4;
}
.article-card-body p {
  font-size: 0.9rem;
  color: #9db2bd;
  margin-bottom: 20px;
  flex: 1;
}
.read-full-article {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-gold);
  font-weight: bold;
  font-size: 0.9rem;
  align-self: flex-start;
  transition: var(--transition);
}
.read-full-article i {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}
.read-full-article:hover {
  color: #fff;
  gap: 12px;
}
.read-full-article:hover i {
  transform: translateX(-4px);
}

@media (max-width: 768px) {
  .articles-grid {
    grid-template-columns: 1fr;
  }
  .articles-section-title {
    font-size: 1.25rem;
  }
}

/* فوتر */
.site-footer {
  background: #0b0e14;
  border-top: 1px solid var(--border-color);
  padding: 60px 0 20px;
}
.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-col h4 {
  color: #fff;
  margin-bottom: 20px;
}
.footer-col ul {
  list-style: none;
}
.footer-col ul li {
  margin-bottom: 10px;
  font-size: 0.9rem;
}
.footer-bottom {
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}
.risk-warning {
  font-size: 0.75rem;
  color: #666;
  margin-top: 10px;
}

.social-icons {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 15px;
}
.social-icon {
  width: 24px;
  height: 24px;
  fill: #cbd5f5;
  transition: var(--transition);
  cursor: pointer;
}
.social-icon:hover {
  fill: var(--primary-gold);
  transform: translateY(-2px);
}

/* بانر الأكاديمية */
.academy-banner {
  background: linear-gradient(135deg, #1e222d 0%, #0b0e14 100%);
  border: 2px solid var(--primary-gold);
  border-radius: 15px;
  padding: 40px;
  margin: 40px 0;
  position: relative;
  overflow: hidden;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 30px;
  position: relative;
  z-index: 2;
}

.banner-logo {
  width: 120px;
  height: 120px;
  border-radius: 15px;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(194, 163, 93, 0.3);
  animation: logoFloat 3s ease-in-out infinite;
}

.banner-text {
  flex: 1;
}

.banner-title {
  font-size: 2.5rem;
  color: #fff;
  margin-bottom: 15px;
  font-weight: bold;
  position: relative;
  display: inline-block;
}

.banner-subtitle {
  font-size: 1.2rem;
  color: #9db2bd;
  margin-bottom: 10px;
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.5s forwards;
}

.banner-description {
  font-size: 1rem;
  color: #cbd5f5;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeInUp 1s ease-out 1s forwards;
}

.banner-cta {
  background: var(--primary-gold);
  color: #000;
  padding: 12px 30px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
  opacity: 0;
  animation: fadeInUp 1s ease-out 1.5s forwards;
  transition: all 0.3s ease;
}

.banner-cta:hover {
  background: #a09056;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(194, 163, 93, 0.4);
}

/* تأثير الفلاش الأبيض المتحرك */
.flash-effect {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 45%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.1) 55%,
    transparent 100%
  );
  animation: flashMove 4s ease-in-out infinite;
  z-index: 1;
}

.flash-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: particleFloat 6s ease-in-out infinite;
}

.particle:nth-child(1) {
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}
.particle:nth-child(2) {
  top: 60%;
  left: 80%;
  animation-delay: 1s;
}
.particle:nth-child(3) {
  top: 30%;
  left: 60%;
  animation-delay: 2s;
}
.particle:nth-child(4) {
  top: 80%;
  left: 20%;
  animation-delay: 3s;
}
.particle:nth-child(5) {
  top: 10%;
  left: 90%;
  animation-delay: 4s;
}

/* الحركات */
@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

@keyframes flashMove {
  0% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes particleFloat {
  0%,
  100% {
    opacity: 0;
    transform: translateY(0px) scale(0);
  }
  20% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
  80% {
    opacity: 1;
    transform: translateY(-40px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(0);
  }
}

/* تأثير التوهج على العنوان */
.banner-title::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: titleGlow 3s ease-in-out infinite;
  z-index: -1;
}

@keyframes titleGlow {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* استجابة الموبايل */
@media (max-width: 768px) {
  .academy-banner {
    padding: 30px 20px;
    margin: 30px 0;
  }

  .banner-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .banner-logo {
    width: 80px;
    height: 80px;
  }

  .banner-title {
    font-size: 1.8rem;
  }

  .banner-subtitle {
    font-size: 1rem;
  }

  .banner-description {
    font-size: 0.9rem;
  }
}

/* ناف دروب داون - مركز قيادة المتداول */
.nav-dropdown {
  position: relative;
  display: inline-block;
}
.nav-dropdown-btn {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  transition: var(--transition);
}
.nav-dropdown-btn:hover {
  color: var(--primary-gold);
}
.dropdown-arrow {
  transition: transform 0.3s ease;
}
.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}
.nav-dropdown.open .nav-dropdown-btn {
  color: var(--primary-gold);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 18px);
  right: 50%;
  transform: translateX(50%);
  width: 380px;
  background: #1a1f2e;
  border: 1px solid var(--border-color);
  border-top: 2px solid var(--primary-gold);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 1100;
  padding: 0 0 12px;
  animation: fadeInUp 0.2s ease;
}
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary-gold);
  font-weight: bold;
  font-size: 0.95rem;
  background: rgba(194, 163, 93, 0.06);
}
.dropdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 10px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-color);
  transition: var(--transition);
}
.dropdown-item:hover {
  background: rgba(194, 163, 93, 0.08);
  color: #fff;
}
.dropdown-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.dropdown-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}
.dropdown-item-desc {
  font-size: 0.75rem;
  color: #9db2bd;
}

@media (max-width: 768px) {
  .nav-dropdown {
    width: 100%;
  }
  .nav-dropdown-btn {
    width: 100%;
    justify-content: center;
  }
  .nav-dropdown-menu {
    position: static;
    transform: none;
    width: 100%;
    border-radius: 8px;
    margin-top: 8px;
  }
  .dropdown-grid {
    grid-template-columns: 1fr;
  }
}

/* زر التليجرام العائم */
.telegram-float {
  position: fixed;
  bottom: 25px;
  left: 25px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2aabee 0%, #229ed9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(42, 171, 238, 0.5);
  z-index: 1200;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: telegramPulse 2.5s ease-in-out infinite;
}
.telegram-float:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 10px 26px rgba(42, 171, 238, 0.65);
}
.telegram-float svg {
  width: 30px;
  height: 30px;
  fill: #fff;
  margin-right: -3px;
}

@keyframes telegramPulse {
  0%,
  100% {
    box-shadow: 0 6px 20px rgba(42, 171, 238, 0.5);
  }
  50% {
    box-shadow: 0 6px 25px rgba(42, 171, 238, 0.85);
  }
}

@media (max-width: 768px) {
  .telegram-float {
    width: 52px;
    height: 52px;
    bottom: 18px;
    left: 18px;
  }
  .telegram-float svg {
    width: 26px;
    height: 26px;
  }
}

/* شاشة الموبايل */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  } /* إظهار زر القائمة */

  .main-nav {
    display: none; /* إخفاء القائمة افتراضياً */
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    background: #131722;
    flex-direction: column;
    padding: 30px;
    border-bottom: 2px solid var(--primary-gold);
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  }

  .main-nav.active {
    display: flex;
  } /* إظهارها عند النقر */

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-text h1 {
    font-size: 2rem;
  }
  .footer-top {
    grid-template-columns: 1fr;
  }

  /* تحريك زر Hamburger */
  .nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
}

/* ===== Filter Bar (فلتر المقالات) ===== */
.filter-bar {
  background: #131722;
  border-bottom: 1px solid var(--border-color);
  padding: 18px 0;
  position: sticky;
  top: 86px; /* تحت الهيدر */
  z-index: 900;
}
.filter-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fpill {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.fpill:hover {
  border-color: var(--primary-gold);
  color: #fff;
}
.fpill.on {
  background: var(--primary-gold);
  border-color: var(--primary-gold);
  color: #000;
  font-weight: bold;
}
.srch {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px 16px;
  flex: 1;
  max-width: 260px;
}
.srch input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-color);
  width: 100%;
  font-family: inherit;
  font-size: 0.85rem;
}
.srch span {
  opacity: 0.6;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .filter-bar {
    top: 0;
    position: static;
  }
  .filter-inner {
    justify-content: center;
  }
  .srch {
    margin-inline-start: 0;
    max-width: 100%;
    width: 100%;
    order: 10;
  }
}

/* ===== Articles Grid + Skeleton ===== */
.art-section {
  padding: 30px 0 60px;
}
.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
}
.skel-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}
.skel {
  background: linear-gradient(90deg, #1a1f2b 25%, #232838 37%, #1a1f2b 63%);
  background-size: 400% 100%;
  border-radius: 4px;
  animation: skeleton-loading 1.4s ease infinite;
}
@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #9db2bd;
  font-size: 1rem;
}

/* ===== شبكة كروت الأخبار / الأدوات (كانت ناقصة) ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
}

/* ===== مساحات الإعلانات (كانت ناقصة) ===== */
.ad-section {
  padding: 25px 0;
}
.ad-slot {
  display: flex;
  justify-content: center;
}
.ad-slot--leaderboard img {
  border-radius: 8px;
}
.ad-banner-link {
  display: block;
  max-width: 728px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
}
.ad-banner-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  transition: var(--transition);
}
.ad-banner-link:hover .ad-banner-image {
  opacity: 0.9;
}

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

/* ─── Code & Pre - Mobile Responsive ─── */
code, pre, kbd, samp {
    font-family: 'Courier New', Courier, monospace;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
}
code {
    padding: 2px 6px;
    font-size: 0.88em;
    word-break: break-all;
}
pre {
    padding: 12px 16px;
    overflow-x: auto;
    font-size: 0.85em;
    white-space: pre;
    max-width: 100%;
}
pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

@media (max-width: 768px) {
    code {
        font-size: 0.75em;
        padding: 1px 5px;
    }
    pre {
        font-size: 0.72em;
        padding: 10px 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: calc(100vw - 32px);
        white-space: pre;
    }
}