/* ========================================================
   SIPM - LAYOUT, SIDEBAR, HEADER & RESPONSIVE DRAWER
   ======================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 275px;
  background-color: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #ffffff 0%, #fafffc 100%);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--emerald-600) 0%, var(--emerald-800) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(4, 120, 87, 0.3);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--emerald-900);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--slate-500);
  font-weight: 500;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.875rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  padding: 0.875rem 0.75rem 0.375rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.6875rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--slate-600);
  font-weight: 600;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  background-color: var(--emerald-50);
  color: var(--emerald-700);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--emerald-700) 0%, var(--emerald-800) 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.25);
}

.nav-item.active .nav-icon {
  color: #ffffff;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--danger);
  color: #ffffff;
}

.nav-item.active .nav-badge {
  background-color: rgba(255, 255, 255, 0.25);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--slate-400);
  transition: color var(--transition-fast);
}

.nav-item:hover .nav-icon {
  color: var(--emerald-600);
}

/* Sidebar Footer / Switch Role Box */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-light);
  background: #fafcfb;
}

.role-switcher-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #e6f7ec 100%);
  border: 1px solid var(--emerald-200);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.role-switcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.role-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--emerald-800);
}

.current-role-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--emerald-600);
  color: #ffffff;
}

.btn-switch-role {
  width: 100%;
  padding: 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  background-color: #ffffff;
  color: var(--emerald-800);
  border: 1px solid var(--emerald-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-switch-role:hover {
  background-color: var(--emerald-700);
  color: #ffffff;
  border-color: var(--emerald-700);
}

/* ================= MAIN CONTAINER ================= */
.main-wrapper {
  margin-left: 275px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 275px);
}

/* ================= TOP HEADER ================= */
.top-header {
  height: 68px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-xs);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.btn-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--slate-700);
  font-size: 1.5rem;
  cursor: pointer;
}

.active-year-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--emerald-50);
  border: 1px solid var(--emerald-200);
  color: var(--emerald-800);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
}

.active-year-pill .dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald-500);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background-color: var(--slate-50);
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald-600) 0%, var(--accent) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1.2;
}

.user-role-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--emerald-700);
}

/* ================= CONTENT BODY ================= */
.content-body {
  flex: 1;
  padding: 2rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title-group h2 {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-title-group p {
  color: var(--slate-500);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Backdrop Mobile Drawer */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 99;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.open {
    display: block;
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }
  .btn-mobile-toggle {
    display: flex;
    align-items: center;
  }
  .content-body {
    padding: 1.25rem;
  }
  .top-header {
    padding: 0 1.25rem;
  }
}
