/*
 * Accessibility Helper Frontend Styles
 * Version: 1.2.0
 * Production Ready CSS with enhanced accessibility features
 */

.accessible-links {
    list-style-type: none;
    padding: 0;
    margin: 0;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.accessible-links ul {
    display: flex;
    justify-content: center;
    list-style-type: none;
    padding: 2px;
    margin: 0;
    background-color: transparent;
}

.accessible-links li {
    margin-right: 2px;
}

.accessible-links li:last-child {
    margin-right: 0;
}

.accessible-links a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 25px !important;
    height: 25px !important;
    color: #000;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid #000;
    border-radius: 0;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #fff;
    position: relative;
}

/* Focus styles for better accessibility */
.accessible-links a:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px #005fcc;
}

/* Keyboard navigation support */
.accessible-links a:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

.accessible-links .font-decrease+li a,
.accessible-links .high-contrast.dark a {
    background-color: #000;
    color: #fff;
    box-shadow: 0 0 0 2px #000;
    border: 1px solid #fff;
}

.accessible-links a:hover,
.accessible-links a:active {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.accessible-links .high-contrast.dark a:hover,
.accessible-links .high-contrast.dark a:focus {
    background-color: #333;
}

.accessible-links span {
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
}

.accessible-links .font-increase span {
    font-size: 18px;
}

.accessible-links .font-decrease span {
    font-size: 14px;
}

/* Active state for buttons */
.high-contrast.active a {
    background: #fff !important;
    color: #000 !important;
    border-radius: 3px;
    padding: 2px 5px;
}

.high-contrast.dark.active a {
    background: #000 !important;
    color: #fff !important;
    border: 1px solid #fff;
}

/* Loading state */
.accessible-links a.loading {
    opacity: 0.6;
    pointer-events: none;
}

.accessible-links a.loading::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== HIGH CONTRAST MODE STYLES ===== */
body.high-contrast-mode,
body.high-contrast-mode :root,
body.high-contrast-mode html,
body.high-contrast-mode div:not(.custom-logo-link, .header-logo, .site-logo, .logo, .n2-ow, .accessible-links, .accessible-links *),
body.high-contrast-mode section,
body.high-contrast-mode article,
body.high-contrast-mode aside,
body.high-contrast-mode header:not([class*="logo"]),
body.high-contrast-mode footer,
body.high-contrast-mode main,
body.high-contrast-mode nav,
body.high-contrast-mode form,
body.high-contrast-mode input,
body.high-contrast-mode textarea,
body.high-contrast-mode select,
body.high-contrast-mode button,
body.high-contrast-mode label,
body.high-contrast-mode h1,
body.high-contrast-mode h2,
body.high-contrast-mode h3,
body.high-contrast-mode h4,
body.high-contrast-mode h5,
body.high-contrast-mode h6,
body.high-contrast-mode p,
body.high-contrast-mode a,
body.high-contrast-mode span,
body.high-contrast-mode strong,
body.high-contrast-mode em,
body.high-contrast-mode i,
body.high-contrast-mode b,
body.high-contrast-mode ul,
body.high-contrast-mode ol,
body.high-contrast-mode li,
body.high-contrast-mode table,
body.high-contrast-mode thead,
body.high-contrast-mode tbody,
body.high-contrast-mode tfoot,
body.high-contrast-mode tr,
body.high-contrast-mode th,
body.high-contrast-mode td,
body.high-contrast-mode pre,
body.high-contrast-mode code,
body.high-contrast-mode blockquote,
body.high-contrast-mode iframe,
body.high-contrast-mode video,
body.high-contrast-mode embed,
body.high-contrast-mode object {
    background: #000 !important;
    color: #fff !important;
    border-color: #444 !important;
    outline-color: #444 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Links in high contrast mode */
body.high-contrast-mode a,
body.high-contrast-mode a *,
body.high-contrast-mode a:link,
body.high-contrast-mode a:visited,
body.high-contrast-mode a:hover,
body.high-contrast-mode a:active,
body.high-contrast-mode a:focus {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

/* Form elements in high contrast mode */
body.high-contrast-mode input,
body.high-contrast-mode textarea,
body.high-contrast-mode select,
body.high-contrast-mode button,
body.high-contrast-mode [type="button"],
body.high-contrast-mode [type="submit"],
body.high-contrast-mode [type="reset"],
body.high-contrast-mode [type="checkbox"],
body.high-contrast-mode [type="radio"] {
    background: #222 !important;
    color: #fff !important;
    border: 1px solid #444 !important;
}

/* Logo inversion in high contrast mode */
body.high-contrast-mode .custom-logo-link img,
body.high-contrast-mode .header-logo img,
body.high-contrast-mode .site-logo img,
body.high-contrast-mode .logo img {
    filter: invert(1) contrast(1.2) brightness(1.1) !important;
    transition: filter 0.3s ease !important;
    background: transparent !important;
}

/* Focus styles in high contrast mode */
body.high-contrast-mode :focus {
    outline: 2px solid #ffff00 !important;
    outline-offset: 2px !important;
}

/* Scrollbars in high contrast mode */
body.high-contrast-mode ::-webkit-scrollbar {
    width: 12px !important;
    background: #222 !important;
}

body.high-contrast-mode ::-webkit-scrollbar-thumb {
    background: #444 !important;
    border: 2px solid #222 !important;
}

/* Print styles */
@media print {
    .accessible-links {
        display: none !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .accessible-links a {
        transition: none;
    }
    
    .accessible-links a:hover,
    .accessible-links a:active {
        transform: none;
    }
    
    .accessible-links a.loading::after {
        animation: none;
    }
}

/* ===== RESPONSIVE STYLES ===== */
/* Extra Small Devices (phones, 320px and up) */
@media only screen and (min-width: 320px) {
    .accessible-links ul {
        padding: 2px;
    }

    .accessible-links a {
        width: 20px !important;
        height: 20px !important;
    }

    .accessible-links span {
        font-size: 10px;
    }

    .accessible-links .font-increase span {
        font-size: 10px;
    }

    .accessible-links .font-decrease span {
        font-size: 10px;
    }
}

/* Small Devices (larger phones, 375px and up) */
@media only screen and (min-width: 375px) {
    .accessible-links a {
        width: 20px !important;
        height: 20px !important;
    }

    .accessible-links span {
        font-size: 12px;
    }

    .accessible-links .font-increase span {
        font-size: 12px;
    }

    .accessible-links .font-decrease span {
        font-size: 12px;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media only screen and (min-width: 768px) {
    .accessible-links ul {
        padding: 3px;
    }

    .accessible-links a {
        width: 25px !important;
        height: 25px !important;
    }

    .accessible-links li {
        margin-right: 3px;
    }
}

@media only screen and (min-width: 1024px) {
    .accessible-links span {
        font-size: 12px;
    }

    .accessible-links .font-increase span {
        font-size: 12px;
    }

    .accessible-links .font-decrease span {
        font-size: 12px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .accessible-links a {
        padding: 0px;
    }

    .accessible-links a:active {
        background-color: #e0e0e0;
    }

    .accessible-links .high-contrast.dark a:active {
        background-color: #333;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .accessible-links a {
        border-width: 2px;
    }

    .accessible-links a:focus {
        outline: 2px solid currentColor;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .accessible-links a {
        background: #333;
        color: #fff;
        border-color: #666;
    }
    
    .accessible-links a:focus {
        outline-color: #66b3ff;
        box-shadow: 0 0 0 1px #333, 0 0 0 3px #66b3ff;
    }
}
