/* Modal and Card Font Fixes - Complete Solution */

/* ===== MODAL FONT FIXES ===== */
.modal,
.modal * {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}

/* Modal titles - all variants */
.modal-title,
.modal-header h1,
.modal-header h2,
.modal-header h3,
.modal-header h4,
.modal-header h5,
.modal-header h6,
.modal-header .h1,
.modal-header .h2,
.modal-header .h3,
.modal-header .h4,
.modal-header .h5,
.modal-header .h6 {
  font-size: 1rem !important; /* 16px - much smaller */
  font-weight: 500 !important; /* Medium weight, not bold */
  line-height: 1.3 !important;
  margin-bottom: 0 !important;
}

/* Modal body text */
.modal-body,
.modal-body p,
.modal-body div,
.modal-body span {
  font-size: 0.875rem !important; /* 14px */
  font-weight: 400 !important;
  line-height: 1.5 !important;
}

/* Modal form elements */
.modal .form-label,
.modal label {
  font-size: 0.875rem !important;
  font-weight: 400 !important; /* Normal weight */
}

.modal .form-control,
.modal .form-select,
.modal input,
.modal select,
.modal textarea {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.modal .form-control::placeholder,
.modal .form-select::placeholder {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* Modal buttons */
.modal .btn {
  font-size: 0.875rem !important;
  font-weight: 400 !important; /* Normal weight, not bold */
}

.modal .btn-sm {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* Modal dropdown items */
.modal .dropdown-item {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.modal .dropdown-header {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* Modal list items */
.modal .list-group-item {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* Modal text utilities */
.modal .text-muted {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

.modal .small,
.modal small {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* Modal alerts */
.modal .alert {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.modal .alert-heading {
  font-size: 1rem !important;
  font-weight: 500 !important;
}

/* Modal empty states */
.modal .empty-title {
  font-size: 1rem !important;
  font-weight: 500 !important;
}

.modal .empty-subtitle {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* ===== CARD FONT FIXES ===== */
.card,
.card * {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
}

/* Card titles - all variants */
.card-title,
.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6,
.card-header .h1,
.card-header .h2,
.card-header .h3,
.card-header .h4,
.card-header .h5,
.card-header .h6 {
  font-size: 0.9375rem !important; /* 15px */
  font-weight: 500 !important; /* Medium weight */
  line-height: 1.3 !important;
  margin-bottom: 0.25rem !important;
}

/* Card body text */
.card-body,
.card-body p,
.card-body div,
.card-body span {
  font-size: 0.875rem !important; /* 14px */
  font-weight: 400 !important;
  line-height: 1.5 !important;
}

/* Card text utilities */
.card .text-muted {
  font-size: 0.8125rem !important; /* 13px */
  font-weight: 400 !important;
}

.card .small,
.card small {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* Card buttons */
.card .btn {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.card .btn-sm {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* Card badges */
.card .badge {
  font-size: 0.75rem !important;
  font-weight: 400 !important;
}

/* Card form elements */
.card .form-label,
.card label {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.card .form-control,
.card .form-select {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* ===== SPECIFIC MODAL FIXES ===== */
/* Subcategories modal */
#subcategoriesModal .modal-title {
  font-size: 1rem !important;
  font-weight: 500 !important;
}

#subcategoriesModal .font-weight-medium {
  font-size: 0.875rem !important;
  font-weight: 400 !important; /* Normal weight */
}

#subcategoriesModal .text-muted {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* Add/Edit category modals */
#addCategoryModal .modal-title,
#editCategoryModal .modal-title,
#addSubcategoryModal .modal-title,
#editSubcategoryModal .modal-title {
  font-size: 1rem !important;
  font-weight: 500 !important;
}

/* ===== STATISTICS CARD FIXES ===== */
.card-sm .font-weight-medium,
.card-sm .fs-4 {
  font-size: 1.25rem !important; /* Counter numbers */
  font-weight: 500 !important; /* Medium weight */
}

.card-sm .text-muted,
.card-sm .fs-6 {
  font-size: 0.8125rem !important; /* 13px */
  font-weight: 400 !important;
}

.card-sm .fs-7 {
  font-size: 0.75rem !important; /* 12px */
  font-weight: 400 !important;
}

/* ===== TABLE IN MODALS FIXES ===== */
.modal .table th {
  font-size: 0.8125rem !important;
  font-weight: 400 !important; /* Normal weight */
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal .table td {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* ===== AVATAR FIXES ===== */
.avatar {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.avatar-sm {
  font-size: 0.8125rem !important;
}

/* ===== DROPDOWN FIXES ===== */
.dropdown-menu {
  font-size: 0.875rem !important;
}

.dropdown-item {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.dropdown-header {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* ===== GLOBAL FONT WEIGHT OVERRIDES ===== */
/* Ensure no element in modals or cards is too bold */
.modal .fw-bold,
.modal .font-weight-bold,
.modal strong,
.modal b,
.card .fw-bold,
.card .font-weight-bold,
.card strong,
.card b {
  font-weight: 400 !important; /* Normal weight */
}

.modal .fw-semibold,
.modal .font-weight-semibold,
.card .fw-semibold,
.card .font-weight-semibold {
  font-weight: 400 !important;
}

.modal .fw-medium,
.modal .font-weight-medium,
.card .fw-medium,
.card .font-weight-medium {
  font-weight: 400 !important;
}

/* ===== SPECIFIC COMPONENT FIXES ===== */
/* Management tools card */
.card .fs-5 {
  font-size: 1rem !important; /* Reduced from larger */
  font-weight: 500 !important;
}

.card .fs-6 {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* Category overview buttons */
.list-group-item button {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* Enhanced filter form */
.form-select-sm,
.form-control-sm {
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  .modal-title {
    font-size: 0.9375rem !important;
  }
  
  .card-title {
    font-size: 0.875rem !important;
  }
  
  .modal .btn,
  .card .btn {
    font-size: 0.8125rem !important;
  }
}

/* ===== LOADING STATES ===== */
.modal .btn:disabled {
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

/* ===== FINAL CATCH-ALL RULES ===== */
/* Override any remaining heavy fonts in modals and cards */
.modal *,
.card * {
  font-weight: inherit !important;
}

/* Specific overrides for inline styles */
.modal [style*="font-weight: 600"],
.modal [style*="font-weight: 700"],
.modal [style*="font-weight: bold"],
.card [style*="font-weight: 600"],
.card [style*="font-weight: 700"],
.card [style*="font-weight: bold"] {
  font-weight: 400 !important;
}

/* Ensure proper text decoration */
.modal a,
.modal button,
.modal .btn,
.card a,
.card button,
.card .btn {
  text-decoration: none !important;
}

.modal a:hover,
.modal button:hover,
.modal .btn:hover,
.card a:hover,
.card button:hover,
.card .btn:hover {
  text-decoration: none !important;
}