/* Masir Unified Shell — site-wide RTL sidebar (Morshed-exact metrics, Masir tokens).
   Enqueued on every front-end page; depends on `masir-brand` (tokens).
   Desktop (>=1024px): fixed 256px sidebar on the inline-end (right) edge; #wrap offset.
   Mobile (<=1023px): off-canvas drawer + fixed topbar (burger) + backdrop; no offset.
   Single breakpoint = 1024/1023. */

/* ----- Sidebar ----- */
.masir-shell {
  position: fixed;
  inset-block: 0;
  right: 0; left: auto;
  width: 256px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--background);
  border-left: 1px solid var(--border); border-inline-start: 0;
  overflow-y: auto;
  transition: transform .3s ease-out;
  font-family: inherit;
}

/* ----- Brand ----- */
.masir-shell-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
}
.masir-shell-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.masir-shell-brandmark {
  display: block;
  height: 14px;
  width: auto;
  color: #fff;
}
.masir-shell-topbar .masir-shell-brandmark {
  height: 11px;
}
.masir-shell-brand .masir-shell-theme {
  margin-inline-start: auto;
}

/* ----- User badge ----- */
.masir-shell-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 14px;
}
.masir-shell-ava {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
  color: var(--foreground);
  font-weight: 700;
  font-size: 12px;
  overflow: hidden;
  flex: none;
}
.masir-shell-badge b {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- Nav ----- */
.masir-shell-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  overflow-y: auto;
}
.masir-shell-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: background-color .15s, color .15s;
}
.masir-shell-item:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.masir-shell-item.is-active {
  background: var(--secondary);
  color: var(--primary);
}
.masir-shell-ic {
  display: inline-flex;
}
.masir-shell-svg {
  width: 16px;
  height: 16px;
}
.masir-shell-divider {
  height: 1px;
  margin: 8px 4px;
  background: var(--border);
}

/* ----- Actions ----- */
.masir-shell-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border);
}
.masir-shell-cta {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  text-align: center;
  border-radius: 8px;
  padding: 8px;
  font-weight: 700;
  text-decoration: none;
}
.masir-shell-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
}
.masir-shell-logout:hover {
  background: var(--secondary);
}
.masir-shell-theme {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.masir-shell-theme svg {
  width: 16px;
  height: 16px;
}
/* Theme-icon show/hide (the brand rules are scoped to .masir-theme-btn; the
   shell button is .masir-shell-theme, so replicate the toggle here). */
.masir-shell-theme .ic-sun { display: none; }
.masir-shell-theme .ic-moon { display: block; }
html.dark .masir-shell-theme .ic-sun { display: block; }
html.dark .masir-shell-theme .ic-moon { display: none; }

/* ----- Mobile topbar brand ----- */
.masir-shell-topbrand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--foreground);
  text-decoration: none;
}

/* Hide Tutor's native left menu site-wide — the canonical shell replaces it. */
.tutor-dashboard-left-menu { display: none !important; }

/* Hide Tutor's native dashboard header strip (avatar + «سلام، نام» greeting +
   become-instructor button) on every dashboard page — the canonical shell
   already shows the user badge in the sidebar. */
.tutor-frontend-dashboard-header { display: none !important; }

/* ----- Desktop (>=1024px): fixed sidebar + content offset ----- */
@media (min-width: 1024px) {
  #wrap {
    margin-right: 256px;
  }
  .masir-footer {
    width: auto;
    margin-right: 256px;
  }
  .masir-shell-topbar,
  .masir-shell-backdrop {
    display: none;
  }
}

/* ----- Mobile (<=1023px): off-canvas drawer ----- */
@media (max-width: 1023px) {
  .masir-shell {
    transform: translateX(100%);
  }
  html.masir-shell-open .masir-shell {
    transform: none;
    box-shadow: -8px 0 28px rgba(0, 0, 0, .35);
  }
  #wrap {
    margin-right: 0;
    padding-block-start: 56px;
  }
  .masir-shell-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    inset-inline: 0;
    height: 56px;
    padding: 0 16px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    z-index: 40;
  }
  .masir-shell-burger {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--foreground);
    cursor: pointer;
  }
  .masir-shell-burger svg {
    width: 24px;
    height: 24px;
  }
  .masir-shell-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 45;
  }
  html.masir-shell-open .masir-shell-backdrop {
    display: block;
  }
}
