/* ============================================================
   Panelux - Main Stylesheet (Bootstrap 5 HTML Version)
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&amp;display=swap');

/* ============================================================
   CSS Custom Properties (Light Mode - Default)
   ============================================================ */
:root {
  --body-bg: #f4f5fa;
  --card-bg: #ffffff;
  --card-border: #e8e8ef;
  --header-bg: #ffffff;
  --header-border: #e8e8ef;
  --dropdown-bg: #ffffff;
  --dropdown-border: #e8e8ef;
  --input-bg: #ffffff;
  --input-border: #e2e8f0;
  --text-primary: #2d3436;
  --text-secondary: #6e6b7b;
  --text-muted: #a0a0b0;
  --text-heading: #333;
  --surface-hover: #f4f5fa;
  --surface-alt: #f8f8fb;
  --surface-border: #e8e8ef;
  --table-bg: #ffffff;
  --table-border: #e8e8ef;
  --table-hover: #f8f8fb;
  --table-stripe: #fafafe;
  --list-group-bg: #ffffff;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --shadow-lg: rgba(0, 0, 0, 0.12);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --scrollbar-track: #f1f1f1;
  --scrollbar-thumb: #c1c1c1;
  --scrollbar-thumb-hover: #a1a1a1;
  --kbd-bg: #e8e8ef;
  --badge-subtle-bg: rgba(108, 92, 231, 0.1);
  --code-bg: #f4f5fa;
  --modal-bg: #ffffff;
  --breadcrumb-divider-color: #6c757d;
  --bs-body-bg: #f4f5fa;
  --bs-body-color: #2d3436;
  --bs-card-bg: #ffffff;
  --bs-card-border-color: #e8e8ef;
  --bs-border-color: #e8e8ef;
  --bs-tertiary-bg: #f8f8fb;
}

/* ============================================================
   Dark Mode
   ============================================================ */
[data-theme="dark"] {
  --body-bg: #0c0a1d;
  --card-bg: #0f172a;
  --card-border: #1e1b4b;
  --header-bg: #0f172a;
  --header-border: #1e1b4b;
  --dropdown-bg: #131136;
  --dropdown-border: #1e1b4b;
  --input-bg: #131136;
  --input-border: #1e1b4b;
  --text-primary: #e2e4e9;
  --text-secondary: #a0a3b1;
  --text-muted: #6b6e7e;
  --text-heading: #f0f0f5;
  --surface-hover: #131136;
  --surface-alt: #0e0d24;
  --surface-border: #1e1b4b;
  --table-bg: #0f172a;
  --table-border: #1e1b4b;
  --table-hover: #131136;
  --table-stripe: #0e0d24;
  --list-group-bg: #0f172a;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-lg: rgba(0, 0, 0, 0.4);
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --scrollbar-track: #0e0d24;
  --scrollbar-thumb: #1e1b4b;
  --scrollbar-thumb-hover: #252154;
  --kbd-bg: #1e1b4b;
  --badge-subtle-bg: rgba(108, 92, 231, 0.2);
  --code-bg: #131136;
  --modal-bg: #131136;
  --breadcrumb-divider-color: #6b6e7e;
  --bs-body-bg: #0c0a1d;
  --bs-body-color: #e2e4e9;
  --bs-card-bg: #0f172a;
  --bs-card-border-color: #1e1b4b;
  --bs-border-color: #1e1b4b;
  --bs-tertiary-bg: #0e0d24;
}

/* ============================================================
   Base Styles
   ============================================================ */
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  background-color: var(--body-bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: #6C5CE7;
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: #5a47d0;
}

/* ============================================================
   Layout System
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--body-bg);
  transition: background-color 0.3s ease;
}

.admin-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: 260px;
  transition: margin-left 0.3s ease;
  overflow-x: hidden;
}

.admin-content {
  flex: 1;
  margin-top: 64px;
}

/* Horizontal Layout */
.layout-horizontal .admin-main-wrapper {
  margin-left: 0 !important;
}
.layout-horizontal .admin-content {
  margin-top: 110px;
}

/* Boxed Layout */
.layout-boxed {
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  position: relative;
}

/* Boxed: Sidebar stays fixed but within the boxed container */
.layout-boxed .sidebar {
  position: fixed !important;
  top: 0;
  left: auto !important;
  height: 100vh;
  flex-shrink: 0;
  z-index: 1050;
}

