
/* ==========================================================================
   Homepage Compact V7.2
   الصفحة الرئيسية: شريط كورسات أفقي + Top 3 Podium فقط
   ========================================================================== */

#landing-page .courses-section{
  padding-top:44px;
  padding-bottom:38px;
}
#landing-page .courses-section > .section-title{margin-bottom:34px!important}
#landing-page .visitor-stage-block{
  margin-bottom:34px;
  position:relative;
}
#landing-page .visitor-stage-block:last-child{margin-bottom:0}
#landing-page .stage-heading-row{margin-bottom:13px}
#landing-page .stage-heading-row .stage-title{
  font-size:21px;
  padding-bottom:7px;
}
#landing-page .view-all-stage-btn{
  min-height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  white-space:nowrap;
}

/* الكورسات في الصفحة الرئيسية تظل أفقية مهما زاد عددها */
#landing-page .visitor-stage-block .courses-horizontal-scroll{
  display:flex!important;
  grid-template-columns:none!important;
  width:100%;
  gap:16px!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  padding:7px 4px 18px!important;
  scroll-snap-type:x mandatory;
  scroll-padding-inline:4px;
  overscroll-behavior-inline:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
  cursor:grab;
}
#landing-page .visitor-stage-block .courses-horizontal-scroll::-webkit-scrollbar{display:none}
#landing-page .visitor-stage-block .courses-horizontal-scroll.is-dragging{cursor:grabbing}
#landing-page .visitor-stage-block .course-card{
  flex:0 0 292px!important;
  width:292px!important;
  min-width:292px!important;
  max-width:292px!important;
  scroll-snap-align:start;
  scroll-snap-stop:normal;
}

/* إيحاء بصري بوجود كورسات أخرى للسحب */
#landing-page .visitor-stage-block::after{
  content:"";
  position:absolute;
  left:0;
  bottom:17px;
  width:34px;
  height:calc(100% - 52px);
  pointer-events:none;
  background:linear-gradient(90deg,var(--bg-color),transparent);
  opacity:.62;
  z-index:4;
}

/* ======================= Top 3 Podium ======================= */
#landing-page .home-leaderboard-section{padding:48px 5% 42px}
#landing-page .home-leaderboard-section .section-title{margin-bottom:24px!important}

#landing-page .home-top3-only{
  width:min(720px,100%);
  margin:22px auto 0!important;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
  grid-template-rows:auto auto;
  align-items:start!important;
  justify-items:center!important;
  gap:16px 22px!important;
  flex-wrap:initial!important;
}

/* الأول أعلى المنتصف */
#landing-page .home-top3-only .podium-card.rank-1{
  grid-column:1/-1;
  grid-row:1;
  width:min(270px,74vw)!important;
  max-width:270px!important;
  transform:none!important;
  z-index:3;
  margin-bottom:4px;
  border-width:2px;
  box-shadow:0 22px 46px rgba(245,158,11,.18),var(--shadow-sm)!important;
}

/* الثاني أسفل اليمين والثالث أسفل اليسار */
#landing-page .home-top3-only .podium-card.rank-2{
  grid-column:2;
  grid-row:2;
}
#landing-page .home-top3-only .podium-card.rank-3{
  grid-column:1;
  grid-row:2;
}
#landing-page .home-top3-only .podium-card.rank-2,
#landing-page .home-top3-only .podium-card.rank-3{
  width:min(230px,100%)!important;
  max-width:230px!important;
  transform:translateY(10px)!important;
}

#landing-page .home-top3-only .podium-card{
  margin:0!important;
  padding:24px 13px 17px!important;
  min-width:0!important;
}
#landing-page .home-top3-only .podium-card:hover{transform:translateY(-4px)!important}
#landing-page .home-top3-only .podium-card.rank-2:hover,
#landing-page .home-top3-only .podium-card.rank-3:hover{transform:translateY(5px)!important}
#landing-page .home-top3-only .podium-card.rank-1:hover{transform:translateY(-5px)!important}
#landing-page .home-top3-only .podium-name{max-width:100%}
#landing-page .home-top3-only .podium-medal{
  filter:drop-shadow(0 7px 12px rgba(15,23,42,.16));
}

