/* =============================================
   MAIN LAYOUT - Arsitektur Sidebar + Main Content
   ============================================= */
.app-container {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =============================================
   SIDEBAR (fixed di kiri)
   ============================================= */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  height: 64px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  margin-left: auto;
  padding: 4px;
  flex-shrink: 0;
}

.sidebar-close:hover {
  color: var(--accent-danger);
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}

.nav-category {
  padding: 16px 20px 8px 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.1) 0%, transparent 100%);
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
}

.nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* =============================================
   MAIN CONTENT (di kanan sidebar)
   ============================================= */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: calc(100% - 260px);
}

/* =============================================
   TOPBAR (sticky di atas main-content)
   ============================================= */
.topbar {
  height: 64px;
  min-height: 64px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
}

.breadcrumb a {
  color: var(--text-secondary);
  white-space: nowrap;
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-separator {
  color: var(--text-muted);
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

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

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  line-height: 1.3;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.3;
}

/* =============================================
   PAGE CONTENT (area konten utama)
   ============================================= */
.page-content {
  padding: 24px;
  flex: 1;
  min-width: 0;
}

/* =============================================
   GRID LAYOUTS
   ============================================= */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* =============================================
   RESPONSIVE - TABLET (max-width: 992px)
   Sidebar tersembunyi, main-content full width
   ============================================= */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  
  .sidebar.show {
    transform: translateX(0);
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.5);
  }
  
  .sidebar-close {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* =============================================
   RESPONSIVE - MOBILE (max-width: 768px)
   Grid 1 kolom, spacing dikecilkan
   ============================================= */
@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .topbar {
    padding: 0 16px;
    height: 56px;
    min-height: 56px;
    gap: 10px;
  }
  
  .page-content {
    padding: 16px;
  }

  .sidebar-header {
    height: 56px;
  }
  
  .user-info {
    display: none;
  }
  
  h2 {
    font-size: 20px;
  }
  
  .breadcrumb {
    font-size: 13px;
  }
}

/* =============================================
   RESPONSIVE - PHONE KECIL (max-width: 480px)
   Grid sepenuhnya 1 kolom
   ============================================= */
@media (max-width: 480px) {
  .grid-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .page-content {
    padding: 12px;
  }
  
  h2 {
    font-size: 18px;
  }
}
