/* ==========================================================================
   DIALLO HRMS — GLOBAL BASE STYLES & RESET
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15.5px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  min-height: 100vh;
  position: relative;
  transition: background-color var(--transition-speed) var(--transition-ease),
              color var(--transition-speed) var(--transition-ease);
}

/* Base Responsive Container Constraints */
.app-container,
.main-wrapper,
.main-content,
.card {
  min-width: 0;
  max-width: 100%;
}

img, svg, canvas, video {
  max-width: 100%;
  height: auto;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.25;
}

h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.22rem; font-weight: 600; }
h4 { font-size: 1.05rem; font-weight: 600; }

p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-speed) var(--transition-ease);
}
a:hover {
  color: var(--primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

img, svg {
  vertical-align: middle;
  display: inline-block;
}

/* Utility Flex & Grid Helpers */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; min-width: 0; }
.flex-wrap { flex-wrap: wrap; }

.grid { display: grid; }
.grid-responsive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.grid-2-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.grid-3-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.grid-4-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.flex-responsive {
  display: flex;
  flex-direction: row;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-main { color: var(--text-main); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}
.badge-success {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}
.badge-warning {
  background: var(--warning-light);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}
.badge-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}
.badge-info {
  background: var(--info-light);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}
.badge-neutral {
  background: var(--bg-badge);
  color: var(--text-secondary);
  border: 1px solid var(--border-main);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Hidden elements */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ==========================================================================
   SYSTEM-WIDE UNIFORM TYPOGRAPHY & FONT SIZING STANDARDS
   ========================================================================== */
body, button, input, select, textarea, table, th, td, h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family) !important;
}

/* 1. Page Headers */
.page-title {
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  color: var(--text-main) !important;
  line-height: 1.25 !important;
  letter-spacing: -0.015em !important;
}

.page-subtitle {
  font-size: 0.85rem !important;
  font-weight: 400 !important;
  color: var(--text-secondary) !important;
  margin-top: 3px !important;
  line-height: 1.45 !important;
}

.breadcrumb {
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
}

/* 2. Cards & Section Titles */
.card-title, h3.card-title, div.card-title {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--text-main) !important;
  line-height: 1.3 !important;
}

.card-subtitle {
  font-size: 0.82rem !important;
  font-weight: 400 !important;
  color: var(--text-secondary) !important;
}

/* 3. Metric KPI Cards */
.kpi-value {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  color: var(--text-main) !important;
  line-height: 1.15 !important;
  letter-spacing: -0.02em !important;
}

.kpi-label {
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  color: var(--text-muted) !important;
}

.kpi-subtitle {
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  color: var(--text-secondary) !important;
}

/* 4. Tables */
table.data-table th, .table th {
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  color: var(--text-muted) !important;
}

table.data-table td, .table td {
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  color: var(--text-main) !important;
}

/* 5. Forms & Buttons */
.form-label {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: var(--text-main) !important;
}

.form-control, input, select, textarea {
  font-size: 0.85rem !important;
  font-family: var(--font-family) !important;
}

.btn {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  font-family: var(--font-family) !important;
}
