/* ========================================
   ADVANCED TYPOGRAPHY & FONT SYSTEM
   ======================================== */

/* Import Professional Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Poppins:wght@300;400;500;600;700&display=swap');

/* Global Font Settings - Enhanced & Professional */
body,
html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; 
}

/* Headings - Professional Typography Hierarchy */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: 'Poppins', 'Inter', sans-serif !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  letter-spacing: -0.02em;
}

h1, .h1 { 
  font-size: 2.25rem !important; 
  font-weight: 700 !important;
}

h2, .h2 { 
  font-size: 1.875rem !important; 
  font-weight: 700 !important;
}

h3, .h3 { 
  font-size: 1.5rem !important; 
  font-weight: 600 !important;
}

h4, .h4 { 
  font-size: 1.25rem !important; 
  font-weight: 600 !important;
}

h5, .h5 { 
  font-size: 1.125rem !important; 
  font-weight: 500 !important;
}

h6, .h6 { 
  font-size: 1rem !important; 
  font-weight: 500 !important;
}

/* Paragraph & Text Enhancements */
p {
  font-size: 15px !important;
  line-height: 1.7 !important;
  margin-bottom: 1rem;
}

/* Navigation & Menu Text */
.nav-link,
.nav-menu a,
.page-sidebar a {
  font-size: 14.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em;
}

.nav-title {
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Sidebar Enhancements */
.page-sidebar .nav-link-text {
  font-size: 14.5px !important;
  font-weight: 500 !important;
}

.page-logo-text {
  font-family: 'Poppins', sans-serif !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
}

/* Button Text */
.btn {
  font-size: 14.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em;
}

.btn-lg {
  font-size: 16px !important;
  font-weight: 600 !important;
}

.btn-sm {
  font-size: 13px !important;
  font-weight: 500 !important;
}

/* Form Elements */
.form-control,
.form-select,
input,
textarea,
select {
  font-size: 14.5px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
}

.form-label,
label {
  font-size: 14px !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
  margin-bottom: 0.5rem;
}

/* Table Text */
.table {
  font-size: 14.5px !important;
}

.table thead th {
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.table tbody td {
  font-size: 14.5px !important;
  font-weight: 400 !important;
}

/* DataTables Enhancements */
.dataTables_wrapper {
  font-size: 14.5px !important;
}

.dataTables_filter input,
.dataTables_length select {
  font-size: 14px !important;
}

/* Card Headers */
.card-title {
  font-family: 'Poppins', sans-serif !important;
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 14px !important;
  font-weight: 400 !important;
}

/* Dashboard Stats */
.fs-xxl {
  font-size: 2.5rem !important;
  font-weight: 700 !important;
}

.fs-xl {
  font-size: 2rem !important;
  font-weight: 700 !important;
}

.fs-lg {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
}

/* Small Text */
small, .small {
  font-size: 13px !important;
}

/* Badge & Tags */
.badge {
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
}

/* Dropdown Menu */
.dropdown-menu {
  font-size: 14.5px !important;
}

.dropdown-item {
  font-size: 14.5px !important;
  font-weight: 400 !important;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 14px !important;
  font-weight: 500 !important;
}

/* Alert Messages */
.alert {
  font-size: 14.5px !important;
  line-height: 1.6 !important;
}

/* Modal */
.modal-title {
  font-family: 'Poppins', sans-serif !important;
  font-size: 1.375rem !important;
  font-weight: 600 !important;
}

.modal-body {
  font-size: 14.5px !important;
  line-height: 1.6 !important;
}

/* Tooltips */
.tooltip {
  font-size: 13px !important;
}

/* Strong & Bold Text */
strong, b, .fw-bold {
  font-weight: 700 !important;
}

/* Medium Weight */
.fw-medium, .fw-500 {
  font-weight: 500 !important;
}

/* Light Weight */
.fw-light, .fw-300 {
  font-weight: 300 !important;
}

/* ========================================
   PANEL SWITCHER STYLES
   ======================================== */
   
.link-box {
  display: inline-flex;
  font-family: 'Poppins', sans-serif !important;
}

.link-box a {
  text-decoration: none;
  padding: 10px 20px;
  border: 2px solid #0077cc;
  background-color: transparent;
  color: #0077cc;
  margin: 0;
  transition: all 0.3s ease;
  font-size: 14px !important;
  font-weight: 600 !important;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.link-box a:hover {
  background-color: rgba(0, 119, 204, 0.1);
  transform: translateY(-1px);
}

/* remove space between borders */
.link-box a + a {
  border-left: none;
}

/* Left button only */
.link-box a:first-child {
  border-radius: 6px 0 0 6px;
}

/* Right button only */
.link-box a:last-child {
  border-radius: 0 6px 6px 0;
}

/* Active state */
.link-box a.active {
  background-color: #0077cc;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 119, 204, 0.3);
}

/* ========================================
   COMPONENT LOADING OPTIMIZATIONS
   ======================================== */

/* Prevent flash during component loading */
#header:empty,
#sidebar:empty {
  min-height: 60px;
  background: transparent;
}

/* Smooth page content reveal */
.page-content,
#js-page-content,
main.page-content {
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
}

/* Hide flash of unstyled content */
.page-wrapper:not(.loaded) .page-content {
  visibility: visible;
}

/* Ensure header and sidebar don't flicker */
#header .page-header,
#sidebar .page-sidebar {
  animation: none !important;
}

/* Prevent layout shift during load */
#header {
  min-height: 60px;
}

