:root{
  --bg:#f4f0e6;
  --panel:#ffffff;
  --card:#ffffff;
  --soft:#eef3eb;
  --soft2:#e6eee3;
  --line:#d7cbb7;
  --line2:#c3b292;
  --text:#10291b;
  --muted:#68786d;
  --green:#0f5f38;
  --green2:#167544;
  --danger:#a33;
  --font:"IBM Plex Sans Arabic",Tahoma,Arial,sans-serif;
}

html[data-theme="dark"]{
  --bg:#041d12;
  --panel:#062416;
  --card:#072719;
  --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{text-decoration:none;color:inherit}

body.felah-v5-public .public-header,
body.felah-v5-public .felah-real-topbar,
body.felah-v5-public .felah-real-tabs,
body.felah-v5-public .felah-main-tabs,
body.felah-v5-public .felah-nav,
body.felah-v5-public .felah-quick-nav,
body.felah-v5-public .felah-main-banner,
body.felah-v5-public .container > .hero,
body.felah-v5-public .container > .card-grid,
body.felah-v5-public .container > .section-title{
  display:none!important;
}

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

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

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

.felah-v5-main{
  grid-area:main;
  direction:rtl;
  min-width:0;
  padding:0 12px 12px;
}

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

.felah-v5-logo strong{
  font-size:24px;
  font-weight:900;
  line-height:1.3;
}

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

.felah-v5-user-card{
  border:1px solid #f0c8c8;
  background:#fff6f6;
  color:#9c2f2f;
  border-radius:10px;
  padding:8px;
  text-align:center!important;
  margin-bottom:12px;
}

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

.felah-v5-user-card .name{
  font-weight:900;
  font-size:12px;
}

.felah-v5-user-card .role{
  font-size:11px;
}

.felah-v5-side-nav{
  display:grid;
  gap:6px;
}

.felah-v5-side-nav a{
  min-height:38px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center!important;
  font-size:13px;
  font-weight:900;
}

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

.felah-v5-app-box{
  margin-top:14px;
  min-height:86px;
  border-radius:12px;
  background:linear-gradient(180deg,#136b40,#0c482d);
  color:#fff;
  padding:12px 8px;
  text-align:center!important;
  font-size:11px;
}

.felah-v5-app-box strong{
  display:block;
  font-size:13px;
  margin-bottom:5px;
}

.felah-v5-topbar{
  height:46px;
  display:grid;
  grid-template-columns:auto auto minmax(220px,1fr);
  gap:10px;
  align-items:center;
  padding:7px 0;
}

.felah-v5-user-menu{
  position:relative;
  z-index:50;
}

.felah-v5-user-button{
  height:32px;
  min-width:96px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--card);
  color:var(--text);
  font-family:var(--font);
  font-weight:900;
  font-size:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  cursor:pointer;
}

.status-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#167544;
}

.felah-v5-user-dropdown{
  display:none;
  position:absolute;
  top:39px;
  right:0;
  min-width:235px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:14px;
  padding:8px;
  box-shadow:0 18px 40px rgba(0,0,0,.14);
}

.felah-v5-user-menu.open .felah-v5-user-dropdown{
  display:grid;
  gap:6px;
}

.felah-v5-user-dropdown a{
  min-height:38px;
  border-radius:10px;
  padding:8px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight:800;
  font-size:13px;
}

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

.felah-v5-user-dropdown .logout{
  color:var(--danger);
}

.felah-v5-theme{
  width:32px;
  height:32px;
  border-radius:50%;
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text);
  cursor:pointer;
}

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

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

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

.felah-v5-hero h1{
  margin:0;
  font-size:24px;
  font-weight:900;
}

.felah-v5-hero p{
  margin:4px 0 0;
  font-size:15px;
  font-weight:800;
}

.felah-v5-ads{
  display:grid;
  grid-template-columns:1fr 1fr;
}

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

.felah-v5-ad:first-child{border-left:0}
.felah-v5-ad:last-child{border-right:0}

.felah-v5-stage{
  background:var(--card);
  border:1px solid var(--line2);
  border-top:0;
  border-radius:0 0 16px 16px;
  min-height:470px;
  padding:42px 48px 36px;
}

.felah-v5-page-stage{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  min-height:calc(100vh - 70px);
  padding:52px 58px 38px;
}

.felah-v5-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:22px;
  margin-bottom:30px;
}