@media(max-width:768px){
  #landing-page .courses-section{padding:30px 9px 26px!important}
  #landing-page .courses-section > .section-title{margin-bottom:24px!important}
  #landing-page .visitor-stage-block{margin-bottom:27px!important}

  #landing-page .stage-heading-row{
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
  }
  #landing-page .stage-heading-actions{flex:0 0 auto}
  #landing-page .drag-course-hint{display:none!important}
  #landing-page .stage-heading-row .stage-title{
    min-width:0;
    margin:0!important;
    font-size:17px!important;
    border-bottom-width:2px;
    white-space:nowrap;
  }
  #landing-page .view-all-stage-btn{
    width:auto!important;
    min-height:38px!important;
    padding:8px 10px!important;
    font-size:10px!important;
    border-radius:10px!important;
  }

  #landing-page .visitor-stage-block .courses-horizontal-scroll{
    gap:12px!important;
    padding:5px 5px 15px!important;
  }
  #landing-page .visitor-stage-block .course-card{
    flex-basis:min(78vw,292px)!important;
    width:min(78vw,292px)!important;
    min-width:min(78vw,292px)!important;
    max-width:min(78vw,292px)!important;
  }
  #landing-page .visitor-stage-block .course-thumb{height:155px!important}

  #landing-page .home-leaderboard-section{padding:34px 11px 33px!important}
  #landing-page .home-top3-only{
    width:100%;
    gap:12px 10px!important;
    margin-top:18px!important;
  }
  #landing-page .home-top3-only .podium-card.rank-1{
    width:min(230px,72vw)!important;
    max-width:230px!important;
  }
  #landing-page .home-top3-only .podium-card.rank-2,
  #landing-page .home-top3-only .podium-card.rank-3{
    width:100%!important;
    max-width:180px!important;
  }
  #landing-page .home-top3-only .podium-card{
    padding:22px 9px 14px!important;
    border-radius:17px!important;
  }
  #landing-page .home-top3-only .podium-img{
    width:58px!important;
    height:58px!important;
    margin:11px auto 8px!important;
  }
  #landing-page .home-top3-only .rank-1 .podium-img{
    width:74px!important;
    height:74px!important;
  }
  #landing-page .home-top3-only .podium-medal{
    font-size:34px!important;
    top:-22px!important;
  }
  #landing-page .home-top3-only .rank-1 .podium-medal{
    font-size:45px!important;
    top:-29px!important;
  }
  #landing-page .home-top3-only .podium-name{font-size:14px!important}
  #landing-page .home-top3-only .podium-pts{
    font-size:13px!important;
    padding:4px 10px!important;
  }
}

@media(max-width:430px){
  /* كارت كامل تقريبًا + جزء ظاهر من الكارت التالي ليشجع السحب */
  #landing-page .visitor-stage-block .course-card{
    flex-basis:82vw!important;
    width:82vw!important;
    min-width:82vw!important;
    max-width:82vw!important;
  }
  #landing-page .stage-heading-row .stage-title{font-size:15px!important}
  #landing-page .view-all-stage-btn{padding-inline:8px!important}

  #landing-page .home-top3-only{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:11px 8px!important;
  }
  #landing-page .home-top3-only .podium-card.rank-2,
  #landing-page .home-top3-only .podium-card.rank-3{max-width:160px!important}
}

@media(max-width:360px){
  #landing-page .stage-heading-row{align-items:flex-start!important}
  #landing-page .stage-heading-row .stage-title{font-size:14px!important}
  #landing-page .view-all-stage-btn{
    font-size:0!important;
    width:38px!important;
    min-width:38px!important;
    padding:0!important;
  }
  #landing-page .view-all-stage-btn i{font-size:13px!important}
  #landing-page .home-top3-only .podium-card.rank-2,
  #landing-page .home-top3-only .podium-card.rank-3{max-width:145px!important}
}