/* Boxed: Header becomes sticky instead of fixed */
.layout-boxed .admin-header {
  position: sticky !important;
  top: 0;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  transform: none !important;
  max-width: none !important;
}

/* Boxed: Main wrapper margin for sidebar */
.layout-boxed .admin-main-wrapper {
  margin-left: 260px !important;
  margin-right: 0 !important;
}

/* Boxed: Content no margin-top since header is sticky in-flow */
.layout-boxed .admin-content {
  margin-top: 0 !important;
  min-height: calc(100vh - 64px);
}

/* Boxed + Horizontal: no sidebar margin */
.layout-boxed.layout-horizontal .admin-main-wrapper {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Boxed: Horizontal nav sticky */
.layout-boxed .horizontal-nav {
  position: sticky !important;
  top: 64px;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  transform: none !important;
  max-width: none !important;
}

/* RTL + Boxed */
[dir="rtl"] .layout-boxed .sidebar {
  left: auto !important;
  right: auto !important;
}
[dir="rtl"] .layout-boxed .admin-main-wrapper {
  margin-left: 0 !important;
  margin-right: 260px !important;
}
[dir="rtl"] .layout-boxed.layout-horizontal .admin-main-wrapper {
  margin-right: 0 !important;
}

@media (max-width: 1199.98px) {
  .layout-boxed .admin-main-wrapper {
    margin-left: 0 !important;
  }
  [dir="rtl"] .layout-boxed .admin-main-wrapper {
    margin-right: 0 !important;
  }
}

/* Mobile overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  transition: opacity 0.3s ease;
  display: none;
}
.sidebar-mobile-open .sidebar-overlay {
  display: block;
}

@media (max-width: 1199.98px) {
  .admin-main-wrapper {
    margin-left: 0 !important;
  }
  .layout-horizontal .admin-content {
    margin-top: 64px;
  }
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: linear-gradient(165deg, #1e1b4b 0%, #0f172a 50%, #0c0a1d 100%);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.25);
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.3) 0%, rgba(99, 102, 241, 0.15) 40%, rgba(167, 139, 250, 0.05) 100%);
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  min-height: 64px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  overflow: hidden;
}
.brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}
.btn-close-sidebar {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  display: none;
}
.btn-close-sidebar:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Menu Wrapper */
.sidebar-menu-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  padding: 6px 0;
}
.sidebar-menu-wrapper::-webkit-scrollbar { width: 4px; }
.sidebar-menu-wrapper::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Group Headers */
.sidebar-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 8px;
  white-space: nowrap;
  overflow: hidden;
}
.group-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(167, 139, 250, 0.5);
  flex-shrink: 0;
}
.group-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.15), transparent);
}

/* Menu List */
.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-menu-item {
  margin: 2px 10px;
}

/* Icon Wrapper */
.sidebar-icon-wrap {
  min-width: 32px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  transition: all 0.25s ease;
}

/* Sidebar Links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.25s ease;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.sidebar-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}
.sidebar-link:hover .sidebar-icon-wrap {
  background: rgba(167, 139, 250, 0.12);
}
.sidebar-link:hover .sidebar-icon {
  color: #a78bfa;
}
.sidebar-link.active,
.sidebar-menu-item.active > .sidebar-link {
  color: #fff;
  background: rgba(167, 139, 250, 0.12);
}
.sidebar-link.active::before,
.sidebar-menu-item.active > .sidebar-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #a78bfa, #7c3aed);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
}
.sidebar-link.active .sidebar-icon-wrap,
.sidebar-menu-item.active > .sidebar-link .sidebar-icon-wrap {
  background: rgba(167, 139, 250, 0.2);
}
.sidebar-link.active .sidebar-icon,
.sidebar-menu-item.active > .sidebar-link .sidebar-icon {
  color: #a78bfa;
}

.sidebar-icon {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  transition: color 0.25s;
}
.sidebar-text {
  font-size: 0.84rem;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Badge */
.sidebar-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  background: rgba(167, 139, 250, 0.2);
  color: #a78bfa;
}
.sidebar-badge.badge-danger {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}
.sidebar-badge.badge-success {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
}
.sidebar-badge.badge-warning {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

/* Sidebar Chevron */
.sidebar-chevron {
  font-size: 0.55rem;
  transition: transform 0.3s ease;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.2);
}
.sidebar-chevron.rotated {
  transform: rotate(90deg);
}

