/* Backend/Utility Styles - Bootstrap 5 Compatible */
/* Replaces common Nifty framework utilities with Bootstrap 5 equivalents */

/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #2c3e50;
  background-color: #f8f9fa;
}

/* Layout Utilities */
.container-custom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.boxed {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin: 20px 0;
}

.content-wrapper {
  min-height: calc(100vh - 120px);
  padding: 20px 0;
}

/* Flexbox Utilities */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-column {
  flex-direction: column;
}

/* Spacing Utilities */
.mb-small { margin-bottom: 8px; }
.mb-medium { margin-bottom: 16px; }
.mb-large { margin-bottom: 24px; }
.mb-xlarge { margin-bottom: 32px; }

.mt-small { margin-top: 8px; }
.mt-medium { margin-top: 16px; }
.mt-large { margin-top: 24px; }
.mt-xlarge { margin-top: 32px; }

.p-small { padding: 8px; }
.p-medium { padding: 16px; }
.p-large { padding: 24px; }
.p-xlarge { padding: 32px; }

/* Text Utilities */
.text-primary { color: #0F75BD; }
.text-secondary { color: #F72C93; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }
.text-info { color: #17a2b8; }
.text-light { color: #f8f9fa; }
.text-dark { color: #2c3e50; }
.text-muted { color: #6c757d; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-weight-light { font-weight: 300; }
.font-weight-normal { font-weight: 400; }
.font-weight-medium { font-weight: 500; }
.font-weight-semibold { font-weight: 600; }
.font-weight-bold { font-weight: 700; }

.font-size-small { font-size: 0.875rem; }
.font-size-medium { font-size: 1rem; }
.font-size-large { font-size: 1.25rem; }
.font-size-xlarge { font-size: 1.5rem; }

/* Background Utilities */
.bg-primary { background-color: #0F75BD; }
.bg-secondary { background-color: #F72C93; }
.bg-success { background-color: #28a745; }
.bg-danger { background-color: #dc3545; }
.bg-warning { background-color: #ffc107; }
.bg-info { background-color: #17a2b8; }
.bg-light { background-color: #f8f9fa; }
.bg-dark { background-color: #2c3e50; }
.bg-white { background-color: #ffffff; }

.bg-gradient-primary {
  background: linear-gradient(135deg, #0F75BD 0%, #1E88E5 100%);
}

.bg-gradient-secondary {
  background: linear-gradient(135deg, #F72C93 0%, #E91E63 100%);
}

/* Border Utilities */
.border-primary { border-color: #0F75BD; }
.border-secondary { border-color: #F72C93; }
.border-success { border-color: #28a745; }
.border-danger { border-color: #dc3545; }
.border-warning { border-color: #ffc107; }
.border-info { border-color: #17a2b8; }
.border-light { border-color: #dee2e6; }
.border-dark { border-color: #2c3e50; }

.border-radius-small { border-radius: 4px; }
.border-radius-medium { border-radius: 8px; }
.border-radius-large { border-radius: 12px; }
.border-radius-xlarge { border-radius: 16px; }
.border-radius-pill { border-radius: 50px; }
.border-radius-circle { border-radius: 50%; }

/* Shadow Utilities */
.shadow-small { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.shadow-medium { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.shadow-large { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
.shadow-xlarge { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); }

.shadow-primary { box-shadow: 0 4px 16px rgba(15, 117, 189, 0.3); }
.shadow-secondary { box-shadow: 0 4px 16px rgba(247, 44, 147, 0.3); }

/* Button Utilities */
.btn-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  line-height: 1.5;
}

.btn-custom:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.btn-primary-custom {
  background: linear-gradient(135deg, #0F75BD 0%, #1E88E5 100%);
  color: #ffffff;
}

.btn-primary-custom:hover {
  background: linear-gradient(135deg, #1565C0 0%, #1976D2 100%);
  box-shadow: 0 6px 16px rgba(15, 117, 189, 0.3);
  color: #ffffff;
}

.btn-secondary-custom {
  background: linear-gradient(135deg, #F72C93 0%, #E91E63 100%);
  color: #ffffff;
}

.btn-secondary-custom:hover {
  background: linear-gradient(135deg, #C2185B 0%, #D81B60 100%);
  box-shadow: 0 6px 16px rgba(247, 44, 147, 0.3);
  color: #ffffff;
}

.btn-outline-custom {
  background: transparent;
  border: 2px solid #0F75BD;
  color: #0F75BD;
}

.btn-outline-custom:hover {
  background: #0F75BD;
  color: #ffffff;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.125rem;
}

/* Form Utilities */
.form-group-custom {
  margin-bottom: 20px;
}

.form-control-custom {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control-custom:focus {
  outline: none;
  border-color: #0F75BD;
  box-shadow: 0 0 0 3px rgba(15, 117, 189, 0.1);
}

.form-label-custom {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
}

.form-text-custom {
  font-size: 0.875rem;
  color: #6c757d;
  margin-top: 4px;
}

.form-error {
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Card Utilities */
.card-custom {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.card-custom:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.card-header-custom {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 16px 24px;
  font-weight: 600;
  color: #2c3e50;
}

.card-body-custom {
  padding: 24px;
}

.card-footer-custom {
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 16px 24px;
}

/* Loading States */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #dee2e6;
  border-top: 2px solid #0F75BD;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* Responsive Utilities */
.show-mobile {
  display: none !important;
}

.hide-mobile {
  display: block !important;
}

@media (max-width: 768px) {
  .show-mobile {
    display: block !important;
  }
  
  .hide-mobile {
    display: none !important;
  }
  
  .container-custom {
    padding: 0 16px;
  }
  
  .boxed {
    padding: 16px;
    margin: 16px 0;
  }
  
  .btn-custom {
    padding: 10px 20px;
    font-size: 0.95rem;
  }
}

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

/* Focus indicators */
.focus-visible {
  outline: 2px solid #0F75BD;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card-custom,
  .boxed,
  .form-control-custom {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}