/* WCAG 2.1 Accessibility Styles */

/* Skip to Main Content Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: white;
  padding: 8px;
  z-index: 100;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #FFD700;
  outline-offset: 2px;
}

/* Scroll to Top Button - Accessibility */
.scroll-top-to {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: #007bff;
  color: white;
  border: 2px solid transparent;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: none;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 24px;
  z-index: 99;
  transition: all 0.3s ease;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
}

.scroll-top-to:hover,
.scroll-top-to:focus {
  background-color: #0056b3;
  border-color: #FFD700;
  outline: 3px solid #FFD700;
  outline-offset: 2px;
}

.scroll-top-to:focus {
  outline: 3px solid #FFD700;
  outline-offset: 2px;
}

/* Keyboard Focus Visible for All Interactive Elements */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #4A90E2;
  outline-offset: 2px;
}

/* High Contrast Focus State for Better Visibility */
*:focus-visible {
  outline: 3px solid #4A90E2;
  outline-offset: 2px;
}

/* Modal Adjustments for Accessibility */
.modal-header {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  padding: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #000;
}

/* Close Button in Modal */
.btn-close:focus {
  outline: 3px solid #4A90E2;
  outline-offset: 2px;
}

/* Marquee Accessibility - High Contrast */
marquee {
  padding: 10px;
  background-color: #000;
  color: #fff;
  font-size: 16px;
}

/* Ensure Icon Buttons have Sufficient Target Size (24x24px minimum) */
button[type="button"] {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1rem;
}

/* Link Contrast Improvement */
a {
  text-decoration: underline;
  color: #0056b3;
}

a:visited {
  color: #6a0dad;
}

a:active {
  color: #004085;
}

/* Strong color contrast for text on backgrounds */
.text-primary {
  color: #0056b3 !important;
}

.text-muted {
  color: #666 !important;
}

/* Form Label Accessibility */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

/* Input Focus */
input:focus,
select:focus,
textarea:focus {
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
  background-color: #fff;
}

/* Icon Accessibility - Add aria-hidden styling */
[aria-hidden="true"] {
  display: none;
}

/* Ensure text is resizable */
html {
  font-size: 16px;
  /* Allow users to zoom to 200% */
  max-width: 100%;
}

body {
  font-size: 1rem;
  line-height: 1.5;
}

/* Prevent horizontal scrolling on smaller devices */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }
  
  .scroll-top-to {
    width: 44px;
    height: 44px;
    bottom: 20px;
    right: 20px;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: more) {
  body {
    background-color: #fff;
    color: #000;
  }
  
  a {
    color: #0000EE;
    text-decoration: underline;
  }
  
  button {
    border: 2px solid #000;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .scroll-top-to {
    transition: none;
  }
}

/* Ensures elements are keyboard focusable */
[tabindex],
button,
a,
input,
select,
textarea {
  outline: 0;
}

[tabindex]:focus,
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #4A90E2;
  outline-offset: 2px;
}

/* ========================================
   PAGE FRIENDLY IMPROVEMENTS
   ======================================== */

/* Remove any fixed positioning that might interfere */
body {
  position: relative;
  overflow-x: hidden;
}

/* Ensure proper page flow */
html, body {
  height: auto;
  min-height: 100vh;
}

/* Fix any potential layout shifts */
* {
  box-sizing: border-box;
}

/* Ensure footer stays at bottom */
footer {
  clear: both;
}

/* Prevent horizontal scroll on mobile */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* Improve page loading performance */
img {
  max-width: 100%;
  height: auto;
}

