/* assets/css/sidebar.css - Modern Responsive Sidebar & Fullscreen Toggle Navigation System */

/* ==========================================================================
   1. Root Variables & Base Dashboard Layout
   ========================================================================== */
:root {
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --sidebar-bg: #090e1a;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(255, 90, 0, 0.12);
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f8fafc;
  --sidebar-text-active: #ff5a00;
}

[data-theme="light"] {
  --sidebar-bg: #ffffff;
  --sidebar-border: #fed7aa;
  --sidebar-hover-bg: #fff7ed;
  --sidebar-active-bg: rgba(255, 90, 0, 0.1);
  --sidebar-text: #64748b;
  --sidebar-text-hover: #0f172a;
  --sidebar-text-active: #ff5a00;
}

/* Base Body Adjustment when Logged In (Has Sidebar) */
body.has-sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  background-image: var(--theme-bg-gradient);
  overflow-x: hidden;
}

/* ==========================================================================
   2. Left Sidebar Navigation Container
   ========================================================================== */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.28s ease, background-color 0.25s ease, border-color 0.25s ease;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
}

/* Sidebar Header / Brand */
.sidebar-header {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 1rem 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
  gap: 0.5rem;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  overflow: hidden;
}

.sidebar-brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(255, 90, 0, 0.3));
}

.sidebar-brand-text {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--heading-color);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.sidebar-brand-badge {
  background: rgba(255, 90, 0, 0.15);
  color: var(--brand-orange);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 90, 0, 0.3);
}

/* Collapse / Hide Toggle Button (< Button inside Header) */
.sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 90, 0, 0.15);
  border-color: var(--brand-orange);
  color: var(--brand-orange);
  transform: scale(1.05);
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  line-height: 1;
}

.sidebar-close-btn:hover {
  color: var(--brand-orange);
  background: var(--sidebar-hover-bg);
}

/* Sidebar Scrollable Body */
.sidebar-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0.85rem 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.sidebar-body::-webkit-scrollbar {
  width: 5px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

[data-theme="light"] .sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

/* User Card inside Sidebar */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="light"] .sidebar-user-card {
  background: #f8fafc;
}

