/* ===================================================
   Article Enhanced CSS - Dr. Mohammad Hilal
   تصميم احترافي ومحسّن لمحركات البحث
   =================================================== */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&family=Tajawal:wght@300;400;500;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary:       #1a5276;
  --primary-light: #2980b9;
  --primary-pale:  #d6eaf8;
  --accent:        #117a65;
  --accent-light:  #1abc9c;
  --accent-pale:   #d1f2eb;
  --warning:       #b7950b;
  --warning-pale:  #fef9e7;
  --danger:        #922b21;
  --danger-pale:   #fdedec;
  --text-dark:     #1c2833;
  --text-mid:      #424949;
  --text-light:    #717d7e;
  --bg-page:       #f0f4f8;
  --bg-white:      #ffffff;
  --border-light:  #d5d8dc;
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:     0 6px 24px rgba(0,0,0,0.10);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.14);
  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --transition:    all 0.3s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  font-size: 17px;
  line-height: 1.9;
  color: var(--text-dark);
  background-color: var(--bg-page);
  direction: rtl;
}

/* ---- Top Progress Bar ---- */
.reading-progress {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent-light));
  z-index: 9998;
  transform-origin: right;
  transform: scaleX(0);
  transition: transform 0.1s linear;
}

/* ---- Page Header / Breadcrumb ---- */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, #154360 100%);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.page-header .container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  font-size: 0.88rem;
}
.breadcrumb li { color: rgba(255,255,255,0.75); }
.breadcrumb li a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  transition: var(--transition);
}
.breadcrumb li a:hover { color: #fff; text-decoration: underline; }
.breadcrumb li::after { content: '/'; margin-right: 8px; color: rgba(255,255,255,0.4); }
.breadcrumb li:last-child::after { display: none; }
.breadcrumb li:last-child { color: #fff; font-weight: 600; }

/* ---- Main Layout ---- */
.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

/* ---- Article Card ---- */
article.article-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 50px 55px;
  position: relative;
  overflow: hidden;
}
article.article-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--accent-light));
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* ---- Article Meta ---- */
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-pale);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}
.meta-badge.green { background: var(--accent-pale); color: var(--accent); }
.meta-badge.gold  { background: var(--warning-pale); color: var(--warning); }

/* ---- Headings ---- */
h1.article-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 900;
  color: var(--primary);
  line-height: 1.4;
  margin-bottom: 24px;
  padding-right: 20px;
  border-right: 6px solid var(--accent-light);
}

h2 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
  color: var(--primary);
  margin-top: 44px;
  margin-bottom: 16px;
  padding: 10px 18px;
  background: linear-gradient(90deg, var(--primary-pale), transparent);
  border-right: 5px solid var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

h3 {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-weight: 700;
  color: var(--accent);
  margin-top: 30px;
  margin-bottom: 12px;
  padding-right: 14px;
  border-right: 4px solid var(--accent-light);
}

h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 22px;
  margin-bottom: 10px;
}

/* ---- Paragraphs ---- */
p {
  margin-bottom: 18px;
  text-align: justify;
  color: var(--text-mid);
  font-size: 1rem;
}

/* ---- Intro Box ---- */
.intro, .article-intro {
  background: linear-gradient(135deg, var(--primary-pale) 0%, #eaf4fb 100%);
  border: 1px solid #aed6f1;
  border-right: 5px solid var(--primary-light);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  margin-bottom: 36px;
  font-size: 1.08rem;
  color: var(--primary);
  font-weight: 500;
  line-height: 1.8;
}
.intro p, .article-intro p { color: var(--primary); margin-bottom: 0; font-size: 1.05rem; }

/* ---- Highlight / Info Boxes ---- */
.info-box {
  background: var(--accent-pale);
  border-right: 5px solid var(--accent-light);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 28px 0;
}
.info-box p { color: var(--accent); margin-bottom: 0; }

.warning-box {
  background: var(--warning-pale);
  border-right: 5px solid #f0b429;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 28px 0;
}
.warning-box p { color: #7d6608; margin-bottom: 0; }

.danger-box {
  background: var(--danger-pale);
  border-right: 5px solid #e74c3c;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 28px 0;
}
.danger-box p { color: var(--danger); margin-bottom: 0; }

/* ---- Lists ---- */
ul, ol {
  padding-right: 28px;
  margin-bottom: 20px;
}
ul li, ol li {
  margin-bottom: 10px;
  color: var(--text-mid);
  line-height: 1.8;
  position: relative;
}
ul { list-style: none; padding-right: 0; }
ul li {
  padding-right: 28px;
}
ul li::before {
  content: '◆';
  position: absolute;
  right: 0;
  color: var(--primary-light);
  font-size: 0.7rem;
  top: 7px;
}

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
  margin: 28px 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
thead tr {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
}
thead th {
  padding: 14px 18px;
  text-align: right;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}
tbody tr:nth-child(even) { background: #f7fbff; }
tbody tr:hover { background: var(--primary-pale); }
tbody td {
  padding: 13px 18px;
  text-align: right;
  color: var(--text-mid);
}

/* ---- Blockquote ---- */
blockquote {
  background: linear-gradient(135deg, #fdfefe, var(--primary-pale));
  border-right: 6px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 22px 28px;
  margin: 28px 0;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--primary);
  position: relative;
}
blockquote::before {
  content: '"';
  font-size: 4rem;
  color: var(--primary-light);
  opacity: 0.3;
  position: absolute;
  top: -10px;
  right: 16px;
  font-family: Georgia, serif;
  line-height: 1;
}

/* ---- Links ---- */
a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---- Strong ---- */
strong {
  color: var(--primary);
  font-weight: 700;
}

/* ---- Divider ---- */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-light), var(--accent-light), transparent);
  margin: 44px 0;
  border-radius: 2px;
}

