/* accessibility.css - WCAG AA Compliance Styles */
/* TSA Data Management Platform - Accessibility Overrides */

/* =========================================== */
/* Focus Indicators for Keyboard Navigation   */
/* =========================================== */
:focus-visible {
  outline: 3px solid #ffc107 !important;
  outline-offset: 2px !important;
}

/* =========================================== */
/* High Contrast Mode Support                 */
/* =========================================== */
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid currentColor !important;
  }
}

/* =========================================== */
/* Reduced Motion Support                     */
/* =========================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================== */
/* Sidebar Styling                            */
/* =========================================== */
.sidebar {
  background-color: #343a40;
}

.sidebar .nav-link {
  color: rgba(255,255,255,0.85);
  padding: 0.75rem 1rem;
  border-radius: 0;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
  background-color: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar .nav-link.active {
  background-color: #1a5276;
  color: #fff;
}

.sidebar .nav-link .nav-icon {
  margin-right: 0.5rem;
  width: 1.25rem;
  text-align: center;
}

/* Menu section headers */
.sidebar-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.75);  /* Improved contrast for WCAG AA */
  padding: 1rem 1rem 0.5rem;
  margin-top: 0.5rem;
}

/* =========================================== */
/* Login Card Styling                         */
/* =========================================== */
.login-card {
  max-width: 400px;
  margin: 50px auto;
}

/* =========================================== */
/* Content Area                               */
/* =========================================== */
.main-content {
  padding: 1.5rem;
  background-color: #f8f9fa;
  min-height: 100vh;
}

