/* Global Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8f9fa;
  margin: 0;
  padding: 0;
}

.btn:active {
  border: none !important;
}

/* Sidebar Styles */
.sidebar {
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  background-color: #ffffff;
  border-right: 1px solid #e9ecef;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  transition: width 0.3s ease;
}

.sidebar.collapsed {
  width: 80px;
}

.sidebar.collapsed .sidebar-header h5,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-footer .avatar-text {
  opacity: 0;
  visibility: hidden;
  width: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-link i {
  margin: 0 !important;
  font-size: 20px !important;
}

.sidebar.collapsed .nav-link span {
  display: none;
}

.sidebar.collapsed .sidebar-footer .avatar {
  margin: 0 auto;
}

.sidebar-header {
  border-bottom: 1px solid #e9ecef;
}

.sidebar-header h5 {
  color: #2c3e50;
  font-weight: 600;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: none;
  color: #21c45d;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-section {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.nav-link {
  color: #6c757d;
  padding: 10px 0;
  border-radius: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
  font-size: 16px;
}

.nav-link:hover {
  background-color: #f8f9fa;
  color: #495057;
}

.nav-link.active {
  background-color: #e8f5e8;
  color: #28a745;
  font-weight: 500;
}

.nav-link i {
  width: 16px;
  font-size: 16px;
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid #e9ecef;
  background-color: #ffffff;
}

/* Main Content */
.main-content {
  margin-left: 250px;
  min-height: 100vh;
  width: calc(100% - 250px);
  background-color: #f8f9fa;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.main-content.sidebar-collapsed {
  margin-left: 70px;
  width: calc(100% - 70px);
}

.header {
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header h2 {
  color: #2c3e50;
  font-weight: 600;
  font-size: 24px;
}

.search-section {
  background-color: #f8f9fa;
}

.search-section .input-group {
  max-width: 400px;
}

.search-section .form-control {
  background-color: #ffffff;
  border: 1px solid #dee2e6;
}

.search-section .form-control:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Metric Cards */
.metric-card {
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.metric-card .card-body {
  padding: 1.5rem;
}

.metric-card h3 {
  font-weight: 700;
  color: #2c3e50;
}

.metric-card .text-success {
  font-weight: 600;
  font-size: 0.875rem;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.metric-icon .text-primary {
  background-color: rgba(0, 123, 255, 0.1);
}

.metric-icon .text-success {
  background-color: rgba(40, 167, 69, 0.1);
}

.metric-icon .text-warning {
  background-color: rgba(255, 193, 7, 0.1);
}

/* Charts Section */
.charts-section .card {
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.charts-section .card-header {
  border-bottom: 1px solid #e9ecef;
  padding: 1rem 1.5rem;
}

.charts-section .card-header h6 {
  color: #2c3e50;
  font-weight: 600;
}

/* Buttons */
.btn-success {
  background-color: #28a745;
  border-color: #28a745;
  font-weight: 500;
}

.btn-success:hover {
  background-color: #218838;
  border-color: #1e7e34;
}

.btn-outline-secondary {
  color: #6c757d;
  border-color: #6c757d;
  font-weight: 500;
}

.btn-outline-secondary:hover {
  background-color: #6c757d;
  border-color: #6c757d;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  background-color: #218838;
  transform: scale(1.05);
}

.mobile-menu-toggle i {
  font-size: 20px;
}

/* Hide hamburger button when sidebar is open */
.mobile-menu-toggle.hide {
  display: none !important;
}

/* Mobile close button (X) in sidebar */
.mobile-close-btn {
  display: none;
  color: #dc3545;
  font-size: 22px;
  padding: 5px 10px;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
}

.mobile-close-btn:hover {
  background-color: rgba(220, 53, 69, 0.1);
  color: #c82333;
  transform: scale(1.1);
}

.mobile-close-btn i {
  font-weight: bold;
}

/* Desktop toggle button (chevron) */
.desktop-toggle-btn {
  display: block;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 250px !important;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  /* Hide desktop toggle button on mobile */
  .sidebar .desktop-toggle-btn {
    display: none !important;
  }

  /* Show mobile close button when sidebar is open */
  .sidebar.show .mobile-close-btn {
    display: block;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .main-content.sidebar-collapsed {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .header {
    padding: 1rem !important;
  }

  .header .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }

  .metrics-section .col-md-3 {
    margin-bottom: 1rem;
  }

  .charts-section .col-md-6 {
    margin-bottom: 1rem;
  }
}

/* Desktop styles */
@media (min-width: 769px) {
  .mobile-close-btn {
    display: none !important;
  }

  .desktop-toggle-btn {
    display: block !important;
  }
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animation for cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metric-card {
  animation: fadeInUp 0.6s ease forwards;
}

.metric-card:nth-child(1) {
  animation-delay: 0.1s;
}

.metric-card:nth-child(2) {
  animation-delay: 0.2s;
}

.metric-card:nth-child(3) {
  animation-delay: 0.3s;
}

.metric-card:nth-child(4) {
  animation-delay: 0.4s;
}