:root{
  --text:#fff;
  --muted: rgba(255,255,255,.85);
  --muted2: rgba(255,255,255,.65);

  --topbar-h: 56px;
  --bottomnav-h: 64px;

  --bg: #1c1c1c;
  --sheet: rgba(11,15,20,.96);
  --stroke: rgba(255,255,255,.10);
}

/* reset */
*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  background: var(--bg);
  color:var(--text);
  overflow:hidden;

  font-family:
    IRANYekan,
    "IRANYekanX",
    YekanBakh,
    "Yekan Bakh",
    Vazirmatn,
    "Vazirmatn",
    system-ui, -apple-system, Segoe UI, Roboto, Arial;

  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
}

/* ✅ Explore-like background layer */
body::before{
  content:"";
  position:fixed;
  inset:0;
  background-image:url("./assets/bg/bg.png");
  background-repeat:no-repeat;
  background-position:center center;
  background-size:cover;
  opacity:1;
  pointer-events:none;
  z-index:0;
}

.igTop, .reels-stage, .drawer, .toast, .bottomNav{ position:relative; z-index:1; }

/* =========================
   Top bar (IG-ish + logo centered)
========================= */
.igTop{
  position:fixed;
  top:0; left:0; right:0;
  z-index:60;

  height: var(--topbar-h);
  padding:
    calc(6px + env(safe-area-inset-top))
    14px
    8px
    14px;

  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:end;

  background: linear-gradient(to bottom, rgba(0,0,0,.70), rgba(0,0,0,0));
  pointer-events:none;
}

.igTopLeft,
.igTopRight{ height: 40px; }

.igTopCenter{
  display:flex;
  align-items:center;
  justify-content:center;
  height:40px;
}

.igLogo{
  height: 26px;
  max-width: 64vw;
  object-fit: contain;
  filter: drop-shadow(0 10px 25px rgba(0,0,0,.55));
  user-select:none;
  -webkit-user-drag:none;
}

/* =========================
   Stage + Swiper
========================= */
.reels-stage{
  position:fixed;
  inset:0;
  overflow:hidden;
}

/* Mobile default: full-screen reels */
.reels{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
}

.swiper-slide{
  position:relative;
  height:100vh;
  background:#000;
  overflow:hidden;
}

.video{
  width:100%;
  height:100%;
  object-fit:cover;
  background:#000;
  display:block;
}

