/* Additional styles for enhanced accessibility and user experience */

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0066cc;
    --text-color: #000000;
    --border-color: #666666;
  }

  .card {
    border: 2px solid var(--border-color);
  }

  .btn {
    border: 2px solid currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .navbar,
  .modal,
  .btn,
  #loading-overlay {
    display: none !important;
  }

  .card {
    border: 1px solid #000;
    break-inside: avoid;
  }

  .table {
    font-size: 12px;
  }

  .container {
    max-width: 100%;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #8b5cf6;
    --secondary-color: #1f2937;
    --text-color: #f9fafb;
    --border-color: #374151;
  }

  body {
    background-color: var(--secondary-color);
    color: var(--text-color);
  }

  .card {
    background-color: #374151;
    color: var(--text-color);
  }

  .table {
    color: var(--text-color);
  }

  .table thead th {
    background-color: #4b5563;
    color: var(--text-color);
  }

  .form-control,
  .form-select {
    background-color: #4b5563;
    border-color: var(--border-color);
    color: var(--text-color);
  }

  .form-control:focus,
  .form-select:focus {
    background-color: #4b5563;
    border-color: var(--primary-color);
    color: var(--text-color);
  }

  .modal-content {
    background-color: #374151;
    color: var(--text-color);
  }

  .navbar-dark {
    background-color: #111827 !important;
  }
}

/* Focus indicators for better accessibility */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10000;
}

.skip-link:focus {
  top: 6px;
}

/* Improve form validation styling */
.form-control.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid {
  border-color: #198754;
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

/* Better visual hierarchy */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
}

/* Improved table responsiveness */
@media (max-width: 768px) {
  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive th,
  .table-responsive td,
  .table-responsive tr {
    display: block;
  }

  .table-responsive thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .table-responsive tr {
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    padding: 10px;
  }

  .table-responsive td {
    border: none;
    padding: 5px;
    position: relative;
    padding-left: 50%;
  }

  .table-responsive td:before {
    content: attr(data-label);
    position: absolute;
    left: 6px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    font-weight: bold;
  }
}

/* Loading animation improvements */
.loading-overlay {
  backdrop-filter: blur(2px);
}

/* Better notification positioning */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 400px;
}

/* Smooth transitions for section changes */
.section {
  transition: opacity 0.3s ease-in-out;
}

.section:not(.active) {
  opacity: 0;
  pointer-events: none;
}

.section.active {
  opacity: 1;
  pointer-events: auto;
}

/* Better form layout */
.form-floating {
  position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
  height: calc(3.5rem + 2px);
  line-height: 1.25;
}

.form-floating > label {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  padding: 1rem 0.75rem;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
}

/* Enhanced card hover effects */
.card-interactive {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Status badges */
.badge-status {
  font-size: 0.75em;
  padding: 0.5em 0.75em;
  border-radius: 12px;
  font-weight: 500;
}

.badge-active {
  background-color: var(--accent-color);
  color: white;
}

.badge-inactive {
  background-color: #6b7280;
  color: white;
}

.badge-pending {
  background-color: #f59e0b;
  color: white;
}

/* Improved button groups */
.btn-group-vertical .btn:not(:last-child) {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group-vertical .btn:not(:first-child) {
  border-top-right-radius: 0;
  border-top-left-radius: 0;
}

/* Custom checkbox and radio styling */
.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.form-check-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.25);
}

/* Better text truncation */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
