/* Font Optimization for EGS-ADMIN */

/* Use Apple's professional system font stack - no external fonts needed for better performance */

/* Override Tabler font variables with optimized settings */
:root {
  /* Professional Apple-style font family */
  --tblr-font-sans-serif: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
  
  /* Optimized font weights - reduce bold weight for better readability */
  --tblr-font-weight-light: 300;
  --tblr-font-weight-normal: 400;
  --tblr-font-weight-medium: 500;
  --tblr-font-weight-semibold: 600;
  --tblr-font-weight-bold: 600; /* Keep at 600 instead of 700 for better readability */
  --tblr-font-weight-black: 700;
  
  /* Improved body font settings */
  --tblr-body-font-family: var(--tblr-font-sans-serif);
  --tblr-body-font-size: 0.875rem; /* 14px */
  --tblr-body-font-weight: 400;
  --tblr-body-line-height: 1.5; /* Improved line height for better readability */
}

/* Global font smoothing for better rendering */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Body font optimization */
body {
  font-family: var(--tblr-font-sans-serif);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em; /* Slight negative letter spacing for system fonts */
}

/* Heading optimizations */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 600 !important; /* Use semibold instead of bold */
  letter-spacing: -0.01em; /* Better letter spacing for headings */
  line-height: 1.3;
}

/* Reduce font weight for better readability */
strong, b, .fw-bold {
  font-weight: 600 !important; /* Use 600 instead of 700 */
}

.fw-semibold {
  font-weight: 500 !important;
}

/* Button font optimization */
.btn {
  font-weight: 500 !important; /* Medium weight for buttons */
  letter-spacing: 0.005em;
}

/* Form label optimization */
.form-label, label {
  font-weight: 500 !important;
  font-size: 0.875rem;
}

