/* ============================================
   CPP LIBRARY - Menu ngang/dọc responsive
   Topbar + Dropdown + Sidebar (hamburger mobile)
   (Copy from 26_Dev-CPP, scoped for URL admin)
   ============================================ */

/* === TOPBAR === */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 0 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* ===== LIGHT THEME TOPBAR & DROPDOWN ===== */
body.theme-light .topbar {
  background: #ffffff !important;
  border-bottom-color: #e2e8f0;
  backdrop-filter: none;
}
body.theme-light .topbar .brand-title { color: #1a1a2e !important; }
body.theme-light .topbar .brand-sub   { color: #6c757d !important; }
body.theme-light .horizontal-menu .nav-link,
body.theme-light .menu-dropdown-toggle {
  color: #1a1a2e !important;
}
body.theme-light .horizontal-menu .nav-link:hover,
body.theme-light .menu-dropdown-toggle:hover {
  border-color: #dc3545 !important;
  color: #dc3545 !important;
  background: rgba(220,53,69,0.07) !important;
}
body.theme-light .menu-dropdown.open .menu-dropdown-toggle {
  color: #0d6efd !important;
  background: rgba(13,110,253,0.1) !important;
}
body.theme-light .menu-dropdown-content {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.06) !important;
}
body.theme-light .menu-dropdown-item { color: #1a1a2e !important; }
body.theme-light .menu-dropdown-item:hover {
  border-color: #dc3545 !important;
  color: #dc3545 !important;
  background: rgba(220,53,69,0.07) !important;
}
body.theme-light .menu-dropdown-item i { color: #6c757d !important; }
body.theme-light .menu-dropdown-item:hover i { color: #dc3545 !important; }
body.theme-light .menu-dropdown-arrow { color: #6c757d !important; }
body.theme-light .topbar .btn-icon { color: #1a1a2e !important; }
body.theme-light .topbar .btn-icon:hover {
  background: rgba(13,110,253,0.1) !important;
  color: #0d6efd !important;
}

/* Dark: giống 22_URL/index.html - màu ấm + hover nổi bật */
body.theme-dark .topbar {
  background: #4a423b !important;
  border-bottom-color: #6c635a;
  backdrop-filter: none;
}
body.theme-dark .topbar .brand-title { color: #f4ece6 !important; }
body.theme-dark .topbar .brand-sub   { color: #d0c5bd !important; }
body.theme-dark .horizontal-menu .nav-link,
body.theme-dark .menu-dropdown-toggle {
  color: #d0c5bd !important;
}
body.theme-dark .horizontal-menu .nav-link:hover,
body.theme-dark .menu-dropdown-toggle:hover {
  border-color: #dc3545 !important;
  color: #dc3545 !important;
  background: rgba(220,53,69,0.12) !important;
}
body.theme-dark .menu-dropdown.open .menu-dropdown-toggle {
  background: rgba(255,255,255,0.12) !important;
  color: #fff !important;
}
body.theme-dark .topbar .btn-icon {
  color: #d0c5bd !important;
}
body.theme-dark .topbar .btn-icon:hover {
  background: rgba(255,255,255,0.14) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.2) !important;
}
/* Dropdown dark: nền ấm, không trắng */
body.theme-dark .menu-dropdown-content {
  background: #3d3630 !important;
  border-color: #6c635a !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35) !important;
}
body.theme-dark .menu-dropdown-item {
  color: #d0c5bd !important;
}
body.theme-dark .menu-dropdown-item:hover {
  border-color: #dc3545 !important;
  color: #dc3545 !important;
  background: rgba(220,53,69,0.14) !important;
}
body.theme-dark .menu-dropdown-item i { color: #c4b8ae !important; }
body.theme-dark .menu-dropdown-item:hover i { color: #dc3545 !important; }

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
  overflow: visible;
}

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

/* Brand */
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.topbar .brand:hover { text-decoration: none; color: inherit; }

.topbar .brand-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
}

.topbar .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar .brand-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar .brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar .brand-title span { color: var(--accent-cpp); }

/* Brand short: bỏ tagline ở trang con (chỉ icon + Library) */
.topbar .brand-short .brand-sub { display: none; }

/* === MENU NGANG (Horizontal) === */
.horizontal-menu {
  flex: 1;
  min-width: 0;
  margin-left: 0.5rem;
  display: flex;
  align-items: center;
  overflow: visible;
}

.horizontal-menu .menu-container {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: max-content;
  height: 100%;
  overflow: visible;
}

.horizontal-menu .nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
  border: 1.5px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.horizontal-menu .nav-link:hover {
  color: #dc3545;
  background: rgba(220,53,69,0.07);
  border-color: #dc3545;
}

.horizontal-menu .nav-link.active {
  color: #0d6efd;
  background: rgba(13,110,253,0.1);
  border-color: transparent;
  font-weight: 600;
}

/* === DROPDOWN === */
.menu-dropdown {
  position: relative;
  display: inline-block;
  overflow: visible;
}

.menu-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  color: var(--text-secondary);
  background: none;
  border: 1.5px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.menu-dropdown-toggle:hover {
  color: #dc3545;
  background: rgba(220,53,69,0.07);
  border-color: #dc3545;
}

.menu-dropdown.open .menu-dropdown-toggle {
  color: #0d6efd;
  background: rgba(13,110,253,0.1);
  border-color: transparent;
}

.menu-dropdown-arrow {
  font-size: 0.65rem;
  margin-left: 0.2rem;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.menu-dropdown.open .menu-dropdown-arrow {
  transform: rotate(180deg);
}

.menu-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
  z-index: 10001;
  overflow: hidden;
  padding: 0.35rem;
  animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.menu-dropdown.open .menu-dropdown-content {
  display: block;
}

.menu-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  color: #1a1a2e;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1.5px solid transparent;
  margin: 2px 0;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.menu-dropdown-item:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: rgba(220,53,69,0.07);
  text-decoration: none;
}

.menu-dropdown-item.active {
  background: rgba(13,110,253,0.1);
  color: #0d6efd;
  font-weight: 600;
  border-color: transparent;
}

.menu-dropdown-item i {
  width: 18px;
  text-align: center;
  color: #6c757d;
  font-size: 0.875rem;
  transition: color 0.18s ease;
}

.menu-dropdown-item:hover i { color: #dc3545; }
.menu-dropdown-item.active i { color: #0d6efd; }

/* Nút icon topbar */
.topbar .btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.topbar .btn-icon:hover {
  background: rgba(13, 110, 253, 0.12);
  border-color: rgba(13, 110, 253, 0.3);
  color: #0d6efd;
  transform: scale(1.08);
}

.topbar .sidebar-toggle {
  display: none;
}

/* === SIDEBAR (Mobile): theo theme sáng/tối === */
.cpp-sidebar {
  display: none;
  position: fixed;
  left: -280px;
  top: 56px;
  width: 260px;
  height: calc(100vh - 56px);
  background: #ffffff;
  color: #212529;
  border-right: 1px solid #dee2e6;
  box-shadow: 2px 0 16px rgba(0,0,0,0.12);
  z-index: 1001;
  transition: left 0.3s ease;
  overflow-y: auto;
}

/* Dark theme: sidebar tối giống màu đã chọn */
body.theme-dark .cpp-sidebar {
  background: #3d3630 !important;
  color: #f4ece6 !important;
  border-right-color: #6c635a !important;
}
body.theme-dark .cpp-sidebar .sidebar-section-title,
body.theme-dark .cpp-sidebar .sidebar-admin-section .sidebar-section-title {
  color: #c4b8ae !important;
}
body.theme-dark .cpp-sidebar .sidebar-admin-section {
  border-top-color: #6c635a !important;
}
body.theme-dark .cpp-sidebar .sidebar-admin-section .sidebar-nav-divider {
  background: #6c635a !important;
}
body.theme-dark .cpp-sidebar .sidebar-nav .menu-dropdown-content,
body.theme-dark .cpp-sidebar .sidebar-admin-section .menu-dropdown-content {
  border-left-color: #6c635a !important;
}

body.sidebar-open .cpp-sidebar {
  left: 0;
}

/* Viền/divider sidebar sáng */
.cpp-sidebar .sidebar-admin-section {
  border-top-color: #dee2e6;
}
.cpp-sidebar .sidebar-admin-section .sidebar-nav-divider {
  background: #dee2e6;
}
.cpp-sidebar .sidebar-nav .menu-dropdown-content {
  border-left-color: #dee2e6;
}
/* Xóa nền tối dropdown trong sidebar */
.cpp-sidebar .menu-dropdown-content {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  animation: none !important;
}
/* Sidebar dropdown item: viền đỏ khi hover */
.cpp-sidebar .menu-dropdown-item {
  color: #212529 !important;
  background: transparent !important;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.cpp-sidebar .menu-dropdown-item:hover {
  border-color: #dc3545 !important;
  color: #dc3545 !important;
  background: rgba(220,53,69,0.07) !important;
}
/* Dark theme sidebar dropdown item */
body.theme-dark .cpp-sidebar .menu-dropdown-item { color: #d0c5bd !important; }
body.theme-dark .cpp-sidebar .menu-dropdown-item:hover { color: #dc3545 !important; background: rgba(220,53,69,0.14) !important; }

.cpp-sidebar-inner {
  padding: 1rem 0.75rem;
}

.cpp-sidebar .search-container {
  padding: 0 0.75rem 1rem;
  margin: 0;
  max-width: none;
}

.cpp-sidebar .search-input {
  width: 100%;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: #212529;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-nav .nav-link:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: rgba(220,53,69,0.06);
  text-decoration: none;
}

.sidebar-nav .nav-link i {
  width: 20px;
  text-align: center;
  color: #6c757d;
  font-size: 0.9rem;
  transition: color 0.18s ease;
}
.sidebar-nav .nav-link:hover i { color: #dc3545; }

/* Dark theme: sidebar nav-link text sáng */
body.theme-dark .sidebar-nav .nav-link { color: #f4ece6 !important; }
body.theme-dark .sidebar-nav .nav-link i { color: #d0c5bd !important; }
body.theme-dark .sidebar-nav .nav-link:hover { color: #dc3545 !important; background: rgba(220,53,69,0.12) !important; }
body.theme-dark .sidebar-nav .nav-link:hover i { color: #dc3545 !important; }

/* Sidebar dropdown */
.sidebar-nav .menu-dropdown {
  display: block;
}

.sidebar-nav .menu-dropdown-toggle {
  width: 100%;
  justify-content: flex-start;
  padding: 0.75rem 1rem;
  text-align: left;
}

.sidebar-nav .menu-dropdown-content {
  position: static;
  box-shadow: none;
  border: none;
  background: transparent !important;
  margin: 0.25rem 0 0.5rem 0.75rem;
  padding: 0.25rem 0;
  border-left: 2px solid #dee2e6;
  padding-left: 0.75rem;
  display: none;
}

.sidebar-nav .menu-dropdown.open .menu-dropdown-content {
  display: block;
}

.sidebar-nav .menu-dropdown-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #212529 !important;
  background: transparent !important;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.sidebar-nav .menu-dropdown-item:hover {
  border-color: #dc3545 !important;
  color: #dc3545 !important;
  background: rgba(220,53,69,0.06) !important;
}

/* Admin section in sidebar */
.sidebar-admin-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-admin-section .sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  opacity: 1;
  padding: 0 1rem 0.5rem;
  margin-bottom: 0.25rem;
}

.sidebar-admin-section .sidebar-nav-divider {
  display: block;
  height: 1px;
  background: var(--border);
  margin: 0.5rem 1rem;
}

.sidebar-admin-section .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: #212529;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-admin-section .nav-link:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: rgba(220,53,69,0.06);
}

.sidebar-admin-section .nav-link.active {
  background: rgba(13,110,253,0.1);
  color: #0d6efd;
  font-weight: 600;
  border-color: #0d6efd;
}

/* Dark theme: admin nav-link */
body.theme-dark .sidebar-admin-section .nav-link { color: #f4ece6 !important; }
body.theme-dark .sidebar-admin-section .nav-link:hover { color: #dc3545 !important; background: rgba(220,53,69,0.12) !important; }
body.theme-dark .sidebar-admin-section .nav-link.active { color: #93c5fd !important; background: rgba(147,197,253,0.12) !important; border-color: #93c5fd !important; }

.sidebar-admin-section .nav-link .badge {
  margin-left: auto;
  background: rgba(13, 110, 253, 0.15);
  color: #0d6efd;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.sidebar-admin-section .nav-link.active .badge {
  background: rgba(255, 255, 255, 0.3);
}

.sidebar-admin-section .menu-dropdown {
  display: block;
}

.sidebar-admin-section .menu-dropdown-toggle {
  width: 100%;
  justify-content: flex-start;
  padding: 0.65rem 1rem;
  text-align: left;
  background: none;
  border: 1.5px solid transparent;
  color: #212529;
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-admin-section .menu-dropdown-toggle:hover {
  border-color: #dc3545;
  color: #dc3545;
  background: rgba(220,53,69,0.06);
}

body.theme-dark .sidebar-admin-section .menu-dropdown-toggle { color: #f4ece6 !important; }
body.theme-dark .sidebar-admin-section .menu-dropdown-toggle:hover { color: #dc3545 !important; background: rgba(220,53,69,0.12) !important; }

.sidebar-admin-section .menu-dropdown-content {
  position: static;
  box-shadow: none;
  border: none;
  background: transparent !important;
  margin: 0.25rem 0 0.5rem 0.75rem;
  padding: 0.25rem 0;
  border-left: 2px solid #dee2e6;
  padding-left: 0.75rem;
  display: none;
}

.sidebar-admin-section .menu-dropdown.open .menu-dropdown-content {
  display: block;
}

.sidebar-admin-section .menu-dropdown-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #212529 !important;
  background: transparent !important;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.sidebar-admin-section .menu-dropdown-item:hover {
  border-color: #dc3545 !important;
  color: #dc3545 !important;
  background: rgba(220,53,69,0.06) !important;
}

.sidebar-admin-section .menu-dropdown.active .menu-dropdown-toggle,
.sidebar-admin-section .menu-dropdown.open .menu-dropdown-toggle {
  color: #0d6efd;
  background: rgba(13, 110, 253, 0.08);
}

/* Backdrop: nhẹ, không blur, chỉ phủ phần ngoài menu */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 1000;
  backdrop-filter: none;
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

/* Responsive: hamburger + sidebar */
@media (max-width: 900px) {
  .horizontal-menu {
    display: none !important;
  }

  .topbar .sidebar-toggle {
    display: inline-flex !important;
  }

  .cpp-sidebar {
    display: block;
  }
}

@media (max-width: 600px) {
  .topbar .search-container {
    display: none;
  }

  .cpp-sidebar .search-container {
    display: block;
  }
}

