:root {
  /* ArchitectUI Light Theme */
  --bg-body: #f1f4f6;
  --bg-sidebar: #fff;
  --bg-topbar: #fafbfc;
  --bg-card: #fff;
  --text-main: #495057;
  --text-muted: #888c9b;
  --border-color: rgba(0, 0, 0, 0.125);

  /* ArchitectUI Colors */
  --primary: #3f6ad8;
  --primary-hover: #2955c8;
  --success: #3ac47d;
  --danger: #d92550;
  --warning: #f7b924;
  --info: #16aaff;
  --purple: #6a0dad;
  --sidebar-w: 280px;
}

[data-theme="dark"] {
  /* Darker, deeper palette */
  --bg-body: #121212;
  --bg-sidebar: #1e1e1e;
  --bg-topbar: #1e1e1e;
  --bg-card: #252525;
  --text-main: #f3f4f6;
  --text-muted: #a1a1aa;
  --border-color: rgba(255, 255, 255, 0.12);

  /* Muted alert backgrounds for dark mode */
  --bs-alert-bg: rgba(63, 106, 216, 0.1);
  --bs-alert-border-color: rgba(63, 106, 216, 0.2);
  --bs-alert-color: #94a3b8;
}

[data-theme="dark"] .alert-success {
  background-color: rgba(58, 196, 125, 0.1) !important;
  border-color: rgba(58, 196, 125, 0.3) !important;
  color: #4ade80 !important;
}

[data-theme="dark"] .alert-warning {
  background-color: rgba(247, 185, 36, 0.1) !important;
  border-color: rgba(247, 185, 36, 0.3) !important;
  color: #fbbf24 !important;
}

[data-theme="dark"] .alert-danger {
  background-color: rgba(217, 37, 80, 0.1) !important;
  border-color: rgba(217, 37, 80, 0.3) !important;
  color: #f87171 !important;
}

[data-theme="dark"] .alert-primary {
  background-color: rgba(63, 106, 216, 0.15) !important;
  border-color: rgba(63, 106, 216, 0.4) !important;
  color: #60a5fa !important;
}

[data-theme="dark"] .table thead th {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .table-responsive {
  border-color: var(--border-color);
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  transition: width 0.3s;
  z-index: 1000;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .submenu-arrow {
  display: none;
}

.sidebar-brand {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  justify-content: space-between;
}

.brand-name {
  font-weight: bold;
  font-size: 1.2rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.sidebar-nav {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

/* Custom Scrollbar for Sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}
[data-theme="light"] .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.5rem;
  margin: 0;
  color: var(--text-main);
  text-decoration: none;
  border-radius: 0;
  transition: all 0.2s;
  font-weight: 500;
  font-size: 0.9rem;
  opacity: 0.8;
  position: relative;
}

.submenu-item {
  padding-left: 3rem !important;
  font-size: 0.85rem !important;
  opacity: 0.7 !important;
}

.submenu-item:hover {
  opacity: 1 !important;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  opacity: 0.5;
}

[aria-expanded="true"] .submenu-arrow {
  transform: rotate(180deg);
}

.nav-item i {
  width: 34px;
  text-align: center;
  margin-right: 10px;
  font-size: 1.2rem;
  opacity: 0.6;
  transition: color 0.2s;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.03);
  opacity: 1;
  color: var(--text-main);
}

.nav-item:hover i {
  opacity: 1;
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  opacity: 1;
  border-right: 4px solid var(--primary-hover);
}

.nav-item.active i {
  color: #ffffff;
  opacity: 1;
}

[data-theme="dark"] .nav-item.active {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed .nav-item {
  margin: 0;
  padding: 1rem 0;
  justify-content: center;
}

.sidebar.collapsed .nav-item i {
  margin-right: 0;
  font-size: 1.4rem;
}

/* Topbar */
.topbar {
  height: 60px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-w);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 999;
  transition: left 0.3s;
}

.sidebar.collapsed~.topbar {
  left: 70px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--text-main);
}

.profile-btn {
  background: none;
  border: none;
  color: var(--text-main);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* Main */
.main-content {
  margin-top: 60px;
  margin-left: var(--sidebar-w);
  padding: 30px;
  flex: 1;
  min-height: calc(100vh - 60px);
  transition: margin-left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sidebar.collapsed~.main-content {
  margin-left: 80px;
}

.card {
  background: var(--bg-card);
  border: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: 0.25rem;
  box-shadow: 0 0.46875rem 2.1875rem rgba(4, 9, 20, 0.03), 0 0.9375rem 1.40625rem rgba(4, 9, 20, 0.03), 0 0.25rem 0.53125rem rgba(4, 9, 20, 0.05), 0 0.125rem 0.1875rem rgba(4, 9, 20, 0.03);
  margin-bottom: 30px;
}

[data-theme="dark"] .card {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0.46875rem 2.1875rem rgba(0, 0, 0, 0.15), 0 0.9375rem 1.40625rem rgba(0, 0, 0, 0.15);
}

.table {
  color: var(--text-main);
}

[data-theme="dark"] .btn-outline-secondary:disabled,
[data-theme="dark"] .btn-outline-info:disabled {
  color: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  opacity: 0.6;
}

[data-theme="dark"] .table {
  --bs-table-color: var(--text-main);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-color);
  --bs-table-accent-bg: transparent;
  --bs-table-striped-color: var(--text-main);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-active-color: var(--text-main);
  --bs-table-active-bg: rgba(255, 255, 255, 0.1);
  --bs-table-hover-color: var(--text-main);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
}