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

:root {
  /* Color System */
  --bg-sidebar: #0b1120; /* Deeper Navy */
  --bg-main: #f1f5f9; /* Soft Slate Off-White */
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-inverse: #f8fafc;
  
  --primary-accent: #3b82f6; /* Blue */
  --primary-hover: #2563eb;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  
  --success: #10b981; /* Green */
  --success-hover: #059669;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  --danger: #ef4444; /* Red */
  --danger-hover: #dc2626;
  
  --warning: #f59e0b; /* Yellow */
  
  --border-color: #e2e8f0;

  /* Typography */
  --font-main: 'Outfit', sans-serif;
  
  /* Shadows & Radius */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-speed: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar Layout */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-speed);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.sidebar-header p {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-speed);
  font-weight: 500;
}

.nav-item i {
  font-size: 20px;
  transition: transform var(--transition-speed);
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item:hover i {
  transform: translateX(4px);
}

.nav-item.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

.sidebar-footer a {
  color: var(--primary-accent);
  text-decoration: none;
  font-weight: 600;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition-speed);
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-speed);
}

.topbar {
  height: 72px;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-main);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-speed);
  text-decoration: none;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.btn-success {
  background: var(--success-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--primary-accent);
  color: var(--primary-accent);
  background-color: rgba(59, 130, 246, 0.05);
}

/* Content Container */
.content-wrapper {
  padding: 32px;
  flex: 1;
}

/* Card Component */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  padding: 24px;
  transition: box-shadow var(--transition-speed), transform var(--transition-speed);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-speed);
  background-color: #f8fafc;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-accent);
  background-color: white;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8fafc;
}

.table td {
  font-size: 14px;
}

.table tbody tr {
  transition: background-color var(--transition-speed);
}

.table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.02);
}

/* Badges */
.badge {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.badge-success { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-left: 4px solid var(--primary-accent);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .kpi-grid, .report-grid, .inventory-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  /* Sidebar handling */
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
    opacity: 1;
  }
  .main-content {
    margin-left: 0;
  }
  
  .topbar {
    padding: 0 16px;
  }
  
  .mobile-toggle {
    display: block;
  }

  .content-wrapper {
    padding: 16px;
  }
  
  /* Grids */
  .kpi-grid, .report-grid, .inventory-stats {
    grid-template-columns: 1fr !important;
  }
  
  /* Splits */
  .charts-grid, .split-layout, .billing-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }

  /* Toolbar */
  .toolbar {
    flex-direction: column;
    gap: 16px;
    align-items: stretch !important;
  }
  .search-box {
    width: 100% !important;
  }
  .filters {
    flex-direction: column;
    width: 100%;
  }
  .filters select, .filters button {
    width: 100% !important;
  }
  
  /* Form Grids */
  .form-grid {
    grid-template-columns: 1fr !important;
  }
}