/* Table header optimization */
.table th {
  font-weight: 600 !important;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Navigation font optimization */
.nav-link {
  font-weight: 500;
  letter-spacing: 0.005em;
}

.nav-link.active {
  font-weight: 600 !important;
}

/* Sidebar font optimization */
.sidebar .nav-link {
  font-weight: 400;
  font-size: 0.875rem;
}

.sidebar .nav-link.active {
  font-weight: 600 !important;
}

/* Card title optimization */
.card-title {
  font-weight: 600 !important;
  letter-spacing: -0.005em;
  font-size: 1rem !important; /* Reduced from 1.125rem */
}

/* Badge font optimization */
.badge {
  font-weight: 500 !important;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

/* Alert font optimization */
.alert {
  font-weight: 400;
  line-height: 1.5;
}

.alert-heading {
  font-weight: 600 !important;
}

/* Breadcrumb optimization */
.breadcrumb-item {
  font-weight: 400;
}

.breadcrumb-item.active {
  font-weight: 500 !important;
}

/* Dropdown font optimization */
.dropdown-item {
  font-weight: 400;
  font-size: 0.875rem;
}

/* List group optimization */
.list-group-item {
  font-weight: 400;
}

.list-group-item.active {
  font-weight: 500 !important;
}

/* Modal font optimization */
.modal-title {
  font-weight: 600 !important;
  letter-spacing: -0.005em;
}

/* Tooltip and popover optimization */
.tooltip, .popover {
  font-size: 0.8125rem;
  font-weight: 400;
}

/* Input placeholder optimization */
.form-control::placeholder,
.form-select::placeholder {
  font-weight: 400;
  opacity: 0.6;
}

/* Tab navigation optimization */
.nav-tabs .nav-link {
  font-weight: 500;
}

.nav-tabs .nav-link.active {
  font-weight: 600 !important;
}

/* Pagination optimization */
.page-link {
  font-weight: 500;
}

/* Progress bar text optimization */
.progress-bar {
  font-weight: 500;
  font-size: 0.75rem;
}

/* Toast optimization */
.toast-header {
  font-weight: 600 !important;
}

.toast-body {
  font-weight: 400;
}

/* Accordion optimization */
.accordion-button {
  font-weight: 500 !important;
}

/* Offcanvas optimization */
.offcanvas-title {
  font-weight: 600 !important;
}

/* Small text optimization */
.small, small {
  font-size: 0.8125rem;
  font-weight: 400;
}

/* Text utilities optimization */
.text-muted {
  font-weight: 400 !important;
  font-size: 0.8125rem !important; /* Slightly smaller for muted text */
}

/* Tabler specific font classes optimization */
.font-weight-medium {
  font-weight: 500 !important;
}

.font-weight-bold {
  font-weight: 600 !important;
}

.font-weight-light {
  font-weight: 300 !important;
}

.font-weight-normal {
  font-weight: 400 !important;
}

/* Font size utilities optimization - FIXED SIZES */
.fs-1 { font-size: 2rem !important; font-weight: 600; } /* Reduced from 2.5rem */
.fs-2 { font-size: 1.75rem !important; font-weight: 600; } /* Reduced from 2rem */
.fs-3 { font-size: 1.5rem !important; font-weight: 600; } /* Reduced from 1.75rem */
.fs-4 { font-size: 1.25rem !important; font-weight: 500; } /* Reduced from 1.5rem */
.fs-5 { font-size: 1.125rem !important; font-weight: 500; } /* Reduced from 1.25rem */
.fs-6 { font-size: 1rem !important; font-weight: 400; }

/* Card footer links optimization */
.card-footer a {
  font-weight: 500 !important;
  font-size: 0.875rem;
}

/* Avatar text optimization */
.avatar {
  font-weight: 500;
}

/* Button list optimization */
.btn-list .btn {
  font-weight: 500 !important;
}

/* Statistics display optimization - FIX FOR COUNTER NUMBERS */
.card-sm .font-weight-medium {
  font-weight: 600 !important;
  font-size: 1.5rem !important; /* Reduced from 1.75rem */
}

/* Dashboard specific optimizations - FIX FOR DESCRIPTIONS */
.card-body .text-muted {
  font-size: 0.8125rem !important; /* Reduced from 0.875rem */
  font-weight: 400;
}

/* Page title and description fixes */
.page-title {
  font-size: 1.5rem !important; /* Reduced from larger sizes */
  font-weight: 600 !important;
}

.page-subtitle, .page-description {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  color: var(--tblr-text-muted) !important;
}

/* Dashboard counter numbers specific fix */
.card .fs-3 {
  font-size: 1.5rem !important; /* Override any larger sizes */
  font-weight: 600 !important;
}

/* Dashboard card descriptions */
.card .text-muted {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* Universal Dashboard template fixes */
.dashboard-header h1,
.dashboard-header .h1 {
  font-size: 1.75rem !important;
  font-weight: 600 !important;
}

.dashboard-header .text-muted,
.dashboard-subtitle {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* Responsive font size adjustments */
@media (max-width: 768px) {
  body {
    font-size: 0.875rem;
  }
  
  h1, .h1 { font-size: 1.25rem !important; }
  h2, .h2 { font-size: 1.125rem !important; }
  h3, .h3 { font-size: 1rem !important; }
  h4, .h4 { font-size: 0.875rem !important; }
  h5, .h5 { font-size: 0.8125rem !important; }
  h6, .h6 { font-size: 0.75rem !important; }
  
  /* Mobile counter fixes */
  .card-sm .font-weight-medium {
    font-size: 1.25rem !important;
  }
  
  .fs-3 {
    font-size: 1.25rem !important;
  }
}

/* Dark mode font adjustments */
[data-bs-theme="dark"] {
  /* Slightly increase font weight in dark mode for better visibility */
  --tblr-body-font-weight: 400;
}

[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .h1,
[data-bs-theme="dark"] .h2,
[data-bs-theme="dark"] .h3,
[data-bs-theme="dark"] .h4,
[data-bs-theme="dark"] .h5,
[data-bs-theme="dark"] .h6 {
  font-weight: 600 !important;
}

/* Performance optimization: System fonts load instantly */
.font-preload {
  font-display: swap;
}

/* Apple-style font optimization */
@supports (font-variation-settings: normal) {
  :root {
    --tblr-font-sans-serif: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
  }
}