/* ==========================================================================
   Homepage Compact V7.3 — Course action proportions fix
   ========================================================================== */

/* Paid/free label should stay readable */
#landing-page .course-card .course-badge{
  font-size:13px!important;
  line-height:1.2!important;
  padding:7px 13px!important;
  min-height:30px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  letter-spacing:0!important;
  border-radius:999px!important;
}

/* First line: content button */
#landing-page .course-card .course-actions > .primary-btn.full-width{
  width:100%!important;
  min-height:45px!important;
  font-size:14px!important;
}

/* Second line: Subscribe fills the row, Share stays compact */
#landing-page .course-card .course-actions > div{
  width:100%!important;
  display:flex!important;
  align-items:stretch!important;
  gap:8px!important;
  margin-top:5px!important;
}

#landing-page .course-card .course-actions > div > .primary-btn:not([title="مشاركة الكورس"]){
  flex:1 1 auto!important;
  width:auto!important;
  min-width:0!important;
  min-height:46px!important;
  padding:10px 12px!important;
  font-size:14px!important;
  white-space:nowrap!important;
}

/* Compact share icon button */
#landing-page .course-card .course-actions button[title="مشاركة الكورس"]{
  flex:0 0 46px!important;
  width:46px!important;
  min-width:46px!important;
  max-width:46px!important;
  height:46px!important;
  min-height:46px!important;
  padding:0!important;
  display:inline-grid!important;
  place-items:center!important;
  border-radius:12px!important;
  font-size:0!important;
}

#landing-page .course-card .course-actions button[title="مشاركة الكورس"] i{
  font-size:16px!important;
  line-height:1!important;
  margin:0!important;
}

/* If the user is already subscribed and only Share remains, keep it at the edge */
#landing-page .course-card .course-actions > div:has(button[title="مشاركة الكورس"]:only-child){
  justify-content:flex-end!important;
}

@media(max-width:430px){
  #landing-page .course-card .course-badge{
    font-size:12px!important;
    padding:6px 11px!important;
    min-height:28px!important;
    top:10px!important;
    right:10px!important;
  }

  #landing-page .course-card .course-actions > div > .primary-btn:not([title="مشاركة الكورس"]){
    font-size:13px!important;
  }

  #landing-page .course-card .course-actions button[title="مشاركة الكورس"]{
    flex-basis:44px!important;
    width:44px!important;
    min-width:44px!important;
    max-width:44px!important;
    height:44px!important;
    min-height:44px!important;
  }

  #landing-page .course-card .course-actions button[title="مشاركة الكورس"] i{
    font-size:15px!important;
  }
}


/* ==========================================================================
   Homepage / Navbar V7.4
   إصلاح تداخل الوضع الليلي + زر واضح للرجوع للصفحة الرئيسية
   ========================================================================== */

.student-home-nav-btn{
  border:1px solid var(--border-color);
  background:var(--bg-color-alt);
  color:var(--text-dark);
  border-radius:14px;
  min-height:44px;
  padding:8px 13px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  font-family:'Cairo',sans-serif;
  font-weight:900;
  cursor:pointer;
  transition:var(--transition);
  flex:0 0 auto;
}
.student-home-nav-btn:hover{
  color:var(--main-theme);
  border-color:var(--main-theme);
  background:var(--main-theme-light);
}
.student-platform-home-link{
  color:var(--main-theme)!important;
  background:var(--main-theme-light)!important;
  border:1px solid color-mix(in srgb,var(--main-theme) 20%,transparent)!important;
}