#sidebar {
  min-height: 100vh;
}

/* Smooth transitions for dynamic content */
.page-content-wrapper {
  transition: margin-left 0.2s ease;
}

/* Professional loading state (minimal, non-intrusive) */
.component-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ========================================
   PROFESSIONAL TABLE LOADER
   ======================================== */

/* Table Loading Overlay */
.table-loader-wrapper {
  position: relative;
  min-height: 300px;
}

.table-loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.table-loader-overlay.hidden {
  display: none;
}

/* Spinner Container */
.table-loader-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Modern Spinner Animation - Updated to Blue Style */
.spinner-modern {
  width: 60px;
  height: 60px;
  border: 5px solid #e3f2fd;
  border-top: 5px solid #3498db;
  border-right: 5px solid #2980b9;
  border-radius: 50%;
  animation: spin-loader 1s linear infinite;
  box-shadow: 0 2px 10px rgba(52, 152, 219, 0.2);
}

/* Alternative: Circle Loader - Updated to Blue */
.spinner-circle {
  width: 60px;
  height: 60px;
  border: 5px solid #e3f2fd;
  border-top: 5px solid #3498db;
  border-right: 5px solid #2980b9;
  border-radius: 50%;
  animation: spin-loader 1s linear infinite;
  box-shadow: 0 2px 10px rgba(52, 152, 219, 0.2);
}

/* Dots Loader - Updated to Blue */
.spinner-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.spinner-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3498db;
  animation: bounce-loader 1.4s infinite ease-in-out;
}

.spinner-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.spinner-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

/* Loading Text - Updated to Blue */
.table-loader-text {
  font-family: 'Poppins', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: #3498db;
  letter-spacing: 0.5px;
  margin-top: 20px;
}

.table-loader-subtext {
  font-size: 0.95rem;
  color: #6c757d;
  margin-top: 8px;
  font-weight: 400;
}

/* Keyframe Animations */
@keyframes spin-loader {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Removed old pulse-loader and rotate-loader animations - no longer needed */

@keyframes bounce-loader {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fade-loader {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Table Loading Row (for simple loading states) */
.table-loading-row {
  text-align: center;
  padding: 40px 20px !important;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 20%, #f5f7fa 40%, #c3cfe2 60%, #f5f7fa 80%, #c3cfe2 100%);
  background-size: 200% 100%;
  animation: shimmer-loader 2s linear infinite;
  color: #3498db;
  font-weight: 600;
  font-size: 15px;
}

@keyframes shimmer-loader {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton Loader for Table Rows */
.skeleton-row {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer-loader 1.5s infinite;
  height: 20px;
  border-radius: 4px;
  margin: 8px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .spinner-modern {
    width: 45px;
    height: 45px;
  }
  
  .spinner-modern::before {
    width: 45px;
    height: 45px;
  }
  
  .spinner-modern::after {
    width: 37px;
    height: 37px;
  }
  
  .table-loader-text {
    font-size: 14px;
  }
}