/* Ensure smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* High contrast mode support for better visibility */
@media (prefers-contrast: high) {
  body {
    background: white;
    color: black;
  }

  .gradient-banner {
    background: #f8f9fa !important;
  }

  .btn-main {
    background: #000 !important;
    color: white !important;
    border: 2px solid #000 !important;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Custom Modal - Page Friendly */
.accessibility-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1050;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.accessibility-modal.show {
  display: flex;
}

.accessibility-modal .modal-content {
  background: white;
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-close-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 40px;
  height: 40px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  min-width: 44px;
  min-height: 44px;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  background: #c82333;
  outline: 3px solid #4A90E2;
  outline-offset: 2px;
}

#popupImageContainer img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Bootstrap Modal Responsive Fixes */
.modal-dialog {
  margin: 1.75rem auto;
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: none;
  }

  .modal-content {
    border-radius: 0;
    height: 100vh;
    max-height: none;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-header .modal-title {
    font-size: 1.25rem;
  }

  .accessibility-modal {
    padding: 10px;
  }

  .accessibility-modal .modal-content {
    max-width: 100%;
    max-height: 100%;
    padding: 15px;
  }

  .modal-close-btn {
    width: 36px;
    height: 36px;
    font-size: 20px;
    top: -8px;
    right: -8px;
  }
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
  padding-right: 0 !important;
}

/* Focus trap for modals */
.modal:focus-within {
  outline: none;
}

/* Ensure modal backdrop doesn't interfere */
.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

/* Site notices (previously investor notices) - visible and readable */
.site-notices {
  background-color: #343a40 !important;
  padding: 15px 20px !important;
  margin: 0 !important;
  border-bottom: 1px solid #454d55;
}

.site-notices-container {
  max-width: 100%;
  margin: 0 auto;
}

.site-notices-container h3.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;
}

.notice-item {
  margin-bottom: 10px;
  padding: 10px 15px;
  background-color: rgba(0, 0, 0, 0.2);
  border-left: 3px solid #6c757d;
  border-radius: 3px;
  text-align: left;
}

.notice-item:last-child {
  margin-bottom: 0;
}

.notice-text {
  color: #e9ecef !important;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  font-weight: 400;
}

.notice-text a {
  color: #b0b8c1;
  text-decoration: underline;
  font-weight: 500;
}

.notice-text a:hover,
.notice-text a:focus {
  color: #ffffff;
  outline: 2px solid #6c757d;
  outline-offset: 1px;
}

/* Footer Copyright and Links */
.footer-copyright-section {
  margin: 0;
  padding: 0;
}

.footer-copyright {
  background-color: #343a40 !important;
  padding: 12px 15px !important;
  margin: 0 !important;
  border-top: 1px solid #454d55;
  text-align: center;
}

.footer-copyright small {
  color: #b0b8c1;
  font-size: 13px;
  display: block;
}

.footer-links {
  margin-bottom: 8px;
  text-align: center;
  padding: 0;
}

.footer-links a {
  color: #b0b8c1;
  text-decoration: underline;
  margin: 0 8px;
  font-weight: 500;
  font-size: 13px;
  display: inline-block;
}

.footer-links a:hover,
.footer-links a:focus {
  color: #ffffff;
  outline: 2px solid #6c757d;
  outline-offset: 1px;
}

/* Social Icons Accessibility */
.social-icon {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.social-icon li a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background-color: #454d55;
  border-radius: 50%;
  color: #b0b8c1;
  text-decoration: none;
  transition: all 0.3s ease;
  min-width: 44px;
  min-height: 44px;
  border: 2px solid transparent;
}

.social-icon li a:hover,
.social-icon li a:focus {
  background-color: #565e67;
  color: #ffffff;
  outline: 2px solid #b0b8c1;
  outline-offset: 2px;
}

.social-icon li a i {
  font-size: 18px;
  display: block;
}

/* Footer responsive and accessibility tweaks */
.site-footer .footer-top .btn {
  border: 1px solid rgba(255,255,255,0.16);
  background: transparent;
  color: #fff;
  padding: 8px 12px;
}

.site-footer a {
  color: #d1d5d9;
  text-decoration: underline;
}

.site-footer a:focus,
.site-footer a:hover {
  color: #ffffff;
  outline: 3px solid rgba(255,215,0,0.12);
  outline-offset: 2px;
}

/* Guidelines modal specific styles (inherited by accessibility-modal) */
#accessibilityGuidelinesModal .modal-content {
  max-width: 900px;
  width: 94%;
  padding: 20px;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .site-footer .footer-top .row {
    display: block;
  }
  .site-footer .footer-top .col-lg-4 { width: 100%; }
  #accessibilityGuidelinesModal .modal-content { max-height: 85vh; overflow:auto; }
}

/* Improve custom accessibility-modal responsiveness */
.accessibility-modal .modal-content {
  max-width: 900px;
  width: 90%;
  padding: 18px;
}

.accessibility-modal .modal-content img {
  max-width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 576px) {
  .accessibility-modal {
    align-items: flex-start;
    padding: 8px;
  }

  .accessibility-modal .modal-content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    border-radius: 0;
    margin: 0;
    padding: 12px;
    box-sizing: border-box;
  }

  .accessibility-modal .modal-content img {
    max-height: calc(100vh - 160px);
    object-fit: contain;
  }

  .modal-close-btn {
    top: 8px;
    right: 8px;
  }
}

/* Ensure Bootstrap modal images also scale on very small screens */
.modal .modal-body img {
  max-width: 100%;
  height: auto;
}
