/* =========================================
   DASHBOARD SIDEBAR & LAYOUT
   ========================================= */

.app-container {
  display: flex;
  min-height: 100vh;
}

.dashboard-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-soft);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease;
}

.dashboard-sidebar.hidden {
  display: none !important;
}

.sidebar-brand {
  height: 80px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: #FFFFFF;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.84rem;
  letter-spacing: 0.1px;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--sidebar-text);
  transition: all 0.2s ease-in-out;
}

.sidebar-link:hover {
  background-color: var(--sidebar-item-hover);
  color: var(--sidebar-text-hover);
}

.sidebar-link:hover i {
  color: var(--sidebar-text-hover);
}

.sidebar-link.active {
  background-color: var(--sidebar-item-active);
  color: var(--sidebar-item-active-text);
  font-weight: 600;
  border-left-color: var(--sidebar-item-active-text);
  border-radius: 0 6px 6px 0;
}

.sidebar-link.active i {
  color: var(--sidebar-item-active-text);
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--sidebar-border);
  margin: 8px 0;
}

.sidebar-badge {
  margin-left: auto;
  background-color: var(--secondary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--sidebar-border);
  margin-top: auto;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.sidebar-user-info .user-avatar-img {
  width: 34px;
  height: 34px;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  object-fit: cover;
}

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

.sidebar-user-info .user-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #FFFFFF;
}

.sidebar-user-info .user-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
}

.sidebar-user-info .user-status.text-warning {
  color: var(--secondary);
}

.btn-logout-sidebar {
  width: 100%;
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid transparent;
  padding: 12px;
  border-radius: var(--border-radius-xl);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-logout-sidebar:hover {
  background-color: #ef4444;
  color: white;
}

/* Dashboard Active Layout Shifts */
body.dashboard-active .main-content {
  margin-left: 260px;
  padding-top: 70px; /* space for global topbar */
  background: #f8fafc; /* separate background for dashboard */
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

body.dashboard-active .navbar-wrapper {
  display: none !important; /* Hide top navbar when in dashboard mode */
}

body.dashboard-active .footer-section {
  display: none !important; /* Hide footer in dashboard mode */
}

/* Global Dashboard Header */
.dashboard-header {
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  height: 70px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  z-index: 900;
  transition: left 0.3s ease;
}

.dashboard-header.hidden {
  display: none !important;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.mobile-toggle-dash {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.mobile-toggle-dash:hover {
  background: #e2e8f0;
  color: var(--primary);
}

.dash-page-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.btn-icon-dash {
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-dash:hover {
  background: #e2e8f0;
  color: var(--primary);
}

.dash-user-dropdown-wrapper {
  position: relative;
}

.dash-user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 5px;
  border-radius: 8px;
  transition: background 0.2s;
}

.dash-user-trigger:hover {
  background: #f8fafc;
}

.dash-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.dash-user-text {
  display: flex;
  flex-direction: column;
}

.dash-user-text .name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

.dash-user-text .role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dropdown-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dash-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: 200px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  z-index: 1000;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.2s ease;
}

.dash-dropdown-menu.hidden {
  display: none !important;
}

.dropdown-header {
  padding: 8px 16px 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dark);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0;
}

/* Mobile Responsive Adjustments */
@media (max-width: 991px) {
  .dashboard-sidebar {
    transform: translateX(-100%);
  }
  .dashboard-sidebar.open {
    transform: translateX(0);
  }
  body.dashboard-active .main-content {
    margin-left: 0;
  }
  .dashboard-header {
    left: 0;
  }
  .mobile-toggle-dash {
    display: block;
  }
}

/* ==========================================================
   LAYOUT SPACING OVERRIDES (REMOVE REDUNDANT DOUBLE HEADERS)
   ========================================================== */
#dashboard-view .dashboard-topbar,
#katalog-view .dashboard-topbar,
#event-saya-view .dashboard-topbar,
#profil-view .dashboard-topbar {
  display: none !important;
}

/* Optimize Admin Dashboard Topbar */
.view-section[id^="admin-"] .dashboard-topbar {
  min-height: auto;
  padding: 12px 32px;
  background: transparent;
  border-bottom: none;
}

.view-section[id^="admin-"] .dashboard-topbar h2 {
  display: none !important; /* Hide redundant title in admin view */
}

.view-section[id^="admin-"] .dashboard-topbar .btn {
  margin-left: auto; /* Align refresh/action buttons to the right */
}

/* ==========================================================
   DESKTOP COLLAPSED SIDEBAR RULES (MINI SIDEBAR WITH ICONS)
   ========================================================== */
@media (min-width: 992px) {
  body.sidebar-collapsed .dashboard-sidebar {
    width: 70px !important;
    transition: width 0.3s ease;
  }
  
  body.sidebar-collapsed .sidebar-brand {
    padding: 0 !important;
    justify-content: center !important;
    height: 80px !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.3s ease;
  }
  
  body.sidebar-collapsed .brand-logo-img {
    width: 44px !important;
    height: 44px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    border: 2px solid var(--primary-tint) !important;
    padding: 2px !important;
    background: white !important;
    box-shadow: var(--shadow-soft) !important;
    display: block !important;
    margin: 0 auto !important;
    transition: all 0.3s ease;
  }
  
  body.sidebar-collapsed .sidebar-nav {
    padding: 20px 8px !important;
    gap: 12px !important;
  }

  body.sidebar-collapsed .sidebar-link {
    font-size: 0 !important;
    padding: 10px 0 !important;
    justify-content: center !important;
    gap: 0 !important;
    border-radius: 6px !important;
    border-left: 3px solid transparent !important;
  }

  body.sidebar-collapsed .sidebar-link i {
    font-size: 1.15rem !important;
    margin: 0 !important;
    width: auto !important;
    color: var(--text-light);
  }

  body.sidebar-collapsed .sidebar-link.active {
    background-color: rgba(15, 76, 129, 0.08) !important;
    border-left-color: var(--primary) !important;
    border-radius: 6px !important;
  }

  body.sidebar-collapsed .sidebar-link.active i {
    color: var(--primary) !important;
  }

  body.sidebar-collapsed .sidebar-badge {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-divider {
    margin: 8px 10px !important;
  }

  body.sidebar-collapsed .sidebar-user-info {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-footer {
    padding: 15px 0 !important;
  }

  body.sidebar-collapsed .btn-logout-sidebar {
    font-size: 0 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #fecaca !important;
    background: white !important;
    color: #dc2626 !important;
  }

  body.sidebar-collapsed .btn-logout-sidebar i {
    font-size: 1rem !important;
    margin: 0 !important;
  }
  
  body.sidebar-collapsed.dashboard-active .main-content {
    margin-left: 70px !important;
    transition: margin-left 0.3s ease;
  }
  
  body.sidebar-collapsed .dashboard-header {
    left: 70px !important;
    transition: left 0.3s ease;
  }
}