/* =========================================== */
/* Card Improvements                          */
/* =========================================== */
.card {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

/* =========================================== */
/* Status Indicator in Sidebar                */
/* =========================================== */
.sidebar-status {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.85);  /* Improved contrast */
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* =========================================== */
/* Select Input Contrast Fixes                */
/* =========================================== */
select.form-select,
select.form-control,
.selectize-input,
.selectize-dropdown {
  color: #212529 !important;  /* Dark text for contrast */
}

select option {
  color: #212529;
  background-color: #fff;
}

/* =========================================== */
/* Placeholder Text Contrast                  */
/* =========================================== */
::placeholder {
  color: #495057 !important;  /* Darker placeholder for WCAG AA */
  opacity: 1;
}

/* =========================================== */
/* Text-muted Contrast Fix                    */
/* =========================================== */
.text-muted {
  color: #495057 !important;  /* WCAG AA compliant (4.65:1 on white) */
}

/* =========================================== */
/* Navbar Contrast Fix - BOSA Compliance      */
/* =========================================== */
/* Flatly navbar bg #2c3e50 gives only 3.59:1 with white text */
/* Solution: Darken the navbar background to #1a252f (11:1 contrast with white) */
.navbar,
.navbar-dark,
.navbar-expand-md,
nav.navbar,
.bslib-page-navbar nav,
.bslib-page-navbar .navbar {
  background-color: #1a252f !important;
}

/* Ensure navbar brand/title text is white */
.navbar .navbar-brand,
.navbar .bslib-page-title,
.navbar-brand.bslib-page-title,
h1.navbar-brand,
h1.bslib-page-title,
.bslib-page-title.navbar-brand,
.navbar-dark .navbar-brand,
.navbar-light .navbar-brand,
.bslib-page-navbar .navbar-brand,
.bslib-page-navbar .bslib-page-title,
nav .navbar-brand,
nav h1.bslib-page-title {
  color: #ffffff !important;  /* White text on dark navbar bg (11:1 contrast) */
}

/* =========================================== */
/* Legacy Color Override Fixes                */
/* =========================================== */
/* Fix any remaining #6c757d text to meet 4.5:1 */
[style*='color: #6c757d'],
[style*='color:#6c757d'] {
  color: #495057 !important;
}

/* Fix file input display text accessibility */
.shiny-input-container input[type='text'][readonly] {
  color: #212529 !important;
}

/* =========================================== */
/* Table Alignment CSS (replaces deprecated align attribute) */
/* =========================================== */
table td[align='right'],
table th[align='right'] {
  text-align: right !important;
}
table td[align='left'],
table th[align='left'] {
  text-align: left !important;
}
table td[align='center'],
table th[align='center'] {
  text-align: center !important;
}

/* =========================================== */
/* Button Contrast Fixes                      */
/* =========================================== */
/* Fix blue button contrast (#007bff has 3.98:1, need 4.5:1) */
[style*='background-color: #007bff'],
[style*='background-color:#007bff'] {
  background-color: #0056b3 !important;  /* Darker blue: 7.0:1 contrast */
}

/* Fix cyan/info button contrast (#17a2b8 has 3.04:1) */
[style*='background-color: #17a2b8'],
[style*='background-color:#17a2b8'] {
  background-color: #0c5460 !important;  /* Darker cyan: 7.5:1 contrast */
}

/* Fix yellow/warning text contrast (#ffc107 has 1.63:1 on white) */
[style*='color: #ffc107'],
[style*='color:#ffc107'] {
  color: #856404 !important;  /* Dark yellow: 5.7:1 contrast */
}

/* Fix green/success text contrast (#28a745 has 3.13:1 on white) */
[style*='color: #28a745'],
[style*='color:#28a745'],
[style*='color: rgb(40, 167, 69)'],
[style*='color:rgb(40, 167, 69)'] {
  color: #0a8927 !important;  /* Darker green: 4.5:1+ contrast (WCAG AA) */
}

/* Fix reactable green text cells */
.rt-td-inner[style*='color: #28a745'],
.rt-td-inner[style*='color:#28a745'] {
  color: #0a8927 !important;
}

/* =========================================== */
/* Plotly Modebar Accessibility Fixes          */
/* =========================================== */
/* Add accessible labels to Plotly modebar buttons via CSS */
.modebar-btn[data-title]::after {
  content: attr(data-title);
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Ensure modebar buttons have visible focus indicators */
.modebar-btn:focus-visible {
  outline: 2px solid #ffc107 !important;
  outline-offset: 2px;
}

/* Fix gray hint text contrast (#999 has 2.7:1, need 4.5:1) */
[style*='color: #999'],
[style*='color:#999'] {
  color: #495057 !important;  /* WCAG AA compliant gray (4.65:1) */
}

/* =========================================== */
/* Raw Upload Module - White Table Backgrounds */
/* =========================================== */
/* Force ALL table rows to white */

.card .card-body .table.table-sm.table-bordered tbody tr {
  background-color: #ffffff !important;
}

.card .card-body .table.table-sm.table-bordered tbody tr td {
  background-color: #ffffff !important;
  color: #000000 !important;
}

/* File Pattern column (1st) - force black text */
.card-body .table tbody tr td:nth-child(1) span {
  color: #212529 !important;
}

/* Required Sheets column (2nd) - force black text */
.card-body .table tbody tr td:nth-child(2) small {
  color: #212529 !important;
}

/* Status column (3rd) - override inline styles for WCAG compliance */
.card-body .table tbody tr td:nth-child(3) span[style] {
  font-weight: 600 !important;
  padding: 4px 8px !important;
  border-radius: 3px !important;
}

/* Missing status - red text on yellow background */
.card-body .table tbody tr[style*="#fff"] td:nth-child(3) span[style] {
  color: #dc3545 !important;
  background-color: transparent !important;
}

/* Available status - darker green background for white text (WCAG AA compliant) */
.card-body .table tbody tr[style*="#d1e7dd"] td:nth-child(3) span[style*="background-color: #28a745"],
.card-body .table tbody tr[style*="#e8f5e9"] td:nth-child(3) span[style*="background-color: #28a745"] {
  background-color: #0a8927 !important;
  color: #ffffff !important;
}

/* Action/Found File column (4th) - force black text */
.card-body .table tbody tr td:nth-child(4) {
  color: #212529 !important;
}

.card-body .table tbody tr td:nth-child(4) * {
  color: #212529 !important;
}

/* Refresh button - white background black border */
.card-header button {
  background-color: #ffffff !important;
  border: 2px solid #000000 !important;
  color: #000000 !important;
}

.card-header button svg {
  color: #000000 !important;
}

/* File Upload buttons - fix contrast */
.btn-default.btn-file,
.btn.btn-default.btn-file {
  background-color: #ffffff !important;
  color: #212529 !important;
  border: 1px solid #ced4da !important;
}

.btn-default.btn-file:hover {
  background-color: #f8f9fa !important;
}
