/* Custom Variables */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --sidebar-width: 250px;
  --header-height: 60px;
  --sidebar-bg: #f8fafc;
  --content-bg: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --transition-speed: 0.3s;
}

/* Global Styles */
body {
  font-family: "Inter", sans-serif;
  background-color: #f1f5f9;
  color: #0f172a;
}

html, body {
  overflow-x: hidden;
}

/* Header Styles */
.navbar {
  height: var(--header-height);
  background-color: var(--content-bg) !important;
  box-shadow: var(--shadow-sm);
  padding: 0.5rem 1.5rem;
}

.navbar-brand {
  font-weight: 600;
  color: var(--primary-color) !important;
  font-size: 1.25rem;
}

.navbar .nav-link {
  color: #475569 !important;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: color var(--transition-speed);
}

.navbar .nav-link:hover {
  color: var(--primary-color) !important;
}

/* Sidebar Styles */
.sidebar {
  background-color: var(--sidebar-bg);
  padding: 1rem;
  border-radius: 0.5rem;
}

/* Ensure the sidebar scrolls if content overflows */
@media (min-width: 992px) {
  .sidebar {
    width: var(--sidebar-width);
    height: 100vh; /* Fix height to viewport height */
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto; /* Enable vertical scrolling */
  }
}

.sidebar .nav-link {
  border-radius: 0.5rem;
  margin: 0.25rem 0;
  padding: 0.75rem 1rem;
  color: #475569 !important;
  font-weight: 500;
  transition: all var(--transition-speed);
}

.sidebar .nav-link:hover {
  background-color: #e2e8f0;
  color: var(--primary-color) !important;
}

.sidebar .nav-link.active {
  background-color: var(--primary-color);
  color: #ffffff !important;
}

.sidebar .nav-link i {
  width: 1.5rem;
  text-align: center;
  margin-right: 0.75rem;
  font-size: 1.1rem;
}

/* Main Content Styles */
.flex-grow-1 {
  background-color: var(--content-bg);
  min-height: calc(100vh - var(--header-height));
  padding: 2rem;
}

@media (min-width: 992px) {
  .flex-grow-1 {
    margin-left: var(--sidebar-width);
  }
}

/* Card Styles */
.card {
  border: none;
  border-radius: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
  background: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 1rem 1.5rem;
}

.card-title {
  color: #2d3748;
  font-weight: 600;
  margin: 0;
}

/* Footer Styles */
footer {
  background-color: var(--content-bg) !important;
  border-top: 1px solid #e2e8f0;
  padding: 1rem 0;
  color: #475569 !important;
}

.footer {
  font-size: 0.9375rem;
}

.footer h6 {
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.footer .hover-primary {
  transition: color 0.2s ease-in-out;
}

.footer .hover-primary:hover {
  color: var(--primary-color) !important;
}

.footer .social-links .btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
}

.footer .social-links .btn:hover {
  background-color: var(--primary-color);
  color: #ffffff;
}

.footer .newsletter-form .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.footer .newsletter-form .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.footer-bottom {
  font-size: 0.875rem;
}

/* Offcanvas adjustments for Mobile Sidebar */
.offcanvas-body {
  overflow-y: auto;
  max-height: 100vh;
}

.offcanvas-header {
  border-bottom: 1px solid #e2e8f0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Utility Classes */
.text-primary {
  color: var(--primary-color) !important;
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  padding: 0.5rem 1.25rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all var(--transition-speed);
}

.btn-primary:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  transform: translateY(-1px);
}

/* Gradient Backgrounds */
.bg-gradient-primary {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.bg-gradient-info {
  background: linear-gradient(135deg, #4fd1c5 0%, #38b2ac 100%);
}

.bg-gradient-success {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.bg-gradient-warning {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

/* Timeline Styling */
.timeline {
  position: relative;
  max-height: 300px;
  overflow-y: auto;
}

.timeline-item {
  position: relative;
  padding: 1rem 0;
  border-left: 2px solid #e2e8f0;
  margin-left: 1rem;
}

.timeline-item:before {
  content: '';
  position: absolute;
  left: -0.5rem;
  top: 1.25rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #4299e1;
  border: 2px solid #fff;
}

.timeline-content {
  margin-left: 1rem;
}

/* Table Styling */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  color: #4a5568;
  border-top: none;
}

.table td {
  vertical-align: middle;
}

/* Chart Styling */
canvas {
  max-width: 100%;
  height: auto !important;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .col-md-3 {
    margin-bottom: 1rem;
  }
  
  .card {
    margin-bottom: 1rem;
  }
  
  .timeline {
    max-height: 250px;
  }
}