/* Double-tap heart burst */
.tapHeart{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%) scale(.4);
  opacity:0;
  z-index:25;
  pointer-events:none;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,.45));
}
.tapHeart i{ font-size:86px; color:#ff2d55; }
.tapHeart.show{ animation: heartPop .62s ease-out forwards; }
@keyframes heartPop{
  0%{opacity:0; transform:translate(-50%,-50%) scale(.35)}
  20%{opacity:1; transform:translate(-50%,-50%) scale(1.05)}
  60%{opacity:1; transform:translate(-50%,-50%) scale(.95)}
  100%{opacity:0; transform:translate(-50%,-55%) scale(.8)}
}

/* IG gradients */
.overlayTop{
  position:absolute; top:0; left:0; right:0;
  height:22vh;
  background:linear-gradient(to bottom, rgba(0,0,0,.55), rgba(0,0,0,0));
  pointer-events:none;
  z-index:2;
}
.overlayBottom{
  position:absolute; left:0; right:0; bottom:0;
  height:40vh;
  background:linear-gradient(to top, rgba(0,0,0,.70), rgba(0,0,0,0));
  pointer-events:none;
  z-index:2;
}

/* =========================
   Right Action Rail (IG style)
========================= */
.actions{
  position:absolute;
  right:10px;
  bottom:110px;
  z-index:5;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:18px;
}

.actionBtn{
  border:0;
  background:transparent;
  color:#fff;
  cursor:pointer;
  padding:0;
  line-height:1;
  text-shadow: 0 2px 10px rgba(0,0,0,.55);
}
.actionBtn i{ font-size:26px; }

.actionCount{
  margin-top:6px;
  font-size:12px;
  font-weight:800;
  color:#fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}

.actionGroup{
  display:flex;
  flex-direction:column;
  align-items:center;
}

.liked i{ color:#ff2d55; }
.saved i{ color:#ffd166; }

.profileCircle{
  width:44px; height:44px;
  border-radius:999px;
  border:2px solid #fff;
  overflow:hidden;
  background: rgba(255,255,255,.12);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.profileCircle i{ font-size:20px; }

.musicDisc{
  width:44px; height:44px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.25);
  position:relative;
  overflow:hidden;
}
.musicDisc::after{
  content:"";
  position:absolute; inset:0;
  background: conic-gradient(from 90deg, rgba(255,255,255,.20), rgba(0,0,0,0), rgba(255,255,255,.20));
  animation: spin 2.6s linear infinite;
  opacity:.8;
}
@keyframes spin{to{transform:rotate(360deg)}}

/* =========================
   Left Meta (IG vibe)
========================= */
.meta{
  position:absolute;
  left:12px;
  right:78px;
  bottom:98px;
  z-index:5;
  display:flex;
  flex-direction:column;
  gap:10px;
  text-shadow: 0 2px 12px rgba(0,0,0,.65);
}

.userRow{
  display:flex;
  align-items:center;
  gap:10px;
}
.userAvatar{
  width:32px; height:32px;
  border-radius:999px;
  background: rgba(255,255,255,.18);
  border:1px solid rgba(255,255,255,.22);
}
.username{ font-weight:900; font-size:13px; }
.followBtn{
  margin-right:6px;
  padding:7px 12px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.35);
  background:transparent;
  color:#fff;
  font-weight:900;
  cursor:pointer;
  font-size:12px;
}

.caption{
  font-size:13px;
  line-height:1.6;
  color: rgba(255,255,255,.95);
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}
.moreBtn{
  display:inline;
  margin-right:6px;
  color: rgba(255,255,255,.85);
  font-weight:900;
  cursor:pointer;
}

.audioRow{
  display:flex;
  align-items:center;
  gap:8px;
  color: rgba(255,255,255,.85);
  font-size:12px;
  opacity:.95;
}
.audioRow i{ font-size:12px; }

/* Progress bar */
.progress{
  position:absolute;
  left:0; right:0;
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  height:2px;
  background: rgba(255,255,255,.20);
  z-index:6;
}
.progress > div{
  height:100%;
  width:0%;
  background:#fff;
}

/* Toast */
.toast{
  position:fixed;
  left:50%;
  bottom: calc(var(--bottomnav-h) + 32px + env(safe-area-inset-bottom));
  transform:translateX(-50%);
  padding:10px 12px;
  border-radius:12px;
  background:rgba(0,0,0,.55);
  border:1px solid rgba(255,255,255,.12);
  color:#fff;
  font-size:12px;
  opacity:0;
  transition:opacity .2s ease;
  z-index:220;
  pointer-events:none;
}
.toast.show{opacity:1}

/* =========================
   Drawer
========================= */
.drawer{ position:fixed; inset:0; z-index:210; display:none; }
.drawer.open{display:block}

.drawerBackdrop{
  position:absolute; inset:0;
  background:rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index:0;
  pointer-events:auto;
}

.drawerSheet{
  position:absolute;
  left:0; right:0;
  bottom:0;
  height:70vh;
  background: var(--sheet);
  border-top: 1px solid var(--stroke);
  border-radius: 22px 22px 0 0;
  padding:12px 14px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:1;
  pointer-events:auto;
}

.drawerTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.drawerTitle{font-weight:950}

.drawerClose{
  width:42px; height:42px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  color:#fff;
  cursor:pointer;
}

.comments{
  overflow:auto;
  padding:6px 0;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.comment{
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.cAvatar{
  width:32px; height:32px;
  border-radius:999px;
  background: rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.10);
}
.cBody{flex:1}
.cName{font-weight:900; font-size:12px}
.cText{color:rgba(255,255,255,.72); font-size:12px; line-height:1.6}

.composer{
  display:flex;
  gap:10px;
  align-items:center;
  padding-top:6px;
  border-top:1px solid rgba(255,255,255,.08);
}
.composerInput{
  flex:1;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  color:#fff;
  outline:none;
}
.composerBtn{
  width:48px; height:48px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.08);
  color:#fff;
  cursor:pointer;
}

/* =========================================================
   MOBILE BOTTOM NAV — same capsule as Explore (icons SVG)
   - no active halo (clean)
========================================================= */
@media (max-width:979px){

  .bottomNav{
    position:fixed;
    left:0; right:0; bottom:0;

    height: calc(92px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);

    display:flex;
    justify-content:center;
    align-items:center;

    padding-left: 16px;
    padding-right: 16px;

    gap: 14px;

    background:transparent !important;
    border:0 !important;
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;

    z-index:200;
  }

  .bottomNav::before{
    content:"";
    position:absolute;
    left:24px;
    right:24px;
    bottom: calc(14px + env(safe-area-inset-bottom));

    height:64px;
    border-radius:999px;

    background: rgba(190,190,190,.72);
    border:1px solid rgba(255,255,255,.35);

    box-shadow:0 20px 55px rgba(0,0,0,.55);
    backdrop-filter:blur(16px);
    -webkit-backdrop-filter:blur(16px);

    z-index:0;
  }

  .bottomNav::after{ content:none !important; }

  .bottomNav .tab{
    position:relative;
    z-index:2;

    width:56px;
    height:56px;
    border-radius:18px;

    display:flex;
    align-items:center;
    justify-content:center;

    text-decoration:none;

    overflow:hidden;
    transition: background .16s ease, box-shadow .16s ease;
  }

  .bottomNav .tab:first-child{ margin-right: 10px; }
  .bottomNav .tab:last-child{  margin-left:  10px; }

  .bottomNav .navIco{
    width:28px;
    height:28px;
    display:block;
    object-fit:contain;
    opacity:.96;
    transition: opacity .16s ease, filter .16s ease;
    filter: drop-shadow(0 8px 14px rgba(0,0,0,.25));
  }

  .bottomNav .tab[href*="favorites"] .navIco{
    width:26px;
    height:26px;
  }

  .bottomNav .tab:hover{
    background: rgba(255,255,255,.12);
    box-shadow: 0 8px 18px rgba(0,0,0,.26);
  }
  .bottomNav .tab:hover .navIco{
    opacity: 1;
    filter: drop-shadow(0 10px 16px rgba(0,0,0,.30));
  }

  /* ✅ active = فقط tint خیلی سبک (بدون halo/border) */
  .bottomNav .tab.active:not(.tabCenter){
    background: rgba(255,255,255,.08);
    border: none;
    box-shadow: none;
  }

  .bottomNav .tabCenter{
    width:72px;
    height:72px;
    border-radius:999px;

    transform: translateY(-22px);

    background:#ff5b2e !important;
    border:1px solid rgba(255,255,255,.45);

    box-shadow:
      0 18px 45px rgba(0,0,0,.62),
      0 0 0 10px rgba(255,91,46,.23);

    overflow: visible;
    transition: transform .16s ease, box-shadow .16s ease;
  }

  .bottomNav .tabCenter:hover{
    transform: translateY(-23px);
    box-shadow:
      0 18px 45px rgba(0,0,0,.64),
      0 0 0 10px rgba(255,91,46,.25);
  }

  .bottomNav .navIcoCenter{
    width:32px;
    height:32px;
    filter: drop-shadow(0 10px 16px rgba(0,0,0,.35));
  }
}

/* =========================
   Desktop: true center card (9:16) + halo blur
========================= */
@media (min-width: 900px) {

  /* keep Explore bg (do NOT override body background here) */

  .reels-stage{
    display:flex;
    align-items:center;
    justify-content:center;
    padding-top: var(--topbar-h);
    padding-bottom: var(--bottomnav-h);
  }

  .reels-stage::before{
    content:"";
    position:absolute;
    inset:-20%;
    z-index:0;
    background: linear-gradient(120deg,
      rgba(80,120,255,.25),
      rgba(180,80,255,.22),
      rgba(40,200,160,.18)
    );
    filter: blur(120px);
    opacity:.55;
    pointer-events:none;
  }

  .reels{
    position:relative;
    z-index:2;

    width: min(440px, 92vw);
    aspect-ratio: 9 / 16;
    height: auto;
    max-height: calc(100vh - (var(--topbar-h) + var(--bottomnav-h) + 36px));

    border-radius: 26px;
    overflow:hidden;
    background:#000;

    box-shadow:
      0 30px 90px rgba(0,0,0,.60),
      0 0 0 1px rgba(255,255,255,.10);
  }

  .swiper-slide{ height:100%; }
  .video{ height:100%; }
}

/* Small phones polish */
@media (max-width: 380px){
  .actionBtn i{ font-size:26px; }
  .actions{ right:8px; gap:16px; }
  .meta{ left:10px; right:74px; }
  .igLogo{ height:24px; }
}

/* =========================================================
   MOBILE: lift overlays above the new capsule bottom nav
========================================================= */
@media (max-width:979px){

  /* این مقدار فاصله امن از پایین (کپسول + کمی نفس) */
  :root{
    --uiSafeBottom: 190px; /* اگه خواستی بیشتر/کمتر، همین عدد رو تغییر بده */
  }

  /* Right action rail */
  .actions{
    bottom: var(--uiSafeBottom) !important;
  }

  /* Left meta (username/caption/audio) */
  .meta{
    bottom: calc(var(--uiSafeBottom) - 12px) !important;
  }

  /* Progress bar */
  .progress{
    bottom: calc(var(--uiSafeBottom) - 6px) !important;
  }

  /* Toast */
  .toast{
    bottom: calc(var(--uiSafeBottom) + 18px) !important;
  }
}




/* =========================
   Desktop: use Explore sidebar, hide mobile bottom nav
========================= */
@media (min-width:980px){

  /* ✅ Hide bottom nav on desktop (reels page) */
  .bottomNav{ display:none !important; }

  /* ✅ Show sidebar on desktop */
  .sideNav{ display:flex !important; }

  /* فضای محتوا کنار سایدبار */
  .reels-stage{
    margin-right: 350px; /* 310 sidebar + gaps */
  }

  /* اگر سایدبار collapsed شد، فضا کمتر */
  .sideNav.collapsed ~ .reels-stage{
    margin-right: 132px; /* 92 + gaps */
  }

  /* دسکتاپ: body پدینگ پایین نیاز نداره */
  body{ padding-bottom: 0 !important; }
}

/* =========================
   Mobile: hide sidebar, keep bottom nav
========================= */
@media (max-width:979px){

  .sideNav{ display:none !important; }
  .bottomNav{ display:flex !important; }
}

/* =========================================================
   Sidebar glass style (copied from Explore so reels matches)
========================================================= */
@media (min-width:980px){

  .sideNav{
    position: fixed;
    top: 18px;
    right: 18px;
    bottom: 18px;

    width: 310px;
    border-radius: 26px;

    background: rgba(12,13,16,.38);
    border: 1px solid rgba(255,255,255,.12);

    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);

    box-shadow: 0 30px 90px rgba(0,0,0,.55);
    z-index: 60;

    padding: 18px 16px;
    display: flex;
    flex-direction: column;
  }

  .sideTop{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding-bottom:16px;
    border-bottom:1px solid rgba(255,255,255,.08);
  }

  .sideLogo{
    display:flex;
    align-items:center;
    justify-content:flex-start;
    text-decoration:none;
  }

  .sideLogo img{
    height:46px;
    width:auto;
    display:block;
    object-fit:contain;
  }

  .sideToggle{
    width:40px;
    height:40px;
    border-radius:12px;
    background:#753131;
    border: 1px solid rgba(255,255,255,.12);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    box-shadow:0 10px 25px rgba(0,0,0,.35);
    transition: transform .15s ease;
  }
  .sideToggle:hover{ transform:scale(1.05); }

  .sideMenu{
    margin-top: 12px;
    display:flex;
    flex-direction: column;
    gap: 10px;
  }

  .sideGroupTitle{
    margin: 6px 6px 2px;
    font-size: 11px;
    color: rgba(242,244,248,.65);
    font-weight: 800;
  }

  .sideItem{
    position: relative;
    display:flex;
    align-items:center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 18px;
    text-decoration:none;
    color: #f2f4f8;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.10);
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
  }
  .sideItem:hover{
    transform: translateY(-1px);
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.16);
  }
  .sideItem.active{
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.20);
  }

  .sideIconBox{
    width: 35px;
    height: 35px;
    border-radius: 12px;
    background: #753131;
    display:flex;
    align-items:center;
    justify-content:center;
    flex: 0 0 35px;
    box-shadow: 0 10px 24px rgba(0,0,0,.35);
  }
  .sideIconBox i{
    font-size: 16px;
    color: #fff;
  }

  .sideLbl{
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .1px;
  }

  .sideBadge{
    margin-right: auto;
    font-size: 10px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    color: rgba(242,244,248,.85);
  }

  .sideDivider{
    height: 1px;
    background: rgba(255,255,255,.10);
    margin: 8px 6px;
  }

  .sideBottom{
    margin-top: auto;
    padding-top: 12px;
    text-align:center;
    opacity: .9;
  }
  .sideBottom .tiny{
    font-size: 11px;
    color: rgba(242,244,248,.65);
  }

  /* Collapsed */
  .sideNav.collapsed{ width:92px; }
  .sideNav.collapsed .sideLbl,
  .sideNav.collapsed .sideBadge,
  .sideNav.collapsed .sideGroupTitle{ display:none; }
  .sideNav.collapsed .sideMenu{ align-items:center; }
  .sideNav.collapsed .sideItem{ justify-content:center; }
  .sideNav.collapsed .sideTop{
    justify-content:center;
    gap:10px;
    padding-bottom:16px;
    flex-direction:column;
  }
  .sideNav.collapsed #sideToggle{
    display:flex;
    width:38px;
    height:38px;
  }
  .sideNav.collapsed .sideLogo img{
    height:42px;
    width:42px;
  }
}

