/* Sidebar Styles */
.sidebar {
  width: 280px;
  background-color: var(--surface);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  position: fixed;
  left: 0;
  z-index: 1000;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5); /* mờ */
  z-index: 100; /* dưới sidebar (sidebar nên là z-index 40) */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-collapsed {
  width: 90px;
}

.sidebar-collapsed .sidebar-text,
.sidebar-collapsed .sidebar-brand,
.sidebar-collapsed .user-name,
.sidebar-collapsed .user-role {
  display: none;
}

.sidebar-collapsed .sidebar-header-content {
  justify-content: center;
}

.sidebar-collapsed .sidebar-nav-content {
  align-items: center;
}

.sidebar-collapsed .user-profile {
  display: grid;
  justify-content: center;
  gap: 10px;
}

.sidebar-collapsed .user-profile-content {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-header-content {
  display: flex;
  align-items: center;
  padding: 15px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 12px;
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 600;
}

.sidebar-nav {
  flex-grow: 1;
  padding: 10px;
}

.sidebar-nav-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px;
  gap: 10px;
}

.menu-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
}

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background-color 0.2s;
}

.menu-item:hover {
  background-color: var(--table-row-bg);
}

.menu-item-active {
  background-color: rgba(var(--mkt-primary-raw), 0.1);
  color: var(--primary);
}

.menu-icon {
  margin-right: 12px;
  font-size: 18px;
}

.user-profile {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.user-profile-content {
  display: flex;
  align-items: center;
  justify-content: left;
  gap: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

.user-role {
  font-size: 12px;
  color: var(--muted);
}

.user-actions {
  display: flex;
  gap: 8px;
}

.action-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.action-button:hover {
  background-color: var(--table-row-bg);
}

.action-icon {
  font-size: 16px;
}

.settings-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--surface);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 50;
  position: absolute;
  left: 20px;
  bottom: 130px;
  width: 160px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  text-align: left;
}

.user-menu-item:hover,
.settings-menu-item:hover {
  background-color: rgba(var(--mkt-primary-raw), 0.1);
  color: var(--primary);
}

.settings-menu-button {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.version-info {
  padding: 0 5px 20px;
  text-align: center;
}

.version-text {
  font-size: 12px;
  color: var(--muted);
}

/* Main Content Styles */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  margin-left: 280px;
  transition: margin-left 0.3s ease;
}

.main-content-expanded {
  margin-left: 100px;
}

/* ============================================================================
   MODERN HEADER REDESIGN - App-Tho
   ============================================================================ */

header {
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  background: transparent;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: fixed;
  top: 0;
  left: 290px;
  right: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

.main-content-expanded header {
  left: 100px;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
}

.header-container h1 {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.025em;
  margin: 0;
}

.header-container .mobile-sidebar-toggle {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.header-container .mobile-sidebar-toggle:hover {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-color: #3b82f6;
  color: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
}

.header-container .mobile-sidebar-toggle:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .header-container .mobile-sidebar-toggle {
    display: none;
  }
}

.header-container .user-menu-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 0.375rem 0.625rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header-container .user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid #3b82f6;
  cursor: pointer;
  object-fit: cover;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.header-container .user-avatar:hover {
  transform: scale(1.1);
  border-color: #2563eb;
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 3.5rem;
}

.header-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Toggle Switch - Modern Design */
.toggle-switch-container {
  display: flex;
  align-items: center;
}

.toggle-switch-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  gap: 0.5rem;
}

.toggle-switch-wrapper input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  width: 2.75rem;
  height: 1.375rem;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-radius: 9999px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  border: 1px solid #cbd5e1;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch::before {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
  left: 0.1875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch:hover {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  border-color: #94a3b8;
}