/* ---- Related Articles Box ---- */
.related-articles {
  background: linear-gradient(135deg, #f8f9fa, #eaf4fb);
  border: 1px solid #aed6f1;
  border-radius: var(--radius-md);
  padding: 28px 32px;
  margin-top: 44px;
}
.related-articles h2 {
  margin-top: 0;
  background: none;
  border-right: none;
  padding: 0;
  color: var(--primary);
  font-size: 1.2rem;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--primary-pale);
  padding-bottom: 12px;
}
.related-articles ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.related-articles ul li { padding-right: 0; }
.related-articles ul li::before { display: none; }
.related-articles ul li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  font-size: 0.92rem;
  color: var(--primary);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.related-articles ul li a::before {
  content: '←';
  color: var(--accent-light);
  font-weight: 700;
  flex-shrink: 0;
}
.related-articles ul li a:hover {
  background: var(--primary-pale);
  border-color: var(--primary-light);
  text-decoration: none;
  transform: translateX(-3px);
}

/* ---- External Links Box ---- */
.external-links {
  background: var(--warning-pale);
  border: 1px solid #f9e79f;
  border-right: 5px solid #f0b429;
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-top: 28px;
}
.external-links h2 {
  margin-top: 0;
  background: none;
  border-right: none;
  padding: 0;
  color: #7d6608;
  font-size: 1.1rem;
  margin-bottom: 14px;
}
.external-links ul { list-style: none; padding: 0; }
.external-links ul li { padding-right: 0; }
.external-links ul li::before { display: none; }
.external-links ul li a {
  color: #7d6608;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.external-links ul li a::before { content: '🔗'; font-size: 0.8rem; }
.external-links ul li a:hover { color: var(--primary); }

/* ---- CTA / Doctor Card ---- */
.doctor-cta {
  background: linear-gradient(135deg, var(--primary) 0%, #154360 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  margin-top: 44px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.doctor-cta::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.doctor-cta::after {
  content: '';
  position: absolute;
  bottom: -60px; right: -30px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.doctor-cta h3 {
  color: #fff;
  font-size: 1.4rem;
  margin-bottom: 10px;
  border: none;
  padding: 0;
}
.doctor-cta p {
  color: rgba(255,255,255,0.85);
  margin-bottom: 24px;
  font-size: 1rem;
}
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #25D366;
  color: #fff;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(37,211,102,0.4);
}
.cta-btn:hover {
  background: #128c7e;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,211,102,0.5);
  color: #fff;
  text-decoration: none;
}

/* ---- Summary Box ---- */
.summary-box {
  background: linear-gradient(135deg, var(--accent-pale), #e8f8f5);
  border: 1px solid #a9dfbf;
  border-right: 5px solid var(--accent-light);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin: 36px 0;
}
.summary-box h3 {
  color: var(--accent);
  margin-top: 0;
  border: none;
  padding: 0;
  margin-bottom: 14px;
  font-size: 1.1rem;
}
.summary-box p { color: #1e8449; margin-bottom: 0; }

/* ---- Footer ---- */
footer.article-footer {
  margin-top: 60px;
  padding: 30px 0 10px;
  text-align: center;
  border-top: 2px solid var(--primary-pale);
}
footer.article-footer p {
  color: var(--text-light);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
footer.article-footer a { color: var(--primary-light); font-size: 0.88rem; }

/* ---- Back Link ---- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 24px;
  margin-left: 16px;
  padding: 8px 18px;
  background: var(--bg-white);
  border-radius: 50px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.back-link:hover {
  background: var(--primary-pale);
  border-color: var(--primary-light);
  text-decoration: none;
  transform: translateX(3px);
}

/* ---- WhatsApp Button ---- */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(37,211,102,0.5); }
  50%  { box-shadow: 0 0 0 10px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}
@keyframes float-gentle {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.whatsapp-floating-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 64px;
  height: 64px;
  background: #25D366;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37,211,102,0.4);
  animation: pulse-ring 3s infinite, float-gentle 4s ease-in-out infinite;
  z-index: 9999;
  transition: var(--transition);
  text-decoration: none;
}
.whatsapp-floating-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 28px rgba(37,211,102,0.6);
  text-decoration: none;
}
.whatsapp-floating-btn svg { width: 34px; height: 34px; fill: white; flex-shrink: 0; }

/* ---- Schema Markup Helper Classes ---- */
.author-name { font-weight: 700; color: var(--primary); }
.publish-date { color: var(--text-light); font-size: 0.88rem; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  article.article-card { padding: 28px 22px; }
  h1.article-title { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  .related-articles ul { grid-template-columns: 1fr; }
  .doctor-cta { padding: 28px 22px; }
  .whatsapp-floating-btn { width: 56px; height: 56px; bottom: 20px; left: 20px; }
  .whatsapp-floating-btn svg { width: 28px; height: 28px; }
}
@media (max-width: 480px) {
  article.article-card { padding: 20px 16px; }
  body { font-size: 15px; }
}

/* ---- Print ---- */
@media print {
  .whatsapp-floating-btn, .page-header, .reading-progress { display: none; }
  article.article-card { box-shadow: none; padding: 0; }
  body { background: white; }
}
