/* Felah v4.3.1 — Reference Desktop + Clean Mobile */

:root{
  --bg:#f3f0e6;
  --card:#ffffff;
  --soft:#edf3eb;
  --soft2:#e7efe4;
  --line:#d8cbb7;
  --line2:#c8b694;
  --text:#0f281b;
  --muted:#6a786d;
  --green:#0f5f38;
  --green2:#167544;
  --radius:10px;
  --font:"IBM Plex Sans Arabic",Tahoma,Arial,sans-serif;
}

html[data-theme="dark"]{
  --bg:#041d12;
  --card:#062416;
  --soft:#082a1a;
  --soft2:#0a301f;
  --line:rgba(232,248,235,.16);
  --line2:rgba(232,248,235,.28);
  --text:#edf7ef;
  --muted:rgba(237,247,239,.68);
  --green:#eaf5ed;
  --green2:#b8e0c5;
}

*{box-sizing:border-box}

html,body{
  margin:0!important;
  padding:0!important;
  direction:rtl!important;
  text-align:right!important;
  background:var(--bg)!important;
  color:var(--text)!important;
  font-family:var(--font)!important;
  font-size:14px;
  line-height:1.75;
}

a{
  color:inherit;
  text-decoration:none;
}

/* إخفاء أي هيدر أو تبويبات قديمة في الصفحة الرئيسية فقط */
body.felah-reference-home .public-header,
body.felah-reference-home .felah-real-topbar,
body.felah-reference-home .felah-real-tabs,
body.felah-reference-home .felah-main-tabs,
body.felah-reference-home .felah-nav,
body.felah-reference-home .felah-quick-nav,
body.felah-reference-home .felah-main-banner,
body.felah-reference-home .felah-home-shortcuts{
  display:none!important;
}

body.felah-reference-home .container{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding:0!important;
}

/* ========== Desktop reference layout ========== */

.felah-ref-page{
  min-height:100vh;
  display:grid;
  grid-template-columns:minmax(0,1fr) 132px;
  grid-template-areas:"main sidebar";
  direction:ltr;
  background:var(--bg);
}

.felah-ref-main{
  grid-area:main;
  direction:rtl;
  min-width:0;
  display:flex;
  flex-direction:column;
  padding:0 8px 8px;
}

.felah-ref-sidebar{
  grid-area:sidebar;
  direction:rtl;
  position:sticky;
  top:0;
  height:100vh;
  background:var(--card);
  border-left:1px solid var(--line);
  padding:8px;
  overflow:auto;
}

/* sidebar */
.felah-ref-login{
  height:44px;
  border-radius:10px;
  background:var(--green2);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  margin-bottom:8px;
}

.felah-ref-logo-box{
  min-height:122px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--soft);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center!important;
  padding:10px 8px;
  margin-bottom:10px;
}

.felah-ref-logo-box .logo-main{
  font-size:21px;
  font-weight:900;
  line-height:1.45;
}

.felah-ref-logo-box .logo-sub{
  font-size:11px;
  color:var(--muted);
  line-height:1.5;
}

.felah-ref-user{
  border:1px solid #f0c8c8;
  background:#fff6f6;
  color:#9c2f2f;
  border-radius:8px;
  padding:7px 5px;
  text-align:center!important;
  font-size:11px;
  line-height:1.5;
  margin-bottom:10px;
}

html[data-theme="dark"] .felah-ref-user{
  background:#331c1c;
  color:#ffd2d2;
  border-color:#5a3535;
}

.felah-ref-side-title{
  text-align:center!important;
  font-weight:900;
  font-size:13px;
  margin:10px 0 8px;
}

.felah-ref-side-nav{
  display:grid;
  gap:5px;
}

.felah-ref-side-nav a{
  min-height:34px;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:5px;
  font-size:12px;
  font-weight:800;
  color:var(--text);
  text-align:center!important;
  white-space:nowrap;
}

.felah-ref-side-nav a:hover,
.felah-ref-side-nav a.active{
  background:var(--soft);
  color:var(--green);
}

/* topbar */
.felah-ref-topbar{
  height:38px;
  display:grid;
  grid-template-columns:auto auto auto minmax(180px,1fr);
  gap:8px;
  align-items:center;
  padding:5px 0;
  background:var(--bg);
}

.felah-ref-account{
  height:28px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  padding:0 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--card);
  font-size:11px;
  color:#b44;
  cursor:pointer;
}

.felah-ref-mini-btn{
  width:28px;
  height:28px;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--card);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  color:var(--text);
  font-size:11px;
}

.felah-ref-search{
  height:28px;
  display:flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--card);
  padding:0 8px;
}

.felah-ref-search input{
  border:0!important;
  outline:0!important;
  background:transparent!important;
  width:100%!important;
  color:var(--text)!important;
  font-family:var(--font)!important;
  font-size:11px!important;
  text-align:right!important;
  direction:rtl!important;
}

