/* ============================================
   SimdesPro — Sidebar Styles
   ============================================ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
}

/* === Collapsed state === */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

body.sidebar-collapsed .sidebar-header .logo-text,
body.sidebar-collapsed .sidebar-desa,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-item span:not(.nav-badge):not(.nav-soon),
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .nav-soon,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .user-logout,
body.sidebar-collapsed .sidebar-credit {
  display: none;
}

body.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 0 16px;
}

body.sidebar-collapsed .sidebar-toggle {
  display: none;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

body.sidebar-collapsed .nav-item svg {
  width: 22px;
  height: 22px;
}

body.sidebar-collapsed .user-card {
  justify-content: center;
  padding: 12px;
}

/* === Sidebar Header === */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 60px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
  color: var(--text-inverse);
  stroke-width: 2.5;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.logo-year {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.sidebar-toggle {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
}

/* === Desa Info === */
.sidebar-desa {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.desa-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.desa-badge svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.desa-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desa-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
}

/* === Navigation === */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--bg-muted); border-radius: 10px; }

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 12px 8px 4px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.855rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  stroke-width: 2;
}

.nav-item span:first-of-type {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover:not(.nav-disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: 7px;
}

.nav-item.active svg {
  color: var(--accent);
}

.nav-badge {
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.nav-soon {
  font-size: 0.58rem;
  font-weight: 700;
  background: var(--bg-muted);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.nav-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* === Sidebar Footer === */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px;
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.user-card:hover {
  border-color: var(--border-light);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--text-inverse);
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
}

.user-logout {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* === Clasnet Credit === */
.sidebar-credit {
  margin-top: 8px;
  padding: 0 4px;
}

.credit-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.credit-link:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-dim);
}

.credit-link svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke-width: 2;
}

.credit-link strong {
  color: var(--accent);
  font-weight: 700;
}

/* === Mobile === */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-width) !important;
  }
}