/* =========================================================
   Desktop Sidebar: perfect containment + scrollable menu
========================================================= */
@media (min-width:980px){

  .sideNav{
    overflow: hidden !important;      /* هیچ چیزی بیرون نزنه */
  }

  .sideMenu{
    flex: 1 1 auto !important;        /* کل فضای وسط رو بگیره */
    min-height: 0 !important;         /* برای اینکه overflow کار کنه */
    overflow-y: auto !important;      /* ✅ اسکرول */
    overflow-x: hidden !important;
    padding-bottom: 10px !important;
  }

  /* اسکرول بار تمیز (اختیاری، خیلی مینیمال) */
  .sideMenu::-webkit-scrollbar{ width: 6px; }
  .sideMenu::-webkit-scrollbar-thumb{
    background: rgba(255,255,255,.18);
    border-radius: 999px;
  }
  .sideMenu::-webkit-scrollbar-track{
    background: transparent;
  }

  .sideBottom{
    flex: 0 0 auto !important;        /* همیشه ته کانتینر */
  }
}


@media (min-width:980px){
  .igTopCenter{ display:none !important; }
}


/* =========================================================
   Desktop Sidebar: scrollable but NO visible scrollbar
========================================================= */
@media (min-width:980px){

  .sideNav{ overflow: hidden !important; }

  .sideMenu{
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;   /* ✅ اسکرول فعال */
    overflow-x: hidden !important;
    padding-bottom: 10px !important;

    /* ✅ مخفی کردن اسکرول‌بار در Firefox */
    scrollbar-width: none !important;
  }

  /* ✅ مخفی کردن اسکرول‌بار در Chrome/Edge/Safari */
  .sideMenu::-webkit-scrollbar{
    width: 0 !important;
    height: 0 !important;
    display: none !important;
  }

  .sideBottom{ flex: 0 0 auto !important; }
}
