/* =========================
   Public Site - style_public.css (Final Repair)
   ========================= */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

:root{
  --primary-green:#007a3d;
  --strong-red:#ce1127;
  --accent-gold:#D8C9A3;
  --dark-text:#4A4A4A;
  --bg-color:#F5F5F5;
  --white:#FFFFFF;
  --footer-bg:#3D5D50;
  --border: rgba(0,0,0,.10);
  --card:#fff;
  --muted: rgba(0,0,0,.65);
}

*{ box-sizing:border-box; margin:0; padding:0; font-family:'Cairo', sans-serif; }
html{ scroll-behavior:smooth; }
body{
  background:var(--bg-color);
  color:var(--dark-text);
  line-height:1.6;
  direction: inherit;
  text-align: inherit;
  min-height:100vh;
  overflow-x:hidden;
}
a{ color:inherit; text-decoration:none; transition:.25s; }
img{ max-width:100%; height:auto; display:block; }
ul{ list-style:none; }
.container{ width:min(1100px, 92%); margin:0 auto; }

/* Header */
header{
  background:var(--white);
  padding:10px 5%;
  box-shadow:0 4px 20px rgba(0,0,0,.05);
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:3px solid var(--primary-green);
  min-height:90px;
  position:sticky;
  top:0;
  z-index:1000;
}
.logo-img{ height:70px; width:auto; object-fit:contain; }
.main-navbar{ display:flex; align-items:center; gap:18px; }
.nav-links{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.nav-links a{ padding:8px 12px; border-radius:10px; font-weight:700; }
.nav-links a:hover{ background:rgba(0,0,0,.04); }
.nav-links a.active{ background:rgba(0,122,61,.10); color:var(--primary-green); }

.header-actions{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.header-btn{
  background:var(--primary-green);
  color:var(--white);
  padding:8px 18px;
  border-radius:10px;
  font-weight:800;
  font-size:.9rem;
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:2px solid var(--primary-green);
}
.header-btn:hover{ background:#006231; border-color:#006231; }
.btn-login{ background:transparent !important; color:var(--primary-green) !important; }
.btn-login:hover{ background:var(--primary-green) !important; color:var(--white) !important; transform:translateY(-2px); }

/* Public layout */
.site-main{ padding:24px 0 40px; }
.page-head{ padding:28px 0 10px; }
.page-head h1{ margin:0 0 8px; font-size:1.9rem; }
.page-head p{ margin:0; color:var(--muted); }

.section{ padding:22px 0; }
.section.alt{ background:rgba(0,0,0,.02); }
.section-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.section-head h2{ font-size:1.35rem; }
.link{ color:var(--muted); }
.link:hover{ color:var(--dark-text); }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 14px; border-radius:12px; border:1px solid var(--border);
  cursor:pointer; font-weight:800;
}
.btn.primary{ background:var(--primary-green); color:#fff; border-color:transparent; }
.btn.ghost{ background:transparent; }
.btn.accent{ background:var(--accent-gold); color:#222; border-color:transparent; }

.hero{
  background:linear-gradient(135deg, var(--white) 0%, #e8f5e9 100%);
  padding:45px 0 20px;
  border-bottom:1px solid rgba(0,0,0,.08);
}
.hero-grid{ display:grid; grid-template-columns:1.35fr .85fr; gap:18px; align-items:stretch; }
.hero-text h1{ font-size:2.2rem; margin:0 0 10px; color:var(--primary-green); }
.hero-text p{ margin:0 0 16px; color:var(--muted); }
.hero-actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* Cards Grid */
.cards-grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:14px; }
@media (max-width:950px){ .cards-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:620px){ .cards-grid{ grid-template-columns:1fr; } }

.card{ display:block; border-radius:16px; overflow:hidden; border:1px solid var(--border); background:var(--card); }
.card-media img{ width:100%; height:180px; object-fit:cover; }
.card-body{ padding:12px 12px 14px; }
.card-body h3{ margin:0 0 8px; font-size:1.05rem; line-height:1.45; }
.meta{ font-size:.92rem; color:var(--muted); margin-bottom:8px; }

.donate-card{ padding:16px; border-radius:18px; border:1px solid var(--border); background:var(--card); }
.donate-card h3{ margin:0 0 8px; font-size:1.25rem; }
.donate-card p{ margin:0 0 12px; color:var(--muted); }

.contact-grid{ display:grid; grid-template-columns:1fr .9fr; gap:14px; align-items:start; }
@media (max-width:900px){ .contact-grid{ grid-template-columns:1fr; } }
.form label{ display:block; margin-bottom:10px; font-weight:800; font-size:.92rem; }
.form input, .form textarea{ width:100%; padding:10px 12px; border-radius:12px; border:1px solid rgba(0,0,0,.14); margin-top:6px; background:#fff; }
.form textarea{ resize:vertical; }
.form-note{ margin-top:10px; color:var(--muted); font-size:.92rem; }

.donate-grid{ display:grid; grid-template-columns:1.1fr .9fr; gap:14px; }
@media (max-width:900px){ .donate-grid{ grid-template-columns:1fr; } }
.donate-panel{ border-radius:16px; border:1px solid var(--border); background:var(--card); padding:14px; }


/* ==============================================
   Footer (إصلاح جذري للتراكب والمحاذاة)
   ============================================== */
footer, .site-footer {
    background: linear-gradient(180deg, rgba(61,93,80,1) 0%, rgba(43,69,59,1) 100%);
    color: rgba(255,255,255,.95);
    padding: 50px 0 0;
    border-top: 6px solid var(--accent-gold);
    position: relative;
    overflow: hidden;
    text-align: center !important;
}

.site-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.footer-tagline { font-size: 1.2rem; font-weight: 800; color: var(--accent-gold); margin-bottom: 5px; }
.footer-note { opacity: 0.9; max-width: 600px; margin: 0 auto 30px auto; font-size: 0.95rem; }

/* صندوق معلومات التواصل (الصندوق الرمادي) */
.footer-row-contact {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 30px 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-row-contact h4 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 25px;
    font-weight: 800;
}

/* إجبار جميع العناصر داخل الصندوق (ما عدا العنوان)
   على الترتيب عمودياً (فوق بعض)
   لمنع مشكلة السطر الواحد المتراكب
*/
.footer-row-contact > div, 
.footer-contact-grid,
.footer-contact-list {
    display: flex !important;
    flex-direction: column !important; /* هذا الأمر يجبرهم على النزول تحت بعض */
    gap: 12px !important; /* مسافة بين كل سطر معلومات */
    width: 100%;
    align-items: center;
}

/* تنسيق روابط التواصل (البريد، الهاتف، العنوان) */
.footer-row-contact a, 
.footer-contact-grid a,
.footer-contact-list div,
.footer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    /* تقريب الرمز من النص (5px فقط) */
    gap: 5px !important; 
    color: #fff;
    font-size: 1.1rem;
    text-decoration: none;
    width: 100%;
}

/* تنسيق الأيقونة الملاصقة للنص */
.footer-row-contact i,
.footer-contact-grid i {
    color: var(--accent-gold);
    font-size: 1.2rem;
    margin: 0; /* إزالة أي هوامش تباعد */
}

/* شريط أيقونات التواصل الاجتماعي (أسفل الصندوق) */
.footer-social-strip {
    display: flex;
    flex-direction: row !important; /* أيقونات بجانب بعض */
    gap: 12px;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 12px 25px;
    border-radius: 50px;
    margin-top: 30px;
    border: 1px solid rgba(255,255,255,0.1);
}

.footer-social-strip a {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: 0.3s;
    border: 1px solid transparent;
}

.footer-social-strip a:hover {
    background: var(--accent-gold);
    color: #000;
    transform: translateY(-3px);
}

/* الحقوق */
.footer-bottom {
    margin-top: 40px;
    padding: 20px 0;
    background: rgba(0,0,0,0.15);
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-bottom-inner { text-align: center; color: rgba(255,255,255,0.7); font-size: 0.9rem; }


/* =========================
   Detail Pages
   ========================= */
.detail-image-wrapper {
    margin-bottom: 35px; border-radius: 16px; overflow: hidden; position: relative; height: 550px;
    background-color: #f0f2f5; border: 1px solid #eee; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.detail-image-wrapper img {
    max-width: 100%; max-height: 100%; width: auto; height: auto;
    display: block; object-fit: contain; box-shadow: 0 10px 25px rgba(0,0,0,0.15); border-radius: 8px;
}
@media (max-width: 768px) { .detail-image-wrapper { height: 350px; } }
.detail-title { margin-bottom: 15px; font-size: 1.8rem; font-weight: 800; line-height: 1.4; color: var(--primary-green); }
.detail-meta { margin-bottom: 35px; padding-bottom: 20px; border-bottom: 1px solid #eee; display: flex; gap: 25px; color: #666; font-size: 0.95rem; flex-wrap: wrap; }
.detail-meta span i { margin-inline-end: 8px; color: var(--accent-gold); }
.detail-body { margin-bottom: 40px; line-height: 1.9; font-size: 1.1rem; color: #444; text-align: justify; }
.download-box { background: #f0f7f4; border: 1px solid #cce5d6; padding: 30px; border-radius: 12px; text-align: center; margin-top: 40px; }
.btn-download { display: inline-flex; align-items: center; gap: 10px; background: var(--primary-green); color: #fff; padding: 12px 30px; border-radius: 6px; text-decoration: none; font-weight: bold; transition: 0.3s; font-size: 1.1rem; }
.btn-download:hover { background: #005c2e; transform: translateY(-2px); color: #fff; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; margin-bottom: 40px; }
.gallery-item { border-radius: 12px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.05); background: #fff; transition: transform 0.3s ease; }
.gallery-item:hover { transform: translateY(-5px); }
.gallery-item img, .gallery-item video { width: 100%; height: 220px; object-fit: cover; display: block; }
.social-view-box { background: #f9f9f9; padding: 25px; border-radius: 16px; border: 1px solid #eee; }
.social-icon-row { display: flex; gap: 10px; flex-wrap: wrap; }
.social-icon-btn { transition: all 0.3s ease; border: 1px solid transparent; width: 46px; height: 46px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; }
.social-icon-btn.fb { color: #1877F2; border-color: #1877F2; } .social-icon-btn.fb:hover { background-color: #1877F2; color: #fff; }
.social-icon-btn.insta { color: #E4405F; border-color: #E4405F; } .social-icon-btn.insta:hover { background-color: #E4405F; color: #fff; }
.social-icon-btn.x-tw { color: #000; border-color: #000; } .social-icon-btn.x-tw:hover { background-color: #000; color: #fff; }
.social-icon-btn.in { color: #0A66C2; border-color: #0A66C2; } .social-icon-btn.in:hover { background-color: #0A66C2; color: #fff; }
.social-icon-btn.tele { color: #0088cc; border-color: #0088cc; } .social-icon-btn.tele:hover { background-color: #0088cc; color: #fff; }
.social-icon-btn.yt { color: #FF0000; border-color: #FF0000; } .social-icon-btn.yt:hover { background-color: #FF0000; color: #fff; }
.social-icon-btn.tree { color: #43E660; border-color: #43E660; } .social-icon-btn.tree:hover { background-color: #43E660; color: #004d00 !important; }

/* =========================
   Library / Books Style
   ========================= */
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 30px; padding: 20px 0; }
.book-card { display: flex; flex-direction: column; height: 100%; transition: transform 0.3s ease; max-width: 220px; width: 100%; text-decoration: none; }
.book-card:hover { transform: translateY(-8px); }
.book-cover-wrapper { position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 6px 10px 10px 6px; overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.15), inset 3px 0 5px rgba(255,255,255,0.2); background: #e0e0e0; margin-bottom: 15px; }
.book-cover-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-spine-effect { position: absolute; top: 0; bottom: 0; left: 0; width: 12px; background: linear-gradient(to right, rgba(255,255,255,0.3) 0%, rgba(0,0,0,0.1) 20%, transparent 100%); pointer-events: none; border-right: 1px solid rgba(0,0,0,0.1); }
.book-info { text-align: center; padding: 0 2px; }
.book-cat { display: inline-block; font-size: 0.7rem; color: var(--primary-green); background: rgba(0,122,61,0.08); padding: 2px 8px; border-radius: 4px; margin-bottom: 5px; font-weight: 600; }
.book-info h3 { font-size: 0.95rem; line-height: 1.4; margin-bottom: 5px; color: var(--dark-text); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-meta { font-size: 0.8rem; color: #888; }
@media (max-width: 500px) { .library-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; } .book-card { max-width: 100%; } }

/* =========================
   Arch/About Section
   ========================= */
.arch-section { padding: 60px 0 80px; background: linear-gradient(to bottom, #fcfcfc, #f5f5f5); position: relative; }
.arch-card { background: #fff; border-radius: 20px; position: relative; overflow: hidden; box-shadow: 0 25px 50px rgba(0, 0, 0, 0.05); border: 1px solid rgba(255, 255, 255, 0.8); transition: transform 0.3s ease; }
.arch-card::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: linear-gradient(90deg, var(--primary-green) 30%, var(--accent-gold) 30%); }
.arch-watermark { position: absolute; bottom: -80px; left: -80px; width: 500px; opacity: 0.07; z-index: 0; pointer-events: none; transform: rotate(10deg); }
.arch-content { position: relative; z-index: 2; padding: 50px; }
.arch-title { font-size: 2rem; font-weight: 800; color: var(--primary-green); margin-bottom: 20px; position: relative; display: inline-block; }
.arch-text { font-size: 1.1rem; line-height: 1.9; color: #555; max-width: 900px; margin-bottom: 40px; text-align: justify; }
.arch-divider { height: 1px; background: linear-gradient(90deg, var(--border), transparent); margin: 30px 0; width: 60%; }
.arch-subtitle { font-size: 1.4rem; color: var(--dark-text); font-weight: 700; margin-bottom: 25px; border-right: 5px solid var(--accent-gold); padding-right: 15px; }
.arch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; margin-top: 30px; }
.arch-feature-card { background: #fcfcfc; border: 1px solid rgba(0,0,0,0.04); border-radius: 16px; padding: 25px; display: flex; align-items: flex-start; gap: 20px; transition: all 0.3s ease; position: relative; }
.arch-feature-card:hover { transform: translateY(-5px); background: #fff; box-shadow: 0 10px 25px rgba(0,0,0,0.06); border-color: var(--accent-gold); }
.arch-icon-box { width: 55px; height: 55px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--primary-green); box-shadow: 0 5px 15px rgba(0,122,61,0.1); border: 1px solid rgba(0,122,61,0.1); flex-shrink: 0; }
.arch-feature-info h4 { margin: 0 0 8px; color: var(--dark-text); font-size: 1.05rem; font-weight: 800; }
.arch-feature-info p { margin: 0; font-size: 0.92rem; color: #777; line-height: 1.5; }
@media (max-width: 900px) { .arch-content { padding: 30px 20px; } .arch-grid { grid-template-columns: 1fr; } .arch-watermark { width: 300px; bottom: -50px; left: -50px; } .arch-title { font-size: 1.6rem; } }

html[dir="rtl"] body{ direction: rtl; text-align: right; }
html[dir="ltr"] body{ direction: ltr; text-align: left; }
html[dir="ltr"] .arch-watermark { right: -80px; left: auto; transform: rotate(-10deg); }
html[dir="ltr"] .arch-subtitle { border-right: none; border-left: 5px solid var(--accent-gold); padding-right: 0; padding-left: 15px; }


/* =========================
   Section Head (Title + View all)
========================= */

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* RTL */
html[dir="rtl"] .section-head {
    text-align: right;
}

/* LTR */
html[dir="ltr"] .section-head {
    text-align: left;
}

/* =========================
   View all button
========================= */

.view-all {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-green);
    text-decoration: none;
}

.view-all:hover {
    text-decoration: underline;
}

/* =========================
   Studies grid
========================= */

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* =========================
   Study card
========================= */

.library-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 12px rgba(0,0,0,0.08);
    transition: transform .2s ease;
}

.library-card:hover {
    transform: translateY(-3px);
}

.library-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.library-card h3 {
    padding: 15px;
    font-size: 1rem;
}

/* =========================
   Empty state
========================= */

.empty {
    grid-column: 1 / -1;
    font-size: 0.95rem;
    opacity: 0.7;
}

/* RTL */
html[dir="rtl"] .empty {
    text-align: right;
}

/* LTR */
html[dir="ltr"] .empty {
    text-align: left;
}

/* ===== Index: compact sections when no featured items ===== */
.section.is-empty{
  padding-top:10px;
  padding-bottom:10px;
}
.section.is-empty .section-head{
  margin-bottom:0;
}
.section.is-empty .cards-grid,
.section.is-empty .library-grid{
  display:none !important;
}

/* Ensure section head aligns correctly based on page direction */
html[dir="rtl"] .section-head{ direction: rtl; }
html[dir="ltr"] .section-head{ direction: ltr; }

/* Empty state alignment (if used elsewhere) */
html[dir="rtl"] .empty{ text-align:right; }
html[dir="ltr"] .empty{ text-align:left; }

