/* ==========================================
   RESET & GLOBAL (BASE ONLY - NO THEME)
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --radius: 12px;
  --transition: all 0.3s ease;
  --sidebar-width: 260px;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
}

/* ==========================================
   SCROLLBAR (GLOBAL)
   ========================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ==========================================
   APP WRAPPER
   ========================================== */
#appWrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  transition:
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.4s ease;
  z-index: 1000;
}

.sidebar.open {
  transform: translateX(0);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

.brand:hover {
  transform: scale(1.05);
}

.brand .brand-icon {
  font-size: 28px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.brand-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--secondary);
}

.brand-text span {
  color: var(--text-primary);
}

.close-sidebar {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

/* Sidebar Menu */
.sidebar-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar-menu .menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 2px;
  text-align: left;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.sidebar-menu .menu-btn::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(124, 58, 237, 0.05),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.sidebar-menu .menu-btn:hover::after {
  transform: translateX(100%);
}

.sidebar-menu .menu-btn:hover {
  transform: translateX(4px);
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-menu .menu-btn.active {
  background: rgba(124, 58, 237, 0.15);
  color: var(--primary-light);
  border-left: 3px solid var(--primary);
}

.sidebar-menu .menu-btn .active-indicator {
  font-size: 10px;
  margin-left: auto;
}

.loading-menu {
  color: var(--text-muted);
  padding: 20px;
  text-align: center;
  font-size: 14px;
}

/* ==========================================
   SUBMENU
   ========================================== */
.menu-group {
  margin-bottom: 2px;
}

.menu-btn.has-submenu {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  cursor: pointer !important;
}

.menu-btn.has-submenu .menu-label {
  flex: 1;
  text-align: left;
}

.submenu-arrow {
  display: inline-block !important;
  font-size: 10px !important;
  color: var(--text-muted) !important;
  margin: 0 4px !important;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.submenu-arrow.open {
  transform: rotate(90deg) !important;
}

.submenu {
  max-height: 0 !important;
  overflow: hidden !important;
  padding-left: 16px !important;
  margin-left: 12px !important;
  border-left: 2px solid var(--border-color) !important;
  opacity: 0 !important;
  transition:
    max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease,
    padding 0.3s ease !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.submenu.open {
  max-height: 500px !important;
  opacity: 1 !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.submenu-btn {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 8px 16px !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  width: 100% !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-family: inherit !important;
  text-align: left !important;
  transform: translateX(-10px) !important;
  opacity: 0 !important;
}

.submenu.open .submenu-btn {
  transform: translateX(0) !important;
  opacity: 1 !important;
}

.submenu.open .submenu-btn:nth-child(1) {
  transition-delay: 0.05s !important;
}
.submenu.open .submenu-btn:nth-child(2) {
  transition-delay: 0.1s !important;
}
.submenu.open .submenu-btn:nth-child(3) {
  transition-delay: 0.15s !important;
}
.submenu.open .submenu-btn:nth-child(4) {
  transition-delay: 0.2s !important;
}
.submenu.open .submenu-btn:nth-child(5) {
  transition-delay: 0.25s !important;
}
.submenu.open .submenu-btn:nth-child(6) {
  transition-delay: 0.3s !important;
}

.submenu-btn:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
}

.submenu-btn.active {
  background: rgba(124, 58, 237, 0.1) !important;
  color: var(--primary-light) !important;
}

.submenu-btn .active-indicator {
  font-size: 10px !important;
  margin-left: auto !important;
}

/* ==========================================
   SIDEBAR FOOTER
   ========================================== */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.user-detail {
  flex: 1;
  min-width: 0;
}

.user-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.btn-logout {
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 18px;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  padding: 16px 32px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 16px;
}

.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

.topbar h1 {
  font-size: 20px;
  font-weight: 600;
  flex: 1;
  color: var(--text-primary);
}

.topbar-right .greeting {
  color: var(--text-secondary);
  font-size: 14px;
  animation: fadeInDown 0.6s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Content Area */
.content-area {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
}

.loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  margin-bottom: 16px;
}

.loading p {
  animation: pulseText 1.5s ease-in-out infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseText {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ==========================================
   PAGE CONTAINER
   ========================================== */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 700;
}

.date-info {
  color: var(--text-muted);
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
}

/* ==========================================
   STATS GRID
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border-color);
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
  position: relative;
  overflow: hidden;
}

.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.4s;
}
.stat-card:nth-child(5) {
  animation-delay: 0.5s;
}
.stat-card:nth-child(6) {
  animation-delay: 0.6s;
}

.stat-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--primary);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.2);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.stat-card .stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
  animation: countUp 1s ease forwards;
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card .stat-label {
  color: var(--text-muted);
  font-size: 14px;
}

/* ==========================================
   DASHBOARD GRID
   ========================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.dashboard-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border-color);
}

.dashboard-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  transition: all 0.3s ease;
  animation: slideInLeft 0.5s ease forwards;
  opacity: 0;
  transform: translateX(-20px);
}

.activity-item:nth-child(1) {
  animation-delay: 0.1s;
}
.activity-item:nth-child(2) {
  animation-delay: 0.2s;
}
.activity-item:nth-child(3) {
  animation-delay: 0.3s;
}
.activity-item:nth-child(4) {
  animation-delay: 0.4s;
}
.activity-item:nth-child(5) {
  animation-delay: 0.5s;
}

.activity-item:hover {
  transform: translateX(8px) scale(1.02);
  background: var(--bg-hover);
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.activity-item .activity-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.activity-item .activity-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
}

.activity-item .activity-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.text-muted {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* ==========================================
   TABLE
   ========================================== */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead {
  background: rgba(255, 255, 255, 0.03);
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.text-center {
  text-align: center;
}

/* ==========================================
   ERROR
   ========================================== */
.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--danger);
}

.error i {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    z-index: 999;
    height: 100vh;
    width: 280px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    left: 0;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  }
  .close-sidebar {
    display: block !important;
  }
  .hamburger-btn {
    display: flex !important;
  }
  .topbar {
    padding: 12px 16px;
  }
  .topbar h1 {
    font-size: 16px;
  }
  .content-area {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .stat-card .stat-number {
    font-size: 24px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar-right .greeting {
    font-size: 12px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .table th,
  .table td {
    padding: 8px 10px;
    font-size: 12px;
  }
}
