/* ==========================================
   SIDEBAR & TOPBAR - Responsive Menu
   ========================================== */

:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #334155;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #3b82f6;
  --topbar-height: 56px;
  --topbar-bg: #1e293b;
}

/* ---- App Wrapper ---- */
#app-wrapper {
  display: flex;
  min-height: 100vh;
}

#app-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 20px 24px;
  transition: margin-left 0.3s ease;
}

/* ---- TOPBAR (mobile only) ---- */
#topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  color: #fff;
  z-index: 1001;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#menu-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

#menu-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.topbar-brand {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  margin-left: 12px;
}

.topbar-brand i {
  color: var(--sidebar-active);
  margin-right: 6px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-username {
  font-size: 13px;
  color: #cbd5e1;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* ---- SIDEBAR ---- */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1002;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Header */
.sidebar-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.sidebar-logo i {
  color: var(--sidebar-active);
  font-size: 24px;
}

.logo-text {
  letter-spacing: 0.5px;
}

/* User info */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: var(--sidebar-text);
  font-size: 11px;
  margin-top: 2px;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.menu-item a:hover {
  color: #e2e8f0;
  background: var(--sidebar-hover);
}

.menu-item.active a {
  color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
  border-left-color: #93c5fd;
  font-weight: 600;
  border-radius: 0 6px 6px 0;
}

.menu-item.active a i {
  color: var(--sidebar-active);
}

.menu-item a i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.menu-item.disabled a {
  color: #475569;
  cursor: not-allowed;
  pointer-events: none;
}

.menu-badge {
  font-size: 10px;
  background: #475569;
  color: #94a3b8;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

/* Footer / Logout */
.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: auto;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #ef4444;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.sidebar-logout i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

/* ---- OVERLAY (mobile) ---- */
#sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* ==========================================
   RESPONSIVE - Mobile (<= 768px)
   ========================================== */
@media (max-width: 768px) {
  #topbar {
    display: flex;
  }

  #sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

  #app-content {
    margin-left: 0;
    padding-top: calc(var(--topbar-height) + 16px);
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ---- Tablet (769px - 1024px) ---- */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }

  .sidebar-logo {
    font-size: 17px;
  }

  .menu-item a {
    padding: 9px 16px;
    font-size: 13px;
  }

  #app-content {
    padding: 16px 18px;
  }
}

/* ==========================================
   SCROLLBAR cho sidebar
   ========================================== */
#sidebar::-webkit-scrollbar {
  width: 4px;
}

#sidebar::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

#id {
  background-color: aliceblue;
}
