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

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Light mode colors (zinc theme) */
  --background-h: 0;
  --background-s: 0%;
  --background-l: 100%;
  --background: hsl(var(--background-h) var(--background-s) var(--background-l));
  
  --foreground: hsl(240 10% 3.9%);
  
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(240 10% 3.9%);
  
  --popover: hsl(0 0% 100%);
  --popover-foreground: hsl(240 10% 3.9%);
  
  --primary: hsl(240 5.9% 10%);
  --primary-foreground: hsl(0 0% 98%);
  
  --secondary: hsl(240 4.8% 95.9%);
  --secondary-foreground: hsl(240 5.9% 10%);
  
  --muted: hsl(240 4.8% 95.9%);
  --muted-foreground: hsl(240 3.8% 46.1%);
  
  --accent: hsl(240 4.8% 95.9%);
  --accent-foreground: hsl(240 5.9% 10%);
  
  --destructive: hsl(0 84.2% 60.2%);
  --destructive-foreground: hsl(0 0% 98%);
  
  --border: hsl(240 5.9% 90%);
  --input: hsl(240 5.9% 90%);
  --ring: hsl(240 5.9% 10%);
  
  --sidebar: hsl(0 0% 98%);
  --sidebar-border: hsl(240 5.9% 90%);
  --sidebar-foreground: hsl(240 5.3% 26.1%);
  --sidebar-active: hsl(240 4.8% 90%);
  --sidebar-active-foreground: hsl(240 5.9% 10%);
  
  /* Shadcn sharp radius */
  --radius: 0.375rem;
}

[data-bs-theme="dark"] {
  --background-h: 240;
  --background-s: 10%;
  --background-l: 3.9%;
  --background: hsl(var(--background-h) var(--background-s) var(--background-l));
  
  --foreground: hsl(0 0% 98%);
  
  --card: hsl(240 10% 3.9%);
  --card-foreground: hsl(0 0% 98%);
  
  --popover: hsl(240 10% 3.9%);
  --popover-foreground: hsl(0 0% 98%);
  
  --primary: hsl(0 0% 98%);
  --primary-foreground: hsl(240 5.9% 10%);
  
  --secondary: hsl(240 3.7% 15.9%);
  --secondary-foreground: hsl(0 0% 98%);
  
  --muted: hsl(240 3.7% 15.9%);
  --muted-foreground: hsl(240 5% 64.9%);
  
  --accent: hsl(240 3.7% 15.9%);
  --accent-foreground: hsl(0 0% 98%);
  
  --destructive: hsl(0 62.8% 30.6%);
  --destructive-foreground: hsl(0 0% 98%);
  
  --border: hsl(240 3.7% 15.9%);
  --input: hsl(240 3.7% 15.9%);
  --ring: hsl(240 4.9% 83.9%);
  
  --sidebar: hsl(240 10% 2%);
  --sidebar-border: hsl(240 3.7% 15.9%);
  --sidebar-foreground: hsl(240 5% 80%);
  --sidebar-active: hsl(240 3.7% 12%);
  --sidebar-active-foreground: hsl(0 0% 98%);
}

/* Global Reset & Base */
body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  overflow-x: hidden;
  font-size: 0.8125rem; /* ~13px for cleaner desktop dashboard look */
  line-height: 1.4;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.text-muted-custom {
  color: var(--muted-foreground);
}

/* App Layout */
#app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.app-sidebar {
  width: 240px;
  background-color: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1025;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-logo {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo svg {
  color: var(--primary);
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.65rem;
}

.menu-header {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
  opacity: 0.7;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sidebar-foreground);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  margin-bottom: 2px;
  cursor: pointer;
}

.menu-item:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.menu-item.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-active-foreground);
  font-weight: 600;
}

.menu-item svg, .menu-item i {
  font-size: 1rem;
  opacity: 0.85;
}

/* Sidebar Submenus */
.submenu-list {
  padding-left: 0.75rem;
  margin-top: 1px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-left: 1px solid var(--sidebar-border);
  margin-left: 1.25rem;
}

.submenu-item {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--sidebar-foreground);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.15s ease;
}

.submenu-item:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.submenu-item.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-active-foreground);
  font-weight: 600;
}

.menu-item.has-submenu .submenu-chevron {
  transition: transform 0.2s ease;
  font-size: 0.7rem;
}

.menu-item.has-submenu[aria-expanded="true"] .submenu-chevron {
  transform: rotate(180deg);
}

.sidebar-footer {
  padding: 0.85rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background-color: var(--sidebar);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
  min-width: 0;
}

/* Header */
.app-header {
  height: 56px;
  background-color: var(--background);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

/* Cards & Layout styling */
.card-custom {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--card-foreground);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-custom:hover {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .card-custom:hover {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.3);
}

.kpi-title {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0.15rem 0;
}

.kpi-change {
  font-size: 0.725rem;
  font-weight: 500;
}

/* Custom buttons - cleaner, sharper, smaller */
.btn-custom-outline {
  border: 1px solid var(--border);
  background-color: var(--card);
  color: var(--foreground);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-custom-outline:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.btn-custom-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-custom-primary:hover {
  opacity: 0.9;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--foreground);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius);
  transition: background-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background-color: var(--secondary);
}

/* Notification dot */
.notification-btn {
  position: relative;
}

.notification-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  background-color: var(--destructive);
  border-radius: 50%;
  border: 1.5px solid var(--background);
}

/* Custom Table style */
.table-custom {
  margin-bottom: 0;
}

.table-custom th {
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
}

.table-custom td {
  padding: 0.7rem 0.85rem;
  font-size: 0.8125rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

/* Custom Badges (Colored but clean) */
.badge-custom {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.badge-success-light {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning-light {
  background-color: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info-light {
  background-color: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-danger-light {
  background-color: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Timeline Activity Widget */
.timeline-activity {
  position: relative;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
  margin-left: 0.35rem;
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.25rem - 4.5px);
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2.5px solid var(--background);
  box-shadow: 0 0 0 1px var(--border);
}

.timeline-item.success::before {
  background-color: #10b981;
}

.timeline-item.warning::before {
  background-color: #f59e0b;
}

.timeline-item.info::before {
  background-color: #3b82f6;
}

.timeline-time {
  font-size: 0.7rem;
  color: var(--muted-foreground);
}

.timeline-text {
  font-size: 0.775rem;
  font-weight: 500;
}

/* Collapsed sidebar behavior */
body.sidebar-collapsed .app-sidebar {
  width: 60px;
}

body.sidebar-collapsed .app-sidebar .menu-header,
body.sidebar-collapsed .app-sidebar .menu-item span,
body.sidebar-collapsed .app-sidebar .submenu-chevron,
body.sidebar-collapsed .app-sidebar .submenu-list,
body.sidebar-collapsed .app-sidebar .sidebar-logo span,
body.sidebar-collapsed .app-sidebar .sidebar-footer .flex-1,
body.sidebar-collapsed .app-sidebar .sidebar-footer button {
  display: none !important;
}

body.sidebar-collapsed .app-sidebar .menu-item {
  justify-content: center;
  padding: 0.55rem;
}

body.sidebar-collapsed .app-main {
  margin-left: 60px;
}

/* Responsive breakpoint styling */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  
  .app-main {
    margin-left: 0 !important;
  }
  
  body.sidebar-open .app-sidebar {
    transform: translateX(0);
    width: 240px;
  }
  
  body.sidebar-open .sidebar-overlay {
    display: block;
  }
}
