/* ==========================================================
   Sidemenu New Design v2 — Clean Light Sidebar (RTL)
   Completely different from old dark purple design
   ========================================================== */

/* =========================================================
   GLOBAL RESET FOR SIDEBAR
   ========================================================= */
.app-sidebar *,
.app-sidebar *::before,
.app-sidebar *::after {
  box-sizing: border-box;
}

/* =========================================================
   SCROLLBAR
   ========================================================= */
.app-sidebar::-webkit-scrollbar { width: 3px; }
.app-sidebar::-webkit-scrollbar-track { background: #f1f5f9; }
.app-sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

/* =========================================================
   BASE SIDEBAR — White, clean, right-side shadow
   (Old was dark #0f1535 with left glow)
   ========================================================= */
.app-sidebar.sb-sidebar {
  position: fixed;
  top: var(--header-height, 64px);
  bottom: 0;
  right: 0;
  width: 255px;
  max-height: calc(100vh - var(--header-height, 64px));
  z-index: 1000;
  background: #ffffff;
  color: #475569;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -2px 0 20px rgba(0, 0, 0, 0.08);
  border-left: 1px solid #e2e8f0;
}

/* =========================================================
   OVERLAY
   ========================================================= */
.sb-overlay {
  visibility: hidden;
}

/* =========================================================
   BRAND / LOGO AREA
   Tall teal gradient bar — opposite of old flat dark header
   ========================================================= */
.sb-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 68px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0d9488 0%, #0891b2 100%);
  border-bottom: 3px solid #0f766e;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.sb-brand .sb-logo { display: block; line-height: 0; }

.sb-brand .sb-logo__img {
  max-height: 40px;
  max-width: 170px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* =========================================================
   PROFILE SECTION
   Card with avatar circle — replaces old minimal text row
   ========================================================= */
.sb-profile {
  padding: 20px 16px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.sb-profile-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sb-profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0d9488, #0891b2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.sb-profile-avatar span {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.sb-profile-info {
  flex: 1;
  min-width: 0;
}

.sb-profile-name {
  color: #1e293b;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-profile-role {
  color: #94a3b8;
  font-size: 11.5px;
  display: block;
}

/* =========================================================
   SIDEBAR BODY
   ========================================================= */
.sb-body {
  padding-bottom: 24px;
}

/* =========================================================
   CATEGORY LABELS
   Pill badge style — old was plain uppercase text
   ========================================================= */
.sb-category {
  padding: 20px 16px 8px;
  list-style: none;
}

.sb-category span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94a3b8;
}

.sb-category span::before,
.sb-category span::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.sb-category span::before { width: 8px; flex: none; }
.sb-category span::after  { min-width: 20px; }

/* =========================================================
   MENU WRAPPER — keeps JS variable 'slideMenu' working
   ========================================================= */
.side-menu.sb-menu {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

/* =========================================================
   SLIDE (each menu row) — JS adds .is-expanded here
   ========================================================= */
.slide {
  margin: 1px 10px;
  border-radius: 10px;
  overflow: visible;
  list-style: none;
}

/* =========================================================
   MAIN LINK  (.sb-link replaces old .side-menu__item)
   Clean row with left-side colored icon box
   (Old was full-row gradient on active)
   ========================================================= */
.sb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 10px;
  color: #475569;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  transition: background 0.18s ease, color 0.18s ease;
  position: relative;
  height: auto;
  cursor: pointer;
}

.sb-link:hover,
.sb-link:focus {
  background: #f0fdf9;
  color: #0d9488;
  text-decoration: none;
}

/* Active — solid teal left border + soft teal bg  */
.slide.active > .sb-link,
.sb-link.active {
  background: #f0fdfa;
  color: #0d9488;
  font-weight: 600;
  border-right: 3px solid #0d9488;
}

/* Expanded parent */
.slide.is-expanded > .sb-link {
  background: #f0fdfa;
  color: #0d9488;
}

/* =========================================================
   ICON  (.sb-icon replaces old .side-menu__icon)
   Boxed, colored — old was flat gray icon
   ========================================================= */
.sb-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease;
  flex-shrink: 0;
}

.sb-link:hover .sb-icon,
.sb-link:focus .sb-icon,
.slide.is-expanded > .sb-link .sb-icon,
.slide.active > .sb-link .sb-icon,
.sb-link.active .sb-icon {
  background: #ccfbf1;
  color: #0d9488;
}

/* =========================================================
   LABEL  (.sb-text replaces old .side-menu__label)
   ========================================================= */
.sb-text {
  flex: 1;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: inherit;
  line-height: 1;
  color: inherit;
  display: flex;
  align-items: center;
}

/* =========================================================
   ARROW  (.sb-arrow replaces old .angle)
   ========================================================= */