/* Ensure the navbar always has two non-overlapping zones */
@media(max-width:768px){
  .main-navbar,
  html[data-platform-theme="modern"] .main-navbar,
  html[data-platform-theme="academy"] .main-navbar,
  html[data-platform-theme="minimal"] .main-navbar,
  html[data-platform-theme="premium"] .main-navbar,
  html[data-platform-theme="girls"] .main-navbar,
  html[data-platform-theme="action"] .main-navbar,
  html[data-platform-theme="horror"] .main-navbar{
    width:100%!important;
    max-width:100%!important;
    min-height:62px!important;
    margin:0!important;
    border-radius:0!important;
    padding:8px 10px!important;
    display:grid!important;
    grid-template-columns:minmax(72px,1fr) auto!important;
    align-items:center!important;
    gap:8px!important;
    overflow:visible!important;
  }

  .main-navbar .logo{
    grid-column:1!important;
    min-width:0!important;
    max-width:100%!important;
    width:auto!important;
    overflow:hidden!important;
    position:relative!important;
    z-index:1!important;
  }
  .main-navbar .logo h2{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .main-navbar .nav-actions{
    grid-column:2!important;
    min-width:0!important;
    width:auto!important;
    max-width:none!important;
    display:flex!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:6px!important;
    position:relative!important;
    z-index:3!important;
  }

  /* Theme toggle must stay inside actions – never over logo */
  .main-navbar .theme-toggle,
  html[data-platform-theme] .main-navbar .theme-toggle{
    position:static!important;
    inset:auto!important;
    transform:none!important;
    float:none!important;
    flex:0 0 40px!important;
    width:40px!important;
    min-width:40px!important;
    max-width:40px!important;
    height:40px!important;
    min-height:40px!important;
    padding:0!important;
    margin:0!important;
    display:grid!important;
    place-items:center!important;
    font-size:16px!important;
    z-index:auto!important;
  }
  .main-navbar .theme-toggle:hover{
    transform:none!important;
  }

  #user-profile-menu{
    display:none;
    min-width:0!important;
    gap:5px!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
  }
  #user-profile-menu[style*="display: flex"],
  #user-profile-menu[style*="display:flex"]{
    display:flex!important;
  }

  .student-home-nav-btn,
  .student-dashboard-nav-btn{
    flex:0 0 40px!important;
    width:40px!important;
    min-width:40px!important;
    max-width:40px!important;
    height:40px!important;
    min-height:40px!important;
    padding:0!important;
    border-radius:12px!important;
    display:grid!important;
    place-items:center!important;
    font-size:0!important;
  }
  .student-home-nav-btn i,
  .student-dashboard-nav-btn i{
    font-size:15px!important;
    margin:0!important;
  }
  .student-home-nav-btn span,
  .student-dashboard-nav-btn span{
    display:none!important;
  }

  /* Profile image is decorative on very small navbar; details remain in student panel */
  #user-profile-menu .profile-img{
    width:38px!important;
    height:38px!important;
    min-width:38px!important;
    flex:0 0 38px!important;
  }
  #user-profile-menu .logout-btn-small{
    width:40px!important;
    height:40px!important;
    min-width:40px!important;
    flex:0 0 40px!important;
  }
}

@media(max-width:430px){
  .main-navbar,
  html[data-platform-theme] .main-navbar{
    padding-inline:7px!important;
    grid-template-columns:minmax(62px,1fr) auto!important;
    gap:5px!important;
  }

  .main-navbar .nav-actions{
    gap:4px!important;
  }

  /* Save horizontal space after login */
  #user-profile-menu .profile-img{
    display:none!important;
  }

  .main-navbar .theme-toggle,
  html[data-platform-theme] .main-navbar .theme-toggle,
  .student-home-nav-btn,
  .student-dashboard-nav-btn,
  #user-profile-menu .logout-btn-small{
    width:38px!important;
    min-width:38px!important;
    max-width:38px!important;
    height:38px!important;
    min-height:38px!important;
    flex-basis:38px!important;
  }
}

