/* Accessibility Focus Indicators */

/* Global focus style that matches project colors */
:focus {
    outline: 2px solid rgba(41, 158, 147, 0.5); /* Using the theme color with some transparency */
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(41, 158, 147, 0.25);
}

/* Remove default focus styles for mouse users */
:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Apply focus styles only for keyboard navigation */
:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.5);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(41, 158, 147, 0.25);
    transition: outline-color 0.2s ease, box-shadow 0.2s ease;
}

/* Special focus style for interactive cards */
.card:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.5);
    box-shadow: 0 0 0 3px rgba(41, 158, 147, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Focus style for table elements */
table th:focus-visible,
table td:focus-visible,
tr[tabindex="0"]:focus-visible {
    position: relative;
    outline: none;
    background-color: rgba(41, 158, 147, 0.1);
    box-shadow: inset 0 0 0 1px rgba(41, 158, 147, 0.5);
}

/* Focus styles for buttons */
.btn:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.6);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(41, 158, 147, 0.25);
}

/* Focus styles for form inputs */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    border-color: rgba(41, 158, 147, 0.8);
    outline: none;
    box-shadow: 0 0 0 3px rgba(41, 158, 147, 0.25);
}

/* Focus styles for pagination */
.pagination .page-link:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.6);
    box-shadow: 0 0 0 2px rgba(41, 158, 147, 0.25);
    z-index: 5;
    position: relative;
}

/* Chart container focus */
.chart-container:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.5);
    outline-offset: 3px;
}

/* Dashboard stat cards focus */
.stat-card:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.5);
    box-shadow: 0 3px 10px rgba(41, 158, 147, 0.25);
}

/* Switch toggle focus */
.switch-toggle-slider:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.6);
    box-shadow: 0 0 0 3px rgba(41, 158, 147, 0.25);
}

/* Skip to content link - accessibility feature */
.skip-to-content {
    position: absolute;
    top: -50px;
    left: 0;
    padding: 12px 20px;
    background: #299e93;
    color: white;
    z-index: 1050;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    transition: top 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.skip-to-content:focus {
    top: 0;
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.skip-to-content:hover {
    background: #1e867c;
    text-decoration: underline;
}

.skip-to-content:active {
    background: #17756b;
}

/* Focus style for content area when reached via skip link */
#content:focus {
    outline: 2px solid rgba(41, 158, 147, 0.5);
    outline-offset: -2px;
}

/* Additional keyboard navigation enhancements */
.content-focus-point:focus {
    outline: none; /* Hide outline on the invisible focus point */
}

/* More visible focus indicators for sidebar navigation */
.sidebar-nav a:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.7);
    outline-offset: 2px;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced focus for card headers and actions */
.card-header:focus-visible,
.card-action:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.5);
    box-shadow: 0 0 0 2px rgba(41, 158, 147, 0.25);
    background-color: rgba(41, 158, 147, 0.05);
}

/* Improve dropdown menu accessibility */
.dropdown-menu a:focus-visible,
.dropdown-item:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.5);
    background-color: rgba(41, 158, 147, 0.1);
    color: #333;
}

/* Chart accessibility hint styles enhancement */
.chart-accessibility-hint {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 5;
}

/* Screen reader only class used by accessibility features */
.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;
}

/* Improved focus for interactive elements */
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="link"]:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.7);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(41, 158, 147, 0.25);
}

/* Style for keyboard shortcut hint */
.skip-to-content .keyboard-shortcut {
    font-size: 0.8em;
    opacity: 0.8;
    padding-left: 5px;
    font-style: italic;
}

/* When skip link is focused, adjust styles to make it more prominent */
.skip-to-content:focus-within {
    outline: 2px solid white;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Improved focus management for navigation elements */
nav[role="navigation"] a:focus-visible,
nav[role="navigation"] button:focus-visible {
    outline: 2px solid rgba(41, 158, 147, 0.7);
    outline-offset: 2px;
    position: relative;
    z-index: 5;
}