/* hero */
.felah-ref-hero{
  min-height:86px;
  border-radius:10px 10px 0 0;
  background:var(--soft);
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center!important;
  padding:14px;
}

.felah-ref-hero h1{
  margin:0;
  font-size:20px;
  line-height:1.55;
  font-weight:900;
}

.felah-ref-hero p{
  margin:3px 0 0;
  font-size:14px;
  font-weight:800;
}

/* ads */
.felah-ref-ads{
  display:grid;
  grid-template-columns:1fr 1fr;
}

.felah-ref-ad{
  height:78px;
  background:var(--card);
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center!important;
  font-weight:800;
  font-size:15px;
}

.felah-ref-ad:first-child{
  border-left:0;
}

.felah-ref-ad:last-child{
  border-right:0;
}

/* panels */
.felah-ref-panels{
  display:grid;
  grid-template-columns:1fr 1.35fr;
  gap:0;
}

.felah-ref-panel{
  min-height:292px;
  background:var(--card);
  border:1px solid var(--line2);
  padding:8px;
}

.felah-ref-panel:first-child{
  border-left:0;
  border-radius:0 0 0 12px;
}

.felah-ref-panel:last-child{
  border-radius:0 0 12px 0;
}

.felah-ref-panel-head{
  height:30px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight:900;
  color:var(--text);
  margin-bottom:8px;
}

.felah-ref-panel-head a{
  font-weight:900;
  font-size:13px;
}

/* lesson cards */
.felah-ref-lessons-list{
  display:grid;
  gap:8px;
  margin-top:88px;
}

.felah-ref-lesson-card{
  min-height:48px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--soft);
  padding:8px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.felah-ref-lesson-card strong{
  display:block;
  font-size:13px;
  font-weight:900;
}

.felah-ref-lesson-card span{
  display:block;
  font-size:10px;
  color:var(--muted);
}

.felah-ref-lesson-icon{
  width:28px;
  height:28px;
  min-width:28px;
  border-radius:7px;
  background:var(--card);
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--green);
}

/* section cards grid */
.felah-ref-sections-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-top:30px;
}

.felah-ref-section-card{
  min-height:78px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--soft);
  padding:10px;
  display:grid;
  grid-template-columns:32px minmax(0,1fr);
  align-items:center;
  gap:10px;
}

.felah-ref-section-icon{
  width:28px;
  height:28px;
  border-radius:7px;
  background:var(--card);
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--green);
  font-size:12px;
}

.felah-ref-section-card h3{
  margin:0 0 3px;
  font-size:13px;
  font-weight:900;
  color:var(--text);
}

.felah-ref-section-card p{
  margin:0 0 5px;
  font-size:9px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.felah-ref-section-meta{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}

.felah-ref-section-meta span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:18px;
  padding:0 7px;
  border-radius:999px;
  background:var(--card);
  font-size:9px;
  font-weight:900;
}

/* bottom */
.felah-ref-bottom{
  height:42px;
  margin-top:6px;
  border-radius:8px;
  background:var(--soft);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  border:1px solid var(--line);
}