/* Submenu */
.sidebar-submenu {
  list-style: none;
  padding: 2px 0 2px 0;
  margin: 0;
  display: none;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.sidebar-submenu.nested {
  padding-left: 10px;
}
.sidebar-menu-item.submenu-open > .sidebar-submenu {
  display: block;
}
.sidebar-submenu-item {
  margin: 0;
}
.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 20px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  border-radius: 8px;
  margin: 1px 10px;
  transition: all 0.2s ease;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-sublink:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}
.sidebar-sublink.active {
  color: #a78bfa;
}
.sidebar-sublink.active .sidebar-bullet {
  background: #a78bfa;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
  width: 7px;
  height: 7px;
}
.sidebar-bullet {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  transition: all 0.25s;
}
.sidebar-bullet.small {
  width: 4px;
  height: 4px;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 16px;
}
.sidebar-footer-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.footer-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}
.footer-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.footer-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.footer-role {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
}

/* Mobile Sidebar */
@media (max-width: 1199.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.sidebar-mobile-open {
    transform: translateX(0);
    width: 260px !important;
  }
  .btn-close-sidebar {
    display: block;
  }
}

/* ============================================================
   Header
   ============================================================ */
.admin-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 64px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  z-index: 1030;
  padding-left: 260px;
  transition: padding-left 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-brand {
  display: none;
  align-items: center;
  text-decoration: none;
}
.mobile-brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: var(--surface-hover);
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  position: relative;
}
.header-btn:hover {
  background: var(--surface-border);
  color: #7c6bf0;
}
.sidebar-toggle {
  display: none;
}

/* Language button */
.lang-btn {
  width: auto !important;
  padding: 0 12px !important;
  gap: 6px;
}
.lang-code {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.lang-arrow {
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-left: 2px;
  transition: transform 0.2s;
}

/* Language dropdown */
.lang-dropdown {
  min-width: 220px !important;
  padding: 6px !important;
}
.lang-dropdown-header {
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 4px;
}
.lang-dropdown-header span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lang-dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  white-space: nowrap;
}
.lang-dropdown-item:hover,
.lang-dropdown-item:focus {
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
}
.lang-dropdown-item.is-active {
  background: rgba(124, 107, 240, 0.1) !important;
}
.lang-dropdown-item.is-active .lang-item-name {
  color: #7c6bf0;
  font-weight: 600;
}
.lang-dropdown-item.is-active .lang-item-check {
  color: #7c6bf0;
}
.lang-item-badge {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}
.lang-item-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
}
.lang-item-check {
  font-size: 0.75rem;
  margin-left: auto;
}

/* Search bar */
.header-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--surface-hover);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 200px;
}
.header-search:hover {
  background: var(--surface-alt);
}
.header-search .search-icon {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.header-search .search-placeholder {
  color: var(--text-muted);
  font-size: 0.875rem;
  flex: 1;
}
.search-kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-family: inherit;
  background: var(--kbd-bg);
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Notification badge */
.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: #ea5455;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Header dropdowns */
.header-dropdown {
  border: 1px solid var(--dropdown-border);
  border-radius: 12px;
  box-shadow: 0 8px 30px var(--shadow-color);
  min-width: 200px;
  overflow: hidden;
  margin-top: 8px;
  background: var(--dropdown-bg);
}

/* Notifications dropdown */
.notifications-dropdown {
  min-width: 360px;
}
.notifications-list {
  max-height: 320px;
  overflow-y: auto;
}
.notification-item {
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  border-bottom: 1px solid var(--surface-border);
}
.notification-item:hover {
  background: var(--surface-hover);
}
.notification-item.unread {
  background: var(--surface-alt);
}
.notification-item:last-child {
  border-bottom: none;
}
.notification-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.notification-text {
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-primary);
}

/* User dropdown */
.header-user-btn {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s;
  margin-inline-start: 4px;
}
.header-user-btn:hover {
  background: var(--surface-hover);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6bf0, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.user-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6bf0, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-initials {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}
.user-avatar-lg .avatar-initials {
  font-size: 1rem;
}
.user-dropdown {
  min-width: 240px;
}
.user-dropdown .dropdown-item {
  font-size: 0.875rem;
  border-radius: 6px;
  margin: 0 6px;
  width: auto;
}
.user-dropdown .dropdown-item:hover {
  background: var(--surface-hover);
}

/* Header responsive */
@media (max-width: 1199.98px) {
  .admin-header {
    padding-left: 0 !important;
  }
  .sidebar-toggle {
    display: flex;
  }
  .mobile-brand {
    display: flex;
  }
}
@media (max-width: 575.98px) {
  .header-search {
    display: none !important;
  }
  .notifications-dropdown {
    min-width: 300px;
  }
}

/* ============================================================
   Search Modal
   ============================================================ */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}
