/*==================================================
SIDEBAR
==================================================*/

.sidebar {
  position: fixed;

  top: 0;

  left: 0;

  width: 280px;

  height: 100vh;

  background: var(--gradient);

  color: #fff;

  display: flex;

  flex-direction: column;

  box-shadow: var(--shadow-lg);

  transition: var(--transition);

  z-index: 1000;

  overflow: hidden;
}

.sidebar::before {
  content: "";

  position: absolute;

  inset: 0;

  background: radial-gradient(
    circle at top right,

    rgba(255, 255, 255, 0.12),
    transparent 35%
  );

  pointer-events: none;
}

.sidebar::after {
  content: "";

  position: absolute;

  bottom: -120px;

  left: -80px;

  width: 260px;

  height: 260px;

  background: radial-gradient(rgba(255, 255, 255, 0.08), transparent 70%);

  border-radius: 50%;

  pointer-events: none;
}

.sidebar-header {
  height: 165px;

  padding: 20px 5px;

  display: flex;

  align-items: center;

  gap: 1px;

  flex-shrink: 0;
}

.logo {
  width: 140px;
  height: auto;
  display: block;
  object-fit: contain;

  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.18)) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
}

.logo-text {
  display: flex;

  flex-direction: column;
  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.18)) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.28));
}

.sidebar-logo {
  width: 165px;
  height: auto;
  display: block;
  object-fit: contain;
  transition: 0.35s ease;
  filter: drop-shadow(0 2px 3px rgba(255, 255, 255, 0.15)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

.sidebar-logo:hover {
  transform: scale(1.03);
}

.logo-text h2 {
  color: #fff;

  font-size: 22px;

  font-weight: 700;
}

.logo-text small {
  color: rgba(255, 255, 255, 0.75);
}

.logo-text span {
  font-size: 12px;

  color: var(--text-light);
}

.sidebar-body {
  flex: 1;

  overflow-y: auto;

  padding: 10px 20px;
}

.sidebar-menu {
  display: flex;

  flex-direction: column;

  gap: 8px;
}

.sidebar-menu a {
  display: flex;

  align-items: center;

  gap: 15px;

  color: #fff;

  padding: 15px 18px;

  border-radius: 16px;

  transition: var(--transition);

  position: relative;

  overflow: hidden;
}

.sidebar-menu a:hover {
  background: rgba(255, 255, 255, 0.14);

  backdrop-filter: blur(16px);

  transform: translateX(8px);
}

.sidebar-menu a.active {
  background: rgba(255, 255, 255, 0.116);

  border: 1px solid rgba(255, 255, 255, 0.18);

  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

.sidebar-menu a::before {
  content: "";

  position: absolute;

  top: 0;

  left: -120%;

  width: 80%;

  height: 100%;

  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);

  transition: 0.7s;
}

.sidebar-menu a:hover::before {
  left: 130%;
}

.sidebar-menu i {
  width: 22px;

  text-align: center;

  font-size: 18px;
}

.sidebar-footer {
  margin: 20px;

  padding: 18px;

  border-radius: 20px;

  background: rgba(255, 255, 255, 0.12);

  backdrop-filter: blur(20px);

  display: flex;

  align-items: center;

  gap: 15px;

  flex-shrink: 0;
}

.user-photo {
  width: 55px;

  height: 55px;

  border-radius: 50%;

  object-fit: cover;

  border: 3px solid rgba(255, 255, 255, 0.9);
}

.sidebar-footer img {
  width: 45px;

  height: 45px;

  border-radius: 50%;
}

.sidebar-body::-webkit-scrollbar {
  width: 6px;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);

  border-radius: 10px;
}

/*==================================================
SIDEBAR COLLAPSE
==================================================*/

.sidebar.close {
  width: 90px;
}

.sidebar.close .logo-text {
  display: none;
}

.sidebar.close .sidebar-menu span {
  display: none;
}

.sidebar.close .sidebar-footer div {
  display: none;
}

.sidebar.close .sidebar-header {
  justify-content: center;
}

.sidebar.close .sidebar-footer {
  justify-content: center;
}

.sidebar.close .sidebar-menu a {
  justify-content: center;
}

.main {
  margin-left: 280px;
}

.main.expand {
  margin-left: 90px;
}

.overlay {
  position: fixed;

  inset: 0;

  background: rgba(0, 0, 0, 0.45);

  display: none;

  z-index: 950;
}

.overlay.show {
  display: block;
}

/*==================================================
SIDEBAR DROPDOWN
==================================================*/

.sidebar-dropdown {
  position: relative;
}

.sidebar-toggle {
  cursor: pointer;
}

.sidebar-dropdown .arrow {
  margin-left: auto;

  transition: 0.3s ease;
}

.sidebar-toggle .arrow {
  margin-left: auto;

  font-size: 12px;

  transition: 0.3s;
}

.sidebar-dropdown.open .arrow {
  transform: rotate(180deg);
}

.sidebar-submenu {
  list-style: none;

  padding-left: 15px;

  margin: 5px 0 0;

  max-height: 0;

  overflow: hidden;

  transition: max-height 0.35s ease;
}

.sidebar-dropdown.open .sidebar-submenu {
  max-height: 500px;
}

.sidebar-submenu li a {
  padding: 12px 15px;

  font-size: 12px;
}

.sidebar-submenu li a:hover {
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-submenu a {
  padding: 12px 18px;

  font-size: 14px;
}

.sidebar-submenu a.active {
  background: rgba(255, 255, 255, 0.18);
}

/*==================================================
MILESTONE 7 · SIDEBAR CONTEXT & PERMISSION MATRIX
==================================================*/

.wahid-sidebar-context {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 20px 8px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
}

.wahid-sidebar-context--empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.07);
}

.wahid-sidebar-context__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.wahid-sidebar-context__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.3;
}

.wahid-sidebar-context__body small,
.wahid-sidebar-context__body em {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.7);
  font-size: 9px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wahid-sidebar-context__body strong {
  overflow: hidden;
  margin: 2px 0;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-menu-label {
  padding: 12px 14px 2px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-submenu--institutions {
  padding-left: 7px;
}

.sidebar-dropdown.open .sidebar-submenu--institutions {
  max-height: 560px;
  overflow-y: auto;
}

.sidebar-submenu-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 13px 5px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-submenu-heading i {
  width: 14px;
  font-size: 10px;
}

.sidebar-institution-link {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.35;
}

.sidebar-institution-link strong,
.sidebar-institution-link small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-institution-link strong {
  color: #fff;
  font-size: 10px;
  font-weight: 500;
}

.sidebar-institution-link small {
  color: rgba(255, 255, 255, 0.57);
  font-size: 8px;
}

.wahid-user-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.17);
  font-size: 12px;
  font-weight: 700;
}

.wahid-sidebar-user {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.wahid-sidebar-user h4,
.wahid-sidebar-user small,
.wahid-sidebar-user em {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wahid-sidebar-user h4 {
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.wahid-sidebar-user small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
}

.wahid-sidebar-user em {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 8px;
  font-style: normal;
}

.sidebar.close .wahid-sidebar-context,
.sidebar.close .sidebar-menu-label,
.sidebar.close .sidebar-submenu,
.sidebar.close .sidebar-dropdown .arrow {
  display: none;
}

.sidebar.close .wahid-user-avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

/* Milestone 9 · Hotfix 140.2 — foto profil current-user */
.wahid-user-avatar {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.wahid-user-avatar > span {
  position: relative;
  z-index: 0;
}

.wahid-user-avatar > img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
