/* ============================================================
   SIDEBAR NAVIGATION (Colapsable & Light)
   ============================================================ */

.videx-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 70px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  transition: width 300ms ease;
  z-index: 1020;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0,0,0,.05);
}

.videx-sidebar:hover {
  width: 250px;
}

/* ---- MOBILE RESPONSIVE ---- */
@media (max-width: 768px) {
  .videx-sidebar {
    width: 250px;
    transform: translateX(-100%);
    transition: transform 300ms ease;
    top: 56px;
    height: calc(100vh - 56px);
    z-index: 999;
    box-shadow: 4px 0 12px rgba(0,0,0,.15);
  }

  .videx-sidebar:hover {
    width: 250px;
    transform: translateX(-100%);
  }

  .videx-sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Backdrop overlay */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
    animation: fadeIn 0.3s ease;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

@media (max-width: 480px) {
  .videx-sidebar {
    width: 100%;
    max-width: 250px;
  }

  .sidebar-header {
    padding: 12px 8px;
  }

  .sidebar-logo {
    width: 32px;
    height: 32px;
  }

  .sidebar-menu {
    padding: 8px 0;
  }
}

/* ---- HEADER ---- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 8px;
  border-bottom: 1px solid #e5e7eb;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
  transition: transform 150ms ease;
}

.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  flex: 1;
  transition: opacity 150ms ease;
  cursor: pointer;
}

.sidebar-logo-link:hover {
  opacity: 0.8;
}

.sidebar-logo-link:hover .sidebar-logo {
  transform: scale(1.05);
}

.sidebar-title {
  font-weight: 700;
  font-size: 13px;
  color: #1f2937;
  white-space: nowrap;
  display: none;
}

.videx-sidebar:hover .sidebar-title {
  display: block;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: color 150ms ease;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.sidebar-toggle:hover {
  color: #1f2937;
  background: #f3f4f6;
}

/* ---- HAMBURGER BUTTON (Mobile) ---- */
.mobile-hamburger {
  display: none;
  background: none;
  border: none;
  color: #1f2937;
  cursor: pointer;
  padding: 8px 12px;
  font-size: 20px;
  z-index: 1021;
  position: fixed;
  left: 16px;
  top: 10px;
  transition: color 150ms ease;
}

.mobile-hamburger:hover {
  color: #2563eb;
}

@media (max-width: 768px) {
  .mobile-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Adjust navbar for hamburger button */
  .navbar {
    padding-left: 50px !important;
  }

  /* Adjust main content for hamburger button */
  .main-content {
    margin-left: 0 !important;
  }
}

/* ---- MAIN CONTENT ADJUSTMENTS ---- */
.main-content {
  margin-left: 70px;
  transition: margin-left 300ms ease;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
  }
}

/* ---- MENU ---- */
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.menu-group {
  margin-bottom: 8px;
}

.menu-group-title {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #9ca3af;
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: none;
  margin: 0;
}

.videx-sidebar:hover .menu-group-title {
  display: block;
}


.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 150ms ease;
  border-left: 3px solid transparent;
  white-space: nowrap;
}

/* MAIN CATEGORY ITEMS (clickable) */
.menu-main-cat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 150ms ease;
  border-left: 3px solid transparent;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.menu-main-cat i:first-child {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.menu-arrow {
  font-size: 12px !important;
  margin-left: auto;
  opacity: 0;
  transition: opacity 150ms ease;
}

.videx-sidebar:hover .menu-arrow {
  opacity: 1;
}

.menu-main-cat:hover {
  color: #2563eb;
  background: #eff6ff;
  border-left-color: #2563eb;
}

.menu-main-cat.active {
  color: #2563eb;
  background: #e0e8ff;
  border-left-color: #2563eb;
}

.menu-text {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.videx-sidebar:hover .menu-text {
  display: block;
}

/* SIDEBAR HOVER with active menu-item */
.menu-item:hover {
  color: #2563eb;
  background: #eff6ff;
  border-left-color: #2563eb;
}

.menu-item.active {
  color: #2563eb;
  background: #e0e8ff;
  border-left-color: #2563eb;
}

/* ---- FOOTER ---- */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  color: #1f2937;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.user-info i {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.user-name {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.videx-sidebar:hover .user-name {
  display: block;
}

.logout-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: #dc2626;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  transition: all 150ms ease;
  white-space: nowrap;
}

.logout-link i {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.logout-link span {
  display: none;
}

.videx-sidebar:hover .logout-link span {
  display: block;
}

.logout-link:hover {
  background: #fee2e2;
  color: #b91c1c;
}

/* ---- MAIN CONTENT AREA ---- */
.main-content {
  margin-left: 70px;
  transition: margin-left 300ms ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #f9fafb;
  overflow-y: auto;
  overflow-x: visible;
}

.videx-sidebar:hover ~ .main-content {
  margin-left: 250px;
}

/* ---- RESPONSIVE: MOBILE (< 768px) ---- */
@media (max-width: 767px) {
  .videx-sidebar {
    width: 250px;
    transform: translateX(-100%);
    box-shadow: 4px 0 12px rgba(0,0,0,.15);
  }

  .videx-sidebar:hover {
    width: 250px;
    transform: translateX(0);
  }

  .sidebar-title,
  .menu-text,
  .user-name,
  .logout-link span {
    display: block;
  }

  .sidebar-toggle {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .videx-sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-search-open ~ .main-content {
    filter: brightness(0.5);
    pointer-events: none;
  }
}

/* ---- ANIMATIONS ---- */
@keyframes sidebarSlideIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes sidebarSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

/* ---- SUBMENUS PANEL (lateral) ---- */
.submenus-panel {
  position: fixed;
  right: -350px;
  top: 0;
  width: 350px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e5e7eb;
  box-shadow: -4px 0 12px rgba(0,0,0,.1);
  z-index: 1019;
  transition: right 300ms ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.submenus-panel.open {
  right: 0;
}

.submenus-header {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.submenus-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
}

.close-btn {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms ease;
}

.close-btn:hover {
  color: #1f2937;
}

.submenus-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.submenu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #6b7280;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 150ms ease;
  border-left: 3px solid transparent;
}

.submenu-link:hover {
  color: #2563eb;
  background: #eff6ff;
  border-left-color: #2563eb;
}

.submenu-link i {
  font-size: 6px;
}

.no-submenu {
  padding: 24px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

/* ---- MAIN CONTENT ADJUSTMENT WHEN PANEL OPEN ---- */
.main-content {
  transition: margin-right 300ms ease;
}

.submenus-panel.open ~ .main-content,
.main-content.panel-open {
  margin-right: 350px;
}

/* ---- RESPONSIVE: MOBILE (< 768px) ---- */
@media (max-width: 767px) {
  .submenus-panel {
    width: 280px;
    right: -280px;
  }

  .main-content.panel-open {
    margin-right: 280px;
  }
}