.sidebar-user-card:hover {
  border-color: rgba(255, 90, 0, 0.4);
  background: var(--sidebar-hover-bg);
  transform: translateY(-1px);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  border: 2px solid rgba(255, 90, 0, 0.4);
  position: relative;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--heading-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.sidebar-user-role {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.sidebar-user-role.role-admin {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.sidebar-user-role.role-teacher {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.sidebar-user-role.role-student {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Nav Groups & Links */
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-group-title {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0.5rem 0.3rem 0.5rem;
  user-select: none;
}

.sidebar-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  width: 100%;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-hover-bg);
  transform: translateX(2px);
}

.sidebar-nav-link.active {
  color: var(--brand-orange);
  background: var(--sidebar-active-bg);
  border-left-color: var(--brand-orange);
  font-weight: 800;
  box-shadow: inset 0 0 12px rgba(255, 90, 0, 0.08);
}

.sidebar-nav-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-nav-icon {
  font-size: 1.05rem;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.sidebar-badge-pro {
  background: rgba(255, 90, 0, 0.15);
  color: var(--brand-orange);
  border: 1px solid rgba(255, 90, 0, 0.35);
}

.sidebar-badge-admin {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.sidebar-badge-count {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 9999px;
  animation: pulse-badge 2s infinite ease-in-out;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Sidebar Quota / Storage Card */
.sidebar-quota-box {
  background: rgba(255, 90, 0, 0.06);
  border: 1px solid rgba(255, 90, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}

.sidebar-quota-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--heading-color);
}

.sidebar-quota-bar {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

[data-theme="light"] .sidebar-quota-bar {
  background: #e2e8f0;
}

.sidebar-quota-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff5a00, #ff8a00);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.sidebar-quota-action {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand-orange);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}

.sidebar-quota-action:hover {
  text-decoration: underline;
}

/* ==========================================================================
   3. Sidebar Footer Actions (Fixed at bottom, never cut off)
   ========================================================================== */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  z-index: 10;
}

[data-theme="light"] .sidebar-footer {
  background: #f8fafc;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.sidebar-footer-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--sidebar-border);
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.04);
  color: var(--sidebar-text);
  white-space: nowrap;
}

[data-theme="light"] .sidebar-footer-btn {
  background: #ffffff;
  border-color: #cbd5e1;
}

.sidebar-footer-btn:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-footer-btn.btn-logout-full {
  width: 100%;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-weight: 800;
  padding: 0.5rem 0.75rem;
  font-size: 0.825rem;
}

.sidebar-footer-btn.btn-logout-full:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
  transform: translateY(-1px);
}

/* ==========================================================================
   4. Topbar Header (.app-topbar)
   ========================================================================== */
.app-topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--navbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  margin-left: var(--sidebar-width);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  transition: margin-left 0.28s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Toggle Menu Button in Topbar (< / > Button) */
.topbar-toggle-btn {
  background: rgba(255, 90, 0, 0.1);
  border: 1px solid rgba(255, 90, 0, 0.3);
  color: var(--brand-orange);
  height: 36px;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.825rem;
  font-weight: 800;
  transition: all 0.2s ease;
  user-select: none;
}

.topbar-toggle-btn:hover {
  background: var(--brand-orange);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 90, 0, 0.3);
}

.topbar-page-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-page-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--heading-color);
  letter-spacing: -0.01em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-plan-badge {
  background: rgba(255, 90, 0, 0.12);
  border: 1px solid rgba(255, 90, 0, 0.35);
  color: var(--brand-orange);
  font-weight: 800;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 9999px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.topbar-plan-badge:hover {
  background: rgba(255, 90, 0, 0.2);
  transform: translateY(-1px);
}

.topbar-dev-btn {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.topbar-dev-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.topbar-user-dropdown {
  position: relative;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.25rem 0.65rem 0.25rem 0.35rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--heading-color);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

[data-theme="light"] .topbar-user-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.topbar-user-btn:hover,
.topbar-user-dropdown.active .topbar-user-btn {
  border-color: var(--brand-orange);
  background: rgba(255, 90, 0, 0.08);
}

.topbar-user-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.topbar-user-dropdown.active .topbar-user-chevron {
  transform: rotate(180deg);
  color: var(--brand-orange);
}

.topbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  border: 1px solid #38bdf8;
  flex-shrink: 0;
}

.topbar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-user-name {
  font-size: 0.85rem;
  color: var(--heading-color);
  font-weight: 700;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown Menu Box */
.topbar-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #090e1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  pointer-events: none;
}

[data-theme="light"] .topbar-user-menu {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.topbar-user-dropdown.active .topbar-user-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.topbar-user-menu-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.4rem 0.65rem 0.4rem;
}

.user-menu-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  border: 1.5px solid #38bdf8;
  flex-shrink: 0;
}

.user-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-menu-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-menu-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--heading-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.user-menu-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.badge-role {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-role.role-admin {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-role.role-teacher {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-role.role-student {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-plan {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--brand-orange);
  background: rgba(255, 90, 0, 0.1);
  border: 1px solid rgba(255, 90, 0, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
}

.topbar-user-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.4rem 0;
}

[data-theme="light"] .topbar-user-menu-divider {
  background: #e2e8f0;
}

.topbar-user-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-color);
  transition: all 0.18s ease;
}

.topbar-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(2px);
}

[data-theme="light"] .topbar-menu-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.menu-item-icon {
  font-size: 1.1rem;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.menu-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.menu-item-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar-user-menu-footer {
  padding-top: 0.2rem;
}

.topbar-menu-logout {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  text-decoration: none;
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.18s ease;
}

.topbar-menu-logout:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  color: #ff8585;
  transform: translateY(-1px);
}

/* ==========================================================================
   5. Main Content Layout Wrapper (.app-layout-main)
   ========================================================================== */
.app-layout-main {
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: margin-left 0.28s ease;
  position: relative;
}

/* Special Case for Virtual Lab: Full Canvas Fill */
body.page-lab .app-layout-main,
.app-layout-main.is-lab-main {
  height: calc(100vh - var(--topbar-height));
  max-height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  min-height: auto;
}

body.page-lab .lab-container {
  height: calc(100vh - var(--topbar-height)) !important;
  max-height: calc(100vh - var(--topbar-height)) !important;
}

/* Backdrop for Mobile Sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* ==========================================================================
   6. Fullscreen / Hidden Sidebar Mode (User Toggle with < and >)
   ========================================================================== */
body.sidebar-hidden .app-sidebar {
  transform: translateX(-100%) !important;
}

body.sidebar-hidden .app-topbar {
  margin-left: 0 !important;
}

body.sidebar-hidden .app-layout-main {
  margin-left: 0 !important;
}

/* Floating Reopen Pill Button on Fullscreen Mode */
.floating-sidebar-reopen-btn {
  display: none;
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--brand-orange);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: none;
  border-radius: 0 12px 12px 0;
  padding: 0.75rem 0.5rem;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  z-index: 1060;
  box-shadow: 2px 0 16px rgba(255, 90, 0, 0.4);
  transition: all 0.2s ease;
}

.floating-sidebar-reopen-btn:hover {
  background: #ff7728;
  padding-right: 0.75rem;
  box-shadow: 4px 0 20px rgba(255, 90, 0, 0.6);
}

body.sidebar-hidden .floating-sidebar-reopen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   7. Responsive Mobile & Tablet Rules (<= 992px)
   ========================================================================== */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 270px;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar-close-btn {
    display: block;
  }

  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.5);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0) !important;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .app-topbar {
    margin-left: 0 !important;
  }

  .app-layout-main {
    margin-left: 0 !important;
  }

  .floating-sidebar-reopen-btn {
    display: none !important;
  }

  .topbar-user-name {
    display: none;
  }
}

@media (max-width: 576px) {
  .topbar-plan-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  .topbar-dev-btn span.btn-text {
    display: none;
  }

  .topbar-toggle-btn span.btn-text {
    display: none;
  }

  .topbar-page-title {
    font-size: 0.95rem;
  }
}