.felah-v5-head h1,
.felah-v5-head h2{
  margin:0;
  font-size:40px;
  line-height:1.25;
  font-weight:900;
}

.felah-v5-head p{
  color:var(--muted);
  margin:8px 0 0;
}

.felah-v5-small-btn{
  min-width:90px;
  min-height:76px;
  border-radius:18px;
  background:var(--soft);
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center!important;
  font-weight:900;
}

.felah-v5-category-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:22px;
}

.felah-v5-category-card{
  min-height:176px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:24px;
  padding:30px 34px;
  display:grid;
  grid-template-columns:100px minmax(0,1fr);
  gap:28px;
  align-items:center;
}

.felah-v5-category-card .icon{
  width:96px;
  height:96px;
  border-radius:24px;
  background:var(--soft);
  color:var(--green2);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:32px;
}

.felah-v5-category-card h3{
  margin:0 0 10px;
  font-size:34px;
  line-height:1.25;
  font-weight:900;
}

.felah-v5-category-card p{
  margin:0 0 16px;
  color:var(--muted);
}

.felah-v5-category-card .meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.felah-v5-category-card .meta span{
  min-height:34px;
  padding:0 18px;
  border-radius:999px;
  background:var(--soft);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  font-weight:900;
}

.felah-v5-lessons-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

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

.felah-v5-lesson-card strong{
  display:block;
  font-size:18px;
}

.felah-v5-lesson-card span{
  color:var(--muted);
  font-size:13px;
}

.felah-v5-lesson-card b{
  width:42px;
  height:42px;
  min-width:42px;
  border-radius:12px;
  background:var(--green2);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
}

.felah-v5-footer{
  height:44px;
  margin-top:8px;
  border-radius:10px;
  border:1px solid var(--line);
  background:var(--soft);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
}

.felah-v5-mobile-nav{display:none}

@media(max-width:1100px){
  .felah-v5-category-grid,
  .felah-v5-lessons-grid{
    grid-template-columns:1fr;
  }
}

@media(max-width:900px){
  /* Layout only — theme colors come from data-theme, so the user's
     light/dark choice is respected on mobile too. */
  .felah-v5-shell{
    display:block;
    padding-bottom:98px;
  }

  .felah-v5-sidebar{
    display:none;
  }

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

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

  .felah-v5-user-button{
    height:52px;
    border-radius:18px;
    font-size:14px;
  }

  .felah-v5-theme{
    width:52px;
    height:52px;
    border-radius:18px;
  }

  .felah-v5-search{
    grid-column:1 / -1;
    height:86px;
    border-radius:26px;
    padding:0 22px;
  }

  .felah-v5-search input{
    font-size:22px!important;
  }

  .felah-v5-hero{
    min-height:132px;
    border-radius:18px;
    margin-bottom:10px;
  }

  .felah-v5-hero h1{font-size:23px}
  .felah-v5-hero p{font-size:17px}

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

  .felah-v5-ad,
  .felah-v5-ad:first-child,
  .felah-v5-ad:last-child{
    height:94px;
    border-radius:14px;
    border:1px solid var(--line);
    font-size:18px;
  }

  .felah-v5-stage,
  .felah-v5-page-stage{
    border-radius:18px;
    padding:22px 16px;
    min-height:auto;
    margin-top:12px;
  }

  .felah-v5-head{
    margin-bottom:16px;
  }

  .felah-v5-head h1,
  .felah-v5-head h2{
    font-size:26px;
  }

  .felah-v5-small-btn{
    display:none;
  }

  .felah-v5-category-card{
    min-height:104px;
    border-radius:16px;
    grid-template-columns:58px minmax(0,1fr);
    gap:14px;
    padding:16px;
  }

  .felah-v5-category-card .icon{
    width:52px;
    height:52px;
    border-radius:14px;
    font-size:20px;
  }

  .felah-v5-category-card h3{
    font-size:20px;
  }

  .felah-v5-category-card p{
    font-size:13px;
  }

  .felah-v5-category-card .meta span{
    min-height:28px;
    padding:0 12px;
    font-size:12px;
  }

  .felah-v5-footer{
    display:none;
  }

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

  .felah-v5-mobile-nav a{
    flex:1;
    height:66px;
    border-radius:20px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:4px;
    color:var(--muted);
    font-size:13px;
    font-weight:900;
  }

  .felah-v5-mobile-nav a.active{
    background:var(--soft);
    color:var(--text);
  }

  .felah-v5-mobile-nav span{
    font-size:20px;
  }
}