.felah-ref-float{
  position:fixed;
  right:142px;
  bottom:10px;
  width:178px;
  min-height:72px;
  background:linear-gradient(180deg,#136b40,#0c482d);
  color:white;
  border-radius:9px;
  padding:10px;
  font-size:10px;
  z-index:30;
}

.felah-ref-float strong{
  display:block;
  margin-bottom:4px;
}

.felah-ref-float span{
  display:inline-flex;
  margin-top:6px;
  padding:2px 8px;
  background:rgba(255,255,255,.18);
  border-radius:999px;
}

/* dropdown */
.felah-ref-account-menu{
  position:relative;
}

.felah-ref-dropdown{
  display:none;
  position:absolute;
  top:32px;
  right:0;
  min-width:150px;
  padding:5px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:7px;
  z-index:80;
}

.felah-ref-account-menu.open .felah-ref-dropdown{
  display:grid;
  gap:3px;
}

.felah-ref-dropdown a{
  padding:6px;
  border-radius:4px;
  font-size:11px;
}

.felah-ref-dropdown a:hover{
  background:var(--soft);
}

/* mobile nav hidden on desktop */
.felah-ref-mobile-nav{
  display:none;
}

/* ========== Mobile clean normal ========== */
@media(max-width:900px){
  html[data-theme="light"]{
    --bg:#031b11;
    --card:#062416;
    --soft:#082a1a;
    --soft2:#0a301f;
    --line:rgba(232,248,235,.16);
    --line2:rgba(232,248,235,.28);
    --text:#edf7ef;
    --muted:rgba(237,247,239,.68);
    --green:#eaf5ed;
    --green2:#b8e0c5;
  }

  html,body{
    background:#031b11!important;
    color:#edf7ef!important;
  }

  .felah-ref-page{
    display:block;
    min-height:100vh;
    padding-bottom:96px;
    background:#031b11;
  }

  .felah-ref-sidebar,
  .felah-ref-login,
  .felah-ref-logo-box,
  .felah-ref-user,
  .felah-ref-side-title,
  .felah-ref-side-nav,
  .felah-ref-float{
    display:none!important;
  }

  .felah-ref-main{
    padding:16px;
  }

  .felah-ref-topbar{
    height:auto;
    display:grid;
    grid-template-columns:auto auto 1fr;
    gap:10px;
    padding:0;
    margin-bottom:14px;
    border:0;
  }

  .felah-ref-account-menu{
    order:1;
  }

  .felah-ref-account{
    height:52px;
    border-radius:18px;
    background:#082416;
    color:#edf7ef;
    border:1px solid rgba(232,248,235,.16);
    font-size:14px;
    padding:0 14px;
  }

  .felah-ref-mini-btn{
    width:52px;
    height:52px;
    border-radius:18px;
    background:#082416;
    color:#edf7ef;
    border:1px solid rgba(232,248,235,.16);
  }

  .felah-ref-search{
    grid-column:1 / -1;
    order:10;
    height:86px;
    border-radius:26px;
    background:#082416;
    border:1px solid rgba(232,248,235,.16);
    padding:0 22px;
  }

  .felah-ref-search input{
    font-size:22px!important;
    color:#edf7ef!important;
  }

  .felah-ref-search span{
    font-size:22px;
  }

  /* هذا يزيل الصف الثالث الجديد المخالف: منصة فلاح وما معها */
  .felah-mobile-extra-row,
  .felah-mobile-brand-row,
  .felah-ref-mobile-brand,
  .felah-ref-extra-actions,
  .felah-ref-mobile-title-buttons{
    display:none!important;
  }

  .felah-ref-hero{
    min-height:132px;
    border-radius:18px;
    background:#082416;
    border:1px solid rgba(232,248,235,.16);
    margin:0 0 10px;
  }

  .felah-ref-hero h1{
    font-size:23px;
    color:#edf7ef;
  }

  .felah-ref-hero p{
    font-size:17px;
    color:#edf7ef;
  }

  .felah-ref-ads{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
  }

  .felah-ref-ad,
  .felah-ref-ad:first-child,
  .felah-ref-ad:last-child{
    height:94px;
    border-radius:14px;
    border:1px solid rgba(232,248,235,.16);
    background:#062416;
    color:#edf7ef;
    font-size:18px;
  }

  .felah-ref-panels{
    display:grid;
    grid-template-columns:1fr;
    gap:12px;
    margin-top:12px;
  }

  .felah-ref-panel,
  .felah-ref-panel:first-child,
  .felah-ref-panel:last-child{
    min-height:auto;
    border-radius:16px;
    border:1px solid rgba(232,248,235,.16);
    background:#062416;
    padding:16px;
  }

  .felah-ref-panel-head{
    height:auto;
    font-size:22px;
    margin-bottom:14px;
  }

  .felah-ref-lessons-list,
  .felah-ref-sections-grid{
    margin-top:0;
    grid-template-columns:1fr;
    display:grid;
    gap:10px;
  }

  .felah-ref-lesson-card,
  .felah-ref-section-card{
    min-height:76px;
    border-radius:14px;
    background:#082a1a;
    border:1px solid rgba(232,248,235,.16);
    padding:14px;
  }

  .felah-ref-section-card{
    grid-template-columns:46px minmax(0,1fr);
  }

  .felah-ref-lesson-card strong,
  .felah-ref-section-card h3{
    font-size:18px;
    color:#edf7ef;
  }

  .felah-ref-lesson-card span,
  .felah-ref-section-card p{
    font-size:13px;
    color:rgba(237,247,239,.68);
  }

  .felah-ref-section-icon,
  .felah-ref-lesson-icon{
    width:42px;
    height:42px;
    border-radius:12px;
    background:#eef5ef;
    color:#1c6841;
  }

  .felah-ref-bottom{
    display:none;
  }

  .felah-ref-mobile-nav{
    display:flex;
    position:fixed;
    right:14px;
    left:14px;
    bottom:14px;
    height:82px;
    border-radius:28px;
    background:#062416;
    border:1px solid rgba(232,248,235,.16);
    z-index:200;
    align-items:center;
    justify-content:space-around;
    box-shadow:0 14px 40px rgba(0,0,0,.18);
  }

  .felah-ref-mobile-nav a{
    flex:1;
    min-width:0;
    height:66px;
    border-radius:20px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:4px;
    color:rgba(237,247,239,.68);
    font-size:13px;
    font-weight:900;
  }

  .felah-ref-mobile-nav a.active{
    background:#0b321f;
    color:#edf7ef;
  }

  .felah-ref-mobile-nav .ico{
    font-size:20px;
  }
}
