html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Focus visible styles for better keyboard navigation visibility */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Enhanced focus styles for all interactive elements */
:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

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

/* Focus styles that show when not using sr-only */
.sr-only:focus,
.sr-only:focus-within {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
  }
  
  .branch-card {
    border-width: 3px;
  }
}

/* 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;
    scroll-behavior: auto !important;
  }
  
  .animate-spin {
    animation: none !important;
  }
  
  .animate-pulse {
    animation: none !important;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Ensure color contrast ratios meet WCAG AA standards */
.text-gray-500 {
  color: #6b7280; /* 4.54:1 contrast ratio on white */
}

.dark .text-gray-400 {
  color: #9ca3af; /* 4.52:1 contrast ratio on dark backgrounds */
}

/* Staleness indicators with proper contrast */
.staleness-fresh {
  background-color: #22c55e;
  color: #ffffff;
}

.staleness-getting-old {
  background-color: #eab308;
  color: #000000;
}

.staleness-stale {
  background-color: #f97316;
  color: #000000;
}

.staleness-very-stale {
  background-color: #ef4444;
  color: #ffffff;
}

/* Branch grid layout adjustments when details panel is open */
.branch-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

/* When details panel is open, reduce columns */
.details-panel-open .branch-cards-container {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Ensure branch cards don't overflow */
.branch-card {
  min-width: 0; /* Allow cards to shrink */
  overflow: hidden;
}

/* On smaller screens with panel open, stack vertically */
@media (max-width: 1280px) {
  .details-panel-open .branch-cards-container {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 1024px) {
  .details-panel-open .branch-cards-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .details-panel-open .branch-cards-container {
    grid-template-columns: 1fr;
  }
}