/* ========================================
   TNYI LMX TYPOGRAPHY SYSTEM
   (Bootstrap 5.3.3 Enhancements)
   ======================================== */

:root {
  /* Font Family definitions already exist in custom.css, 
     but we enforce standard sizing here */
  --tnyi-font-xs: 0.75rem;     /* 12px */
  --tnyi-font-sm: 0.875rem;    /* 14px */
  --tnyi-font-base: 1rem;      /* 16px */
  --tnyi-font-lg: 1.125rem;    /* 18px */
  --tnyi-font-xl: 1.25rem;     /* 20px */
  --tnyi-font-2xl: 1.5rem;     /* 24px */
  --tnyi-font-3xl: 1.875rem;   /* 30px */
  --tnyi-font-4xl: 2.25rem;    /* 36px */
}

/* ========================================
   BASE TYPOGRAPHY
   ======================================== */
body {
    font-size: var(--tnyi-font-sm); /* Standard base size for dashboards */
    line-height: 1.5;
}

/* Headings */
h1, .h1 { font-size: var(--tnyi-font-4xl) !important; font-weight: 700 !important; letter-spacing: -0.02em; }
h2, .h2 { font-size: var(--tnyi-font-3xl) !important; font-weight: 700 !important; letter-spacing: -0.01em; }
h3, .h3 { font-size: var(--tnyi-font-2xl) !important; font-weight: 600 !important; }
h4, .h4 { font-size: var(--tnyi-font-xl) !important; font-weight: 600 !important; }
h5, .h5 { font-size: var(--tnyi-font-lg) !important; font-weight: 600 !important; }
h6, .h6 { font-size: var(--tnyi-font-base) !important; font-weight: 600 !important; }

/* Paragraphs & Text */
p {
    font-size: var(--tnyi-font-sm);
    margin-bottom: 1rem;
    color: var(--bs-gray-700);
}

.text-xs { font-size: var(--tnyi-font-xs) !important; }
.text-sm { font-size: var(--tnyi-font-sm) !important; }
.text-base { font-size: var(--tnyi-font-base) !important; }
.text-lg { font-size: var(--tnyi-font-lg) !important; }
.text-xl { font-size: var(--tnyi-font-xl) !important; }

/* Font Weights */
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.fw-extrabold { font-weight: 800 !important; }

/* Specific UI Typography Elements */
.card-title {
    font-size: var(--tnyi-font-lg) !important;
    font-weight: 600 !important;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.card-subtitle {
    font-size: var(--tnyi-font-sm) !important;
    font-weight: 500 !important;
    color: var(--bs-gray-500);
}

.page-title {
    font-size: var(--tnyi-font-2xl) !important;
    font-weight: 700 !important;
    color: var(--bs-gray-900);
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
}

.page-description {
    font-size: var(--tnyi-font-sm) !important;
    color: var(--bs-gray-600);
    font-weight: 400;
}

.table th {
    font-size: 0.8125rem !important; /* 13px */
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-gray-600);
}

.table td {
    font-size: var(--tnyi-font-sm) !important;
    font-weight: 400;
}

.badge {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.025em;
    padding: 0.35em 0.65em;
}

/* Sidebar & Navigation Typography */
.nav-link {
    font-size: var(--tnyi-font-sm) !important;
    font-weight: 500 !important;
}

.form-label {
    font-size: var(--tnyi-font-sm) !important;
    font-weight: 600 !important;
}

.form-control, .form-select {
    font-size: var(--tnyi-font-sm) !important;
}

.btn {
    font-size: var(--tnyi-font-sm) !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
}

.btn-sm {
    font-size: 0.8125rem !important; /* 13px */
}

.btn-lg {
    font-size: var(--tnyi-font-base) !important;
}

/* Text Muted / Colors for Dark Mode Support */
[data-bs-theme="dark"] p,
[data-bs-theme="dark"] .card-text,
[data-bs-theme="dark"] .table td {
    color: var(--bs-gray-300);
}

[data-bs-theme="dark"] .page-title,
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] .h1,
[data-bs-theme="dark"] h2, [data-bs-theme="dark"] .h2,
[data-bs-theme="dark"] h3, [data-bs-theme="dark"] .h3,
[data-bs-theme="dark"] h4, [data-bs-theme="dark"] .h4,
[data-bs-theme="dark"] h5, [data-bs-theme="dark"] .h5,
[data-bs-theme="dark"] h6, [data-bs-theme="dark"] .h6 {
    color: #f8fafc !important;
}

/* ========================================
   SELECT2 CUSTOM MODERN STYLING
   ======================================== */

/* General Container */
.select2-container--bootstrap-5 .select2-selection,
.select2-container--default .select2-selection {
    border: 1px solid var(--bs-gray-300) !important;
    border-radius: var(--bs-border-radius, 0.5rem) !important;
    min-height: 42px;
    padding: 2px 5px;
    box-shadow: var(--bs-shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
    transition: all 0.2s ease-in-out;
    background-color: #fff;
}

.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--bs-primary, #0b1943) !important;
    box-shadow: 0 0 0 3px rgba(11, 25, 67, 0.1) !important;
    outline: 0;
}

/* Multiple Selection Tags (Badges) */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--bs-primary-bg-subtle, #f0f4f8) !important;
    border: 1px solid var(--bs-primary-border-subtle, #e2e8f0) !important;
    color: var(--bs-primary, #0b1943) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    margin-top: 5px !important;
    margin-right: 5px !important;
    font-size: 0.8125rem !important; /* 13px */
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center;
    box-shadow: none !important;
}

/* The 'x' remove button on badges */
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--bs-primary, #0b1943) !important;
    border: none !important;
    background: transparent !important;
    margin-right: 6px !important;
    padding: 0 !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    position: static !important;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--bs-danger, #ef4444) !important;
    background: transparent !important;
}

/* The input field area */
.select2-container .select2-search--inline .select2-search__field {
    margin-top: 7px !important;
    font-family: inherit;
    font-size: 0.875rem !important;
    color: var(--bs-gray-700, #374151) !important;
}

/* Dropdown Menu styling */
.select2-dropdown {
    border: 1px solid var(--bs-gray-200, #e5e7eb) !important;
    border-radius: var(--bs-border-radius-lg, 0.75rem) !important;
    box-shadow: var(--bs-shadow-lg, 0 10px 15px -3px rgb(0 0 0 / 0.1)) !important;
    overflow: hidden;
    padding: 4px;
}

.select2-container--default .select2-results__option {
    padding: 8px 12px;
    font-size: 0.875rem;
    border-radius: 4px;
    margin-bottom: 2px;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--bs-primary, #0b1943) !important;
    color: white !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--bs-gray-100, #f3f4f6) !important;
    color: var(--bs-gray-900, #111827) !important;
    font-weight: 500;
}

/* Dark mode support */
[data-bs-theme="dark"] .select2-container--default .select2-selection {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .select2-container .select2-search--inline .select2-search__field {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .select2-dropdown {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #334155 !important;
    color: white !important;
}