.search-overlay.show {
  display: flex;
}
.search-modal {
  background: var(--modal-bg);
  border-radius: 16px;
  width: 560px;
  max-width: 90vw;
  box-shadow: 0 20px 60px var(--shadow-lg);
  overflow: hidden;
}
.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-border);
}
.search-modal-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
  color: var(--text-primary);
}
.search-modal-input::placeholder {
  color: var(--text-muted);
}
.search-modal-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text-primary);
  border-radius: 8px;
  transition: background 0.15s;
}
.search-result-item:hover {
  background: var(--surface-hover);
  color: #7c6bf0;
}

/* ============================================================
   Footer
   ============================================================ */
.admin-footer {
  padding: 16px 0;
  border-top: 1px solid var(--surface-border);
  background: var(--card-bg);
  font-size: 0.84rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.footer-brand-link {
  color: #7c6bf0;
  text-decoration: none;
  font-weight: 600;
}
.footer-brand-link:hover {
  color: #5a4bd1;
  text-decoration: underline;
}
.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.2s;
}
.footer-link:hover {
  color: #7c6bf0;
}
.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #7c6bf0;
  background: rgba(124, 107, 240, 0.1);
  border-radius: 20px;
}

/* ============================================================
   Settings Panel
   ============================================================ */
.settings-fab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(135deg, #6C5CE7, #7c3aed);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -4px 2px 16px rgba(108, 92, 231, 0.35);
  transition: all 0.3s ease;
}
.settings-fab:hover {
  width: 50px;
  box-shadow: -6px 4px 24px rgba(108, 92, 231, 0.5);
}
.settings-fab-icon {
  animation: spin-slow 4s linear infinite;
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1070;
  display: none;
}
.settings-overlay.show {
  display: block;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: -340px;
  bottom: 0;
  width: 320px;
  background: var(--card-bg, #fff);
  z-index: 1080;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 1px solid var(--surface-border, #e8e8ef);
}
.settings-panel.open {
  right: 0;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--surface-border, #e8e8ef);
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.06), rgba(124, 58, 237, 0.03));
}
.btn-close-settings {
  background: none;
  border: none;
  color: var(--text-muted, #a0a0b0);
  font-size: 1rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-close-settings:hover {
  background: var(--surface-hover, #f4f5fa);
  color: var(--text-primary, #333);
}
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.settings-section {
  margin-bottom: 24px;
}
.settings-section:last-child {
  margin-bottom: 0;
}
.settings-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #6e6b7b);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}
.settings-section-title i {
  color: #6C5CE7;
  font-size: 0.75rem;
}
.settings-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings-option {
  cursor: pointer;
  border: 2px solid var(--surface-border, #e8e8ef);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  transition: all 0.25s ease;
  background: var(--card-bg, #fff);
}
.settings-option:hover {
  border-color: rgba(108, 92, 231, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.1);
}
.settings-option.active {
  border-color: #6C5CE7;
  background: rgba(108, 92, 231, 0.04);
  box-shadow: 0 2px 12px rgba(108, 92, 231, 0.15);
}
.settings-option.active .option-label {
  color: #6C5CE7;
  font-weight: 600;
}
.option-preview {
  width: 100%;
  margin-bottom: 8px;
  color: var(--text-primary, #333);
}
.option-preview svg {
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.option-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary, #6e6b7b);
  transition: color 0.2s;
}
.settings-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--surface-border, #e8e8ef);
}
.btn-reset {
  background: var(--surface-alt, #f8f8fb);
  color: var(--text-secondary, #6e6b7b);
  border: 1px solid var(--surface-border, #e8e8ef);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 16px;
  transition: all 0.2s;
}
.btn-reset:hover {
  background: var(--surface-hover, #f4f5fa);
  color: #6C5CE7;
  border-color: rgba(108, 92, 231, 0.3);
}

/* ============================================================
   Horizontal Nav
   ============================================================ */
.horizontal-nav {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  height: 46px;
  background: linear-gradient(165deg, #1e1b4b 0%, #0f172a 50%, #0c0a1d 100%);
  z-index: 1025;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(167, 139, 250, 0.1);
  display: none;
}
.layout-horizontal .horizontal-nav {
  display: block;
}
.horizontal-nav-inner {
  height: 100%;
  padding: 0 20px;
}
.hnav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 2px;
}
.hnav-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}
.hnav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}
.hnav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.hnav-icon {
  font-size: 0.8rem;
}
.hnav-arrow {
  font-size: 0.55rem;
  margin-left: 2px;
  opacity: 0.5;
}
.hnav-item:hover > .hnav-link {
  color: #fff;
  background: rgba(167, 139, 250, 0.15);
}
.hnav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding-top: 4px;
  z-index: 100;
  display: none;
}
.hnav-item:hover > .hnav-dropdown {
  display: block;
}
.hnav-dropdown-inner {
  background: var(--dropdown-bg, #fff);
  border: 1px solid var(--dropdown-border, #e8e8ef);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
}
.hnav-dropdown-item {
  position: relative;
}
.hnav-dropdown-item.has-children > .hnav-dropdown-link {
  padding-right: 28px;
}
.hnav-dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-primary, #333);
  text-decoration: none;
  font-size: 0.84rem;
  border-radius: 6px;
  transition: all 0.15s;
  position: relative;
}
.hnav-dropdown-link:hover {
  background: var(--surface-hover, #f4f5fa);
  color: #6C5CE7;
}
.hnav-dropdown-link.active {
  background: rgba(108, 92, 231, 0.08);
  color: #6C5CE7;
  font-weight: 500;
}
.hnav-dropdown-icon {
  width: 20px;
  font-size: 0.8rem;
  color: var(--text-muted, #a0a0b0);
  text-align: center;
}
.hnav-sub-arrow {
  position: absolute;
  right: 10px;
  font-size: 0.55rem;
  color: var(--text-muted, #a0a0b0);
}
.hnav-sub-dropdown {
  position: absolute;
  left: 100%;
  top: -6px;
  min-width: 200px;
  z-index: 110;
  background: var(--dropdown-bg, #fff);
  border: 1px solid var(--dropdown-border, #e8e8ef);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
  margin-left: 4px;
  display: none;
}
.hnav-dropdown-item.has-children:hover > .hnav-sub-dropdown {
  display: block;
}

/* ============================================================
   Card Styles
   ============================================================ */
.card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background-color: var(--card-bg);
  border-color: var(--card-border);
}
.card .card-header {
  padding: 1.25rem 1.5rem;
}
.card .card-body {
  padding: 1.5rem;
}
.btn {
  transition: all 0.3s ease;
  font-weight: 500;
}

/* Gradient backgrounds */
.bg-gradient-primary {
  background: linear-gradient(135deg, #6C5CE7 0%, #A29BFE 100%) !important;
}
.bg-gradient-secondary {
  background: linear-gradient(135deg, #00CEC9 0%, #55EFC4 100%) !important;
}
.bg-gradient-success {
  background: linear-gradient(135deg, #00B894 0%, #55EFC4 100%) !important;
}
.bg-gradient-danger {
  background: linear-gradient(135deg, #FF6B6B 0%, #FAB1A0 100%) !important;
}
.bg-gradient-warning {
  background: linear-gradient(135deg, #FDCB6E 0%, #FAB1A0 100%) !important;
}
.bg-gradient-info {
  background: linear-gradient(135deg, #74B9FF 0%, #A29BFE 100%) !important;
}

/* Soft background colors */
.bg-soft-primary { background-color: #E8E5FC !important; }
.bg-soft-success { background-color: #D4EFDF !important; }
.bg-soft-danger { background-color: #FADBD8 !important; }
.bg-soft-warning { background-color: #FFF3CD !important; }
.bg-soft-info { background-color: #D6EAF8 !important; }
.bg-soft-secondary { background-color: #D4FCF0 !important; }

/* Nav pills small */
.nav-pills-sm .nav-link {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 20px;
}
.nav-pills-sm .nav-link.active {
  background-color: #6C5CE7;
}

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb {
  font-size: 0.875rem;
}
.breadcrumb .breadcrumb-item a {
  color: #7c6bf0;
}
.breadcrumb .breadcrumb-item a:hover {
  color: #5a4bd1;
}

/* ============================================================
   Scrollbar Styling
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Selection color */
::selection {
  background: rgba(108, 92, 231, 0.2);
  color: #2d3436;
}

/* ============================================================
   Utility Classes
   ============================================================ */
.cursor-pointer {
  cursor: pointer;
}
.text-gradient-primary {
  background: linear-gradient(135deg, #6C5CE7, #00CEC9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   Auth Pages
   ============================================================ */
.auth-page {
  min-height: 100vh;
}
.form-floating>.form-control:focus~label {
    position: absolute;
    top: -5px;
}
.form-floating>.form-control-plaintext~label::after, .form-floating>.form-control:focus~label::after, .form-floating>.form-control:not(:placeholder-shown)~label::after, .form-floating>.form-select~label::after {
    background-color: transparent;
}
.auth-page .form-floating .form-control,
.auth-page .form-floating .form-select {
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 1rem 0.75rem;
  font-size: 0.95rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.auth-page .form-floating .form-control:focus,
.auth-page .form-floating .form-select:focus {
  border-color: #6C5CE7;
  box-shadow: 0 0 0 0.2rem rgba(108, 92, 231, 0.12);
}
.auth-page .form-floating label {
  color: #94a3b8;
  font-size: 0.9rem;
}
.auth-page .form-check-input:checked {
  background-color: #6C5CE7;
  border-color: #6C5CE7;
}
.auth-wrapper {
  display: flex;
  min-height: 100vh;
}
.auth-illustration {
  position: relative;
  overflow: hidden;
}
.blank-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #f4f5fa 0%, #e8e9f3 100%);
}

/* Misc pages */
.coming-soon-page,
.maintenance-page,
.not-found-page,
.not-authorized-page {
  min-height: 100vh;
}

/* ============================================================
   Dark Mode - Global Overrides
   ============================================================ */
[data-theme="dark"] .card {
  background-color: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-primary);
}
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
  background-color: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-primary);
}
[data-theme="dark"] .card-title,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: var(--text-heading) !important;
}
[data-theme="dark"] .text-dark { color: var(--text-primary) !important; }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .text-body { color: var(--text-primary) !important; }

[data-theme="dark"] .table {
  --bs-table-bg: var(--table-bg);
  --bs-table-border-color: var(--table-border);
  --bs-table-hover-bg: var(--table-hover);
  --bs-table-striped-bg: var(--table-stripe);
  color: var(--text-primary);
}
[data-theme="dark"] .table th {
  color: var(--text-secondary);
  border-color: var(--table-border) !important;
}
[data-theme="dark"] .table td {
  border-color: var(--table-border) !important;
  color: var(--text-primary);
}
[data-theme="dark"] thead th {
  background-color: var(--surface-alt) !important;
  color: var(--text-secondary) !important;
  border-color: var(--table-border) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .form-control::placeholder {
  color: var(--text-muted) !important;
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  border-color: #6C5CE7 !important;
  box-shadow: 0 0 0 0.2rem rgba(108, 92, 231, 0.2) !important;
}
[data-theme="dark"] .form-label,
[data-theme="dark"] label {
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .input-group-text {
  background-color: var(--surface-alt) !important;
  border-color: var(--input-border) !important;
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .dropdown-menu {
  background-color: var(--dropdown-bg) !important;
  border-color: var(--dropdown-border) !important;
  box-shadow: 0 8px 30px var(--shadow-lg) !important;
}
[data-theme="dark"] .dropdown-item {
  color: var(--text-primary) !important;
}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--surface-hover) !important;
}
[data-theme="dark"] .dropdown-divider {
  border-color: var(--surface-border) !important;
}

[data-theme="dark"] .modal-content {
  background-color: var(--modal-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-primary);
}
[data-theme="dark"] .modal-header {
  border-color: var(--surface-border) !important;
}
[data-theme="dark"] .modal-footer {
  border-color: var(--surface-border) !important;
}
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .nav-tabs {
  border-color: var(--surface-border) !important;
}
[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .nav-tabs .nav-link.active {
  background-color: var(--card-bg) !important;
  border-color: var(--surface-border) var(--surface-border) var(--card-bg) !important;
  color: #6C5CE7 !important;
}

[data-theme="dark"] .list-group-item {
  background-color: var(--list-group-bg) !important;
  border-color: var(--surface-border) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .breadcrumb-item {
  color: var(--text-muted);
}
[data-theme="dark"] .breadcrumb-item.active {
  color: var(--text-secondary);
}

[data-theme="dark"] .bg-light {
  background-color: var(--surface-alt) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .bg-white {
  background-color: var(--card-bg) !important;
}

[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end {
  border-color: var(--surface-border) !important;
}

[data-theme="dark"] .accordion-item {
  background-color: var(--card-bg);
  border-color: var(--surface-border);
}
[data-theme="dark"] .accordion-button {
  background-color: var(--card-bg);
  color: var(--text-primary);
}
[data-theme="dark"] .accordion-button:not(.collapsed) {
  background-color: var(--surface-alt);
  color: #6C5CE7;
}

[data-theme="dark"] .page-item .page-link {
  background-color: var(--card-bg);
  border-color: var(--surface-border);
  color: var(--text-primary);
}
[data-theme="dark"] .page-item.active .page-link {
  background-color: #6C5CE7;
  border-color: #6C5CE7;
  color: #fff;
}

[data-theme="dark"] .progress {
  background-color: var(--surface-alt);
}

[data-theme="dark"] hr {
  border-color: var(--surface-border);
  opacity: 1;
}

[data-theme="dark"] .btn-light {
  background-color: var(--surface-alt) !important;
  border-color: var(--surface-border) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .btn-light:hover {
  background-color: var(--surface-hover) !important;
}
[data-theme="dark"] .btn-outline-secondary {
  border-color: var(--surface-border) !important;
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: var(--surface-alt) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] .form-check-input {
  background-color: var(--input-bg);
  border-color: var(--input-border);
}

[data-theme="dark"] .bg-primary-subtle { background-color: rgba(108, 92, 231, 0.15) !important; }
[data-theme="dark"] .bg-success-subtle { background-color: rgba(0, 184, 148, 0.15) !important; }
[data-theme="dark"] .bg-danger-subtle { background-color: rgba(255, 107, 107, 0.15) !important; }
[data-theme="dark"] .bg-warning-subtle { background-color: rgba(253, 203, 110, 0.15) !important; }
[data-theme="dark"] .bg-info-subtle { background-color: rgba(116, 185, 255, 0.15) !important; }

[data-theme="dark"] .offcanvas {
  background-color: var(--card-bg) !important;
  color: var(--text-primary);
}
[data-theme="dark"] .toast {
  background-color: var(--card-bg);
  border-color: var(--surface-border);
  color: var(--text-primary);
}
[data-theme="dark"] .toast-header {
  background-color: var(--surface-alt);
  border-color: var(--surface-border);
  color: var(--text-primary);
}

[data-theme="dark"] ::selection {
  background: rgba(108, 92, 231, 0.35);
  color: #fff;
}

/* ApexCharts dark mode */
[data-theme="dark"] .apexcharts-text,
[data-theme="dark"] .apexcharts-title-text {
  fill: var(--text-secondary) !important;
}
[data-theme="dark"] .apexcharts-xaxis-label,
[data-theme="dark"] .apexcharts-yaxis-label {
  fill: var(--text-muted) !important;
}
[data-theme="dark"] .apexcharts-gridline {
  stroke: var(--surface-border) !important;
}
[data-theme="dark"] .apexcharts-legend-text {
  color: var(--text-secondary) !important;
}
[data-theme="dark"] .apexcharts-tooltip {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] .apexcharts-tooltip .apexcharts-tooltip-title {
  background: var(--surface-alt) !important;
  border-color: var(--surface-border) !important;
}

/* ============================================================
   RTL Layout
   ============================================================ */
[dir="rtl"] body {
  text-align: right;
  direction: rtl;
}
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}
[dir="rtl"] .admin-main-wrapper {
  margin-left: 0 !important;
  margin-right: 260px;
}
[dir="rtl"] .admin-header {
  padding-left: 0;
  padding-right: 260px;
}
@media (max-width: 1199.98px) {
  [dir="rtl"] .admin-main-wrapper {
    margin-right: 0 !important;
  }
  [dir="rtl"] .admin-header {
    padding-right: 0 !important;
  }
  [dir="rtl"] .sidebar {
    transform: translateX(100%) !important;
  }
  [dir="rtl"] .sidebar.sidebar-mobile-open {
    transform: translateX(0) !important;
  }
}

/* Timeline activity */
.timeline-activity > div:not(:last-child) {
  border-left: 2px solid var(--surface-border);
  margin-left: 19px;
  padding-left: 30px;
  position: relative;
}