@media(max-width:360px){
  .main-navbar .logo h2{
    font-size:13px!important;
  }

  /* For visitors, keep auth actions compact enough to never push over logo */
  #auth-buttons{
    gap:4px!important;
    flex-wrap:nowrap!important;
  }
  #auth-buttons .primary-btn{
    min-height:38px!important;
    padding:6px 7px!important;
    font-size:10px!important;
  }
}


/* ==========================================================================
   Homepage Compact V7.5
   لوحة شرف أصغر + زر وضع مستقل لا يغطي أي عنصر
   ========================================================================== */

/* زر الوضع الجديد مخفي على الشاشات الكبيرة */
.mobile-theme-dock{
  display:none;
}

/* -------------------- Compact Home Champions -------------------- */
#landing-page .home-leaderboard-section{
  padding:24px 4% 25px!important;
  min-height:0!important;
}

#landing-page .home-leaderboard-section .section-title{
  margin-bottom:8px!important;
  padding:0 8px!important;
}

#landing-page .home-leaderboard-section .section-title h2{
  font-size:clamp(20px,3.2vw,28px)!important;
  margin-bottom:3px!important;
  line-height:1.25!important;
}

#landing-page .home-leaderboard-section .section-title p{
  font-size:12px!important;
  line-height:1.6!important;
  margin:0!important;
}

#landing-page .home-top3-only{
  width:min(510px,100%)!important;
  margin:12px auto 0!important;
  gap:8px 12px!important;
}

/* الأول */
#landing-page .home-top3-only .podium-card.rank-1{
  width:min(185px,58vw)!important;
  max-width:185px!important;
  padding:17px 9px 11px!important;
  margin:0!important;
  border-radius:15px!important;
  box-shadow:0 11px 24px rgba(245,158,11,.13),var(--shadow-sm)!important;
}

/* الثاني والثالث */
#landing-page .home-top3-only .podium-card.rank-2,
#landing-page .home-top3-only .podium-card.rank-3{
  width:min(150px,100%)!important;
  max-width:150px!important;
  padding:15px 8px 10px!important;
  border-radius:14px!important;
  transform:translateY(4px)!important;
}

#landing-page .home-top3-only .podium-img{
  width:44px!important;
  height:44px!important;
  margin:7px auto 5px!important;
  border-width:2px!important;
}

#landing-page .home-top3-only .rank-1 .podium-img{
  width:56px!important;
  height:56px!important;
  margin:9px auto 6px!important;
}

#landing-page .home-top3-only .podium-medal{
  font-size:25px!important;
  top:-15px!important;
}

#landing-page .home-top3-only .rank-1 .podium-medal{
  font-size:34px!important;
  top:-21px!important;
}

#landing-page .home-top3-only .podium-name{
  font-size:12px!important;
  line-height:1.4!important;
  margin-bottom:4px!important;
}

#landing-page .home-top3-only .podium-stage{
  font-size:9px!important;
  line-height:1.35!important;
  margin-bottom:5px!important;
}

#landing-page .home-top3-only .podium-pts{
  font-size:10px!important;
  line-height:1.2!important;
  padding:3px 8px!important;
  border-radius:999px!important;
}

#landing-page .home-top3-only .podium-card:hover,
#landing-page .home-top3-only .podium-card.rank-1:hover,
#landing-page .home-top3-only .podium-card.rank-2:hover,
#landing-page .home-top3-only .podium-card.rank-3:hover{
  transform:translateY(-2px)!important;
}