.sb-arrow {
  font-size: 11px;
  color: #cbd5e1;
  transition: transform 0.28s ease, color 0.18s ease;
  flex-shrink: 0;
}

.sb-link:hover .sb-arrow { color: #0d9488; }

.slide.is-expanded > .sb-link .sb-arrow {
  transform: rotate(180deg);
  color: #0d9488;
}

/* =========================================================
   SUBMENU  (.sb-submenu replaces old .slide-menu)
   But also keeps slide-menu class for JS compatibility
   Indented with left colored line — totally different look
   ========================================================= */
.sb-submenu.slide-menu {
  list-style: none;
  padding: 0 !important;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
  background: transparent;
  border-radius: 0;
  margin: 0 !important;
  position: relative;
}

/* vertical connecting line */
.sb-submenu.slide-menu::before {
  content: '';
  position: absolute;
  right: 27px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #e2e8f0;
  border-radius: 2px;
}

.slide.is-expanded .sb-submenu.slide-menu {
  max-height: 600px;
  padding: 4px 0 8px !important;
}

/* =========================================================
   SUBMENU LINKS  (.sb-sub-link replaces old .slide-item)
   ========================================================= */
.sb-sub-link {
  display: flex;
  align-items: center;
  padding: 8px 48px 8px 12px !important;
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition: color 0.18s ease, padding 0.18s ease;
  height: auto !important;
  position: relative;
  margin: 1px 0;
}

/* dot on the line */
.sb-sub-link::before {
  content: '' !important;
  position: absolute !important;
  right: 22px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #e2e8f0 !important;
  font-family: unset !important;
  font-size: unset !important;
  color: unset !important;
  transition: background 0.18s ease, transform 0.18s ease !important;
}

.sb-sub-link:hover,
.sb-sub-link:focus,
.sb-sub-link.active {
  color: #0d9488;
  text-decoration: none;
  padding-right: 52px !important;
}

.sb-sub-link:hover::before,
.sb-sub-link.active::before {
  background: #0d9488 !important;
  transform: translateY(-50%) scale(1.3) !important;
}

/* Disable old feather-based bullets on sb-sub-link */
.app-sidebar .sb-submenu.slide-menu a.sb-sub-link::before {
  content: '' !important;
  font-family: unset !important;
  font-size: 0 !important;
}

/* =========================================================
   HIDE ACTIVE INDICATOR (old right-side bar)
   ========================================================= */
.app-sidebar .slide .sb-link.active::before,
.app-sidebar .slide .sb-link::after {
  display: none;
}

/* =========================================================
   APP CONTENT OFFSET
   ========================================================= */
.app-content {
  min-height: calc(100vh - 68px);
  margin-bottom: 0 !important;
  overflow: hidden;
  transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-content .side-app {
  padding: 0 30px;
}

/* =========================================================
   TOGGLE BUTTON
   ========================================================= */
.app-sidebar__toggle {
  display: block;
  font-size: 22px;
  color: #475569;
  position: relative;
  line-height: 23px;
  outline: none;
  height: 40px;
  width: 40px;
  background: transparent;
  margin: auto;
  margin-right: 10px;
  text-align: center;
  border-radius: 50%;
  transition: background 0.2s ease, color 0.2s ease;
  z-index: 1;
}

.app-sidebar__toggle:hover {
  background: rgba(13, 148, 136, 0.08);
  color: #0d9488;
  text-decoration: none;
}

.app-sidebar__toggle .close-toggle,
.sidebar-mini.sidenav-toggled .open-toggle { display: none; }

.sidebar-mini.sidenav-toggled .close-toggle {
  display: block;
  font-size: 18px;
  line-height: 42px;
  text-align: center;
}

/* =========================================================
   HEADER ICON
   ========================================================= */
.header-icon {
  text-align: center;
  line-height: 1.7;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  font-size: 1.5rem;
  color: #64748b;
}

/* =========================================================
   SIDE HEADER
   ========================================================= */
.side-header {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  padding: 0;
  transition: left 0.3s ease;
  width: 255px;
  top: 0;
  position: fixed;
  z-index: 1;
}

/* =========================================================
   DESKTOP — Min 768px
   ========================================================= */
@media (min-width: 768px) {
  .app-content { margin-right: 255px; }

  /* -- Collapsed -- */
  .app.sidenav-toggled .app-content    { margin-right: 72px; }
  .app.sidenav-toggled .app-sidebar    { width: 72px; overflow: hidden; }
  .app.sidenav-toggled .app-sidebar__overlay { visibility: hidden; }
  .app.sidenav-toggled .slide.is-expanded .slide-menu { display: none; }

  .app.sidenav-toggled .sb-text,
  .app.sidenav-toggled .sb-arrow,
  .app.sidenav-toggled .sb-profile-info,
  .app.sidenav-toggled .sb-category { display: none !important; }

  .app.sidenav-toggled .sb-link {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
    border-right: none !important;
  }

  .app.sidenav-toggled .sb-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .app.sidenav-toggled .slide { margin: 3px 8px; }

  .app.sidenav-toggled .sb-profile {
    padding: 12px 0;
    justify-content: center;
  }

  .app.sidenav-toggled .sb-profile-avatar {
    margin: 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .app.sidenav-toggled .sb-brand {
    padding: 14px 8px;
  }

  .app.sidenav-toggled .sb-brand .sb-logo__img {
    max-height: 34px;
    max-width: 48px;
  }

  /* -- Toggled Open (hover/click to expand) -- */
  .app.sidebar-mini.sidenav-toggled-open .app-sidebar {
    width: 255px;
    overflow-y: auto;
  }

  .app.sidebar-mini.sidenav-toggled-open .sb-text,
  .app.sidebar-mini.sidenav-toggled-open .sb-arrow,
  .app.sidebar-mini.sidenav-toggled-open .sb-profile-info,
  .app.sidebar-mini.sidenav-toggled-open .sb-category { display: flex !important; }

  .app.sidebar-mini.sidenav-toggled-open .sb-text    { display: flex !important; }
  .app.sidebar-mini.sidenav-toggled-open .sb-arrow   { display: inline-block !important; }
  .app.sidebar-mini.sidenav-toggled-open .sb-category { display: block !important; }
  .app.sidebar-mini.sidenav-toggled-open .sb-profile-info { display: block !important; }

  .app.sidebar-mini.sidenav-toggled-open .sb-link {
    justify-content: flex-start;
    padding: 10px 12px 10px 10px;
    gap: 12px;
  }

  .app.sidebar-mini.sidenav-toggled-open .sb-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .app.sidebar-mini.sidenav-toggled-open .slide { margin: 1px 10px; }

  .app.sidebar-mini.sidenav-toggled-open .slide.is-expanded .slide-menu {
    max-height: 600px;
    display: block !important;
  }

  .app.sidebar-mini.sidenav-toggled-open .sb-profile {
    padding: 20px 16px 16px;
  }

  .app.sidebar-mini.sidenav-toggled-open .sb-profile-avatar {
    margin: 0;
    width: 42px;
    height: 42px;
  }

  .app.sidebar-mini.sidenav-toggled-open .sb-brand {
    padding: 14px 24px;
  }

  .app.sidebar-mini.sidenav-toggled-open .main-sidebar-header { width: 255px; }

  /* Sub slide open */
  .sidebar-mini.sidenav-toggled.sidenav-toggled-open .slide.is-expanded .slide-menu {
    max-height: 600px;
    position: relative;
  }

  .app.sidebar-mini.sidenav-toggled.sidenav-toggled-open .slide.is-expanded .slide-menu {
    display: block;
    box-shadow: none;
  }

  .sidenav-toggled .slide-menu { box-shadow: none !important; }

  .sidebar-mini.sidenav-toggled.sidenav-toggled-open .slide-menu {
    left: 0;
    padding: 0;
    position: inherit;
    visibility: visible;
    opacity: 1 !important;
    z-index: 0;
  }

  .app.sidenav-toggled .avatar-xl {
    width: 3rem; height: 3rem;
    line-height: 3rem; font-size: 1rem;
  }
}

/* =========================================================
   MOBILE — Max 767px
   ========================================================= */
@media (max-width: 767px) {
  .app { overflow-x: hidden; }

  .app .app-sidebar {
    right: -255px;
    transition: right 0.3s ease;
  }

  .sb-overlay {
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .app.sidenav-toggled .app-content    { margin-right: 0; }
  .app.sidenav-toggled .app-sidebar    { right: 0; }
  .app.sidenav-toggled .sb-overlay     { visibility: visible; opacity: 1; }
  .app-content   { min-width: 100%; }
  .sb-brand      { display: none !important; }
  .sb-body       { margin-top: 0 !important; }

  .app.sidenav-toggled .side-menu .sb-icon {
    margin-right: 12px !important;
    margin-left: 0;
  }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print {
  .app-sidebar { display: none; }
  .app-content { margin: 0; padding: 0; background: #fff; }
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer .container {
  width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
  margin-right: auto;
  margin-left: auto;
}

/* =========================================================
   NAV BADGE
   ========================================================= */
.nav-badge {
  border-radius: 30px;
  padding: 0.4em 0.6em;
  font-size: 12px;
}

.sidenav-toggled .main-wrapper .side-menu .sb-link .nav-badge {
  position: absolute;
  top: 5px;
  left: 57px;
  display: block !important;
  padding: 3px 5px !important;
}