/* When toggled via class */
.toggle-switch.toggled {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-color: #16a34a;
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.toggle-switch.toggled::before {
  transform: translate(1.1875rem, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.toggle-switch.toggled:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

/* Alternative: When controlled by input checkbox */
.toggle-switch-wrapper input[type='checkbox']:checked + .toggle-switch {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-color: #16a34a;
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.toggle-switch-wrapper input[type='checkbox']:checked + .toggle-switch::before {
  transform: translate(1.1875rem, -50%);
}

.toggle-switch-wrapper input[type='checkbox']:checked + .toggle-switch:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.staff-status-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  transition: color 0.3s ease;
}

.staff-status-label.active {
  color: #16a34a;
}

.user-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  width: 160px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 50;
}

.user-menu span,
.user-menu a,
.user-menu button {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.user-menu span:hover,
.user-menu a:hover,
.user-menu button:hover {
  background-color: rgba(var(--mkt-primary-raw), 0.1);
  color: var(--primary);
}

main {
  flex: 1;
}

.content-section {
  display: block;
  margin-top: 100px;
}

.content-section.hidden {
  display: none;
}

/* ============================================================================
   RESPONSIVE DESIGN - Mobile Optimizations
   ============================================================================ */

@media (max-width: 768px) {
  .content-section {
    margin-top: 120px;
  }

  .sidebar {
    top: 120px;
    height: fit-content;
    position: fixed;
    text-align: center;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .sidebar-nav-content {
    gap: inherit;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar:not(.sidebar-collapsed) {
    transform: translateX(0);
  }

  .sidebar.sidebar-collapsed {
    transform: translateX(-100%);
  }

  .sidebar.sidebar-collapsed.open {
    transform: translateX(0);
  }

  /* Compact Header on Mobile */
  header {
    left: 0;
    padding: 0.75rem 1rem;
  }

  .header-container h1 {
    font-size: 1rem;
  }

  .header-container .user-menu-container {
    gap: 0.375rem;
    padding: 0.25rem 0.375rem;
  }

  .header-container .user-avatar {
    width: 1.625rem;
    height: 1.625rem;
  }

  .header-left {
    gap: 0.5rem;
  }

  .toggle-switch {
    width: 2.25rem;
    height: 1.125rem;
  }

  .toggle-switch::before {
    width: 0.75rem;
    height: 0.75rem;
    left: 0.1875rem;
  }

  .toggle-switch.toggled::before,
  .toggle-switch-wrapper input[type='checkbox']:checked + .toggle-switch::before {
    transform: translate(1rem, -50%);
  }

  .staff-status-label {
    font-size: 0.75rem;
  }

  .main-content {
    margin-left: 0;
  }

  .main-content-expanded {
    margin-left: 0;
  }

  .main-content-expanded header {
    left: 0;
  }

  .user-actions {
    justify-content: center;
  }

  .menu-header {
    justify-content: space-between;
    margin: 5px;
    padding: 5px;
  }

  .menu-title {
    font-size: 14px;
  }

  .menu-toggle {
    font-size: 14px;
  }

  .sidebar-header-content {
    justify-content: center;
    padding: 10px;
  }

  .version-info {
    font-size: xx-small;
  }

  .user-profile-content {
    justify-content: center;
  }
}

/* ============================================================================
   DARK MODE SUPPORT - Header & Controls
   ============================================================================ */

body.mkt192-dark header {
  background: linear-gradient(to right, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.98));
  border-bottom-color: rgba(75, 85, 99, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.mkt192-dark .header-container h1 {
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.mkt192-dark .header-container .mobile-sidebar-toggle {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  border-color: #475569;
  color: #94a3b8;
}

body.mkt192-dark .header-container .mobile-sidebar-toggle:hover {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  border-color: #60a5fa;
  color: #60a5fa;
  box-shadow: 0 4px 8px rgba(96, 165, 250, 0.2);
}

body.mkt192-dark .header-container .user-menu-container {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.mkt192-dark .header-container .user-avatar {
  border-color: #60a5fa;
  box-shadow: 0 2px 4px rgba(96, 165, 250, 0.3);
}

body.mkt192-dark .header-container .user-avatar:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 8px rgba(96, 165, 250, 0.4);
}

body.mkt192-dark .toggle-switch {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  border-color: #475569;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.mkt192-dark .toggle-switch::before {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
}

body.mkt192-dark .toggle-switch:hover {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

body.mkt192-dark .toggle-switch.toggled,
body.mkt192-dark .toggle-switch-wrapper input[type='checkbox']:checked + .toggle-switch {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border-color: #15803d;
  box-shadow: 0 2px 4px rgba(22, 163, 74, 0.4);
}

body.mkt192-dark .staff-status-label {
  color: #94a3b8;
}

body.mkt192-dark .staff-status-label.active {
  color: #22c55e;
}