/* -------------------- Mobile appearance dock -------------------- */
@media(max-width:768px){

  /* إخفاء الزر الأصلي من الهيدر على الهاتف لمنع أي تزاحم نهائي */
  .main-navbar .theme-toggle,
  html[data-platform-theme] .main-navbar .theme-toggle{
    display:none!important;
  }

  .mobile-theme-dock{
    display:flex!important;
    width:100%;
    min-height:38px;
    padding:6px 10px 0;
    justify-content:flex-start;
    align-items:center;
    background:transparent;
    position:relative;
    z-index:20;
    pointer-events:none;
  }

  .mobile-theme-dock-btn{
    pointer-events:auto;
    min-height:34px!important;
    height:34px!important;
    padding:0 11px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:6px!important;
    border-radius:999px!important;
    border:1px solid var(--border-color)!important;
    background:var(--card-bg)!important;
    color:var(--text-dark)!important;
    box-shadow:0 5px 16px rgba(15,23,42,.08)!important;
    font-family:'Cairo',sans-serif!important;
    font-size:11px!important;
    font-weight:900!important;
    transition:var(--transition)!important;
  }

  .mobile-theme-dock-btn i{
    font-size:13px!important;
    color:var(--main-theme)!important;
    margin:0!important;
  }

  .mobile-theme-dock-btn span{
    font-size:11px!important;
    font-weight:900!important;
  }

  .mobile-theme-dock-btn:active{
    transform:scale(.96);
  }

  /* المزيد من تقليل مساحة الأبطال على الهاتف */
  #landing-page .home-leaderboard-section{
    padding:20px 8px 22px!important;
  }

  #landing-page .home-leaderboard-section .section-title{
    margin-bottom:6px!important;
  }

  #landing-page .home-leaderboard-section .section-title h2{
    font-size:20px!important;
  }

  #landing-page .home-leaderboard-section .section-title p{
    font-size:10px!important;
  }

  #landing-page .home-top3-only{
    width:min(410px,100%)!important;
    margin-top:10px!important;
    gap:7px 8px!important;
  }

  #landing-page .home-top3-only .podium-card.rank-1{
    width:min(165px,55vw)!important;
    max-width:165px!important;
    padding:15px 8px 10px!important;
  }

  #landing-page .home-top3-only .podium-card.rank-2,
  #landing-page .home-top3-only .podium-card.rank-3{
    width:100%!important;
    max-width:132px!important;
    padding:13px 6px 9px!important;
  }

  #landing-page .home-top3-only .podium-img{
    width:40px!important;
    height:40px!important;
    margin:6px auto 4px!important;
  }

  #landing-page .home-top3-only .rank-1 .podium-img{
    width:51px!important;
    height:51px!important;
  }

  #landing-page .home-top3-only .podium-medal{
    font-size:22px!important;
    top:-13px!important;
  }

  #landing-page .home-top3-only .rank-1 .podium-medal{
    font-size:31px!important;
    top:-19px!important;
  }

  #landing-page .home-top3-only .podium-name{
    font-size:11px!important;
  }

  #landing-page .home-top3-only .podium-stage{
    font-size:8px!important;
  }

  #landing-page .home-top3-only .podium-pts{
    font-size:9px!important;
    padding:3px 6px!important;
  }
}

@media(max-width:430px){
  .mobile-theme-dock{
    min-height:34px;
    padding:5px 8px 0;
  }

  .mobile-theme-dock-btn{
    min-height:31px!important;
    height:31px!important;
    padding:0 9px!important;
  }

  #landing-page .home-leaderboard-section{
    padding-top:17px!important;
    padding-bottom:18px!important;
  }

  #landing-page .home-top3-only{
    width:min(350px,100%)!important;
    gap:6px 7px!important;
  }

  #landing-page .home-top3-only .podium-card.rank-1{
    width:min(145px,48vw)!important;
    max-width:145px!important;
  }

  #landing-page .home-top3-only .podium-card.rank-2,
  #landing-page .home-top3-only .podium-card.rank-3{
    max-width:112px!important;
  }

  #landing-page .home-top3-only .podium-img{
    width:35px!important;
    height:35px!important;
  }

  #landing-page .home-top3-only .rank-1 .podium-img{
    width:45px!important;
    height:45px!important;
  }

  #landing-page .home-top3-only .podium-name{
    font-size:10px!important;
  }
}

@media(max-width:360px){
  #landing-page .home-top3-only .podium-card.rank-2,
  #landing-page .home-top3-only .podium-card.rank-3{
    max-width:102px!important;
  }
}
