/**
 * Accessibility Widget Styles
 * Ported from MB2NL Moodle Theme
 * Full WCAG 2.1 Compliant Features
 */

/* ===================================================================== */
/* CSS VARIABLES FOR CONTRAST MODES */
/* ===================================================================== */

:root {
    --acsb-bg: #181818;
    --acsb-color: #ffffff;
    --acsb-bocolor: #282828;
    --acsb-filtercolor: brightness(0) saturate(100%) invert(100%) sepia(91%) saturate(0%) hue-rotate(298deg) brightness(105%) contrast(101%);
}

.acsb_contrastlight {
    --acsb-bg: #ffffff;
    --acsb-color: #000000;
    --acsb-bocolor: #dddddd;
    --acsb-filtercolor: brightness(0) saturate(100%) invert(0%) sepia(100%) saturate(7494%) hue-rotate(292deg) brightness(70%) contrast(100%);
}

/* ===================================================================== */
/* KEYBOARD NAVIGATION & FOCUS STYLES */
/* ===================================================================== */

a,
button,
[type="submit"],
input,
textarea,
.nav-link {
    outline: none;
}

.themefocused {
    outline: none !important;
}

.themefocused:focus {
    box-shadow: 0 0 0 3px var(--accessibility-primary-color, #5838fc) !important;
}

.themekeynavonly {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
}

.themekeynavonly.themefocused:focus {
    position: relative;
    width: auto;
    height: auto;
    margin: 0;
    background-color: #fff;
    color: #000;
    box-shadow: 0 0 0 3px var(--accessibility-primary-color, #5838fc);
}

/* Skip Links */
.visually-hidden-focusable,
.sr-only-focusable {
    position: absolute;
    clip: rect(1px, 1px, 1px, 1px);
    padding: 0;
    border: 0;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.visually-hidden-focusable:active,
.visually-hidden-focusable:focus,
.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: absolute;
    z-index: 99999999999999;
    display: inline-flex;
    align-items: center;
    gap: .8rem;
    background-color: #fff !important;
    color: #000 !important;
    box-shadow: 0 0 0 5px var(--accessibility-primary-color, #5838fc);
    top: 25px;
    left: 25px;
    border-radius: 6px;
    padding: 7px 13px;
    font-size: 1.35rem;
    font-weight: bold;
    clip: auto;
    height: auto;
    width: auto;
    overflow: visible;
}

/* ===================================================================== */
/* ACCESSIBILITY WIDGET - FLOATING BUTTON */
/* ===================================================================== */

.accessibility-trigger {
    position: fixed;
    width: 50px;
    height: 50px;
    z-index: 100000;
    background-color: var(--accessibility-primary-color, #5838fc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: solid 2px #fff;
    box-shadow: 0 0 10px rgba(0,0,0,.2);
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.accessibility-trigger:hover {
    transform: scale(1.1);
}

.accessibility-trigger.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: -8px;
    background-color: #14C38E;
    border: solid 2px #fff;
    border-radius: 50%;
    width: 19px;
    height: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Position variants */
.accessibility-trigger.position-bottom-right {
    bottom: 88px;
    right: 27px;
}

.accessibility-trigger.position-bottom-left {
    bottom: 27px;
    left: 27px;
}

.accessibility-trigger.position-top-right {
    top: 27px;
    right: 27px;
}

.accessibility-trigger.position-top-left {
    top: 27px;
    left: 27px;
}

.accessibility-icon {
    width: 26px;
    height: 26px;
}

.accessibility-icon path {
    fill: #fff;
}

/* ===================================================================== */
/* ACCESSIBILITY WIDGET - PANEL */
/* ===================================================================== */

.accessibility-block {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    bottom: 0;
    right: 0;
    margin-right: 27px;
    margin-bottom: 20px;
    background-color: var(--accessibility-primary-color, #5838fc);
    width: 420px;
    max-width: calc(100% - 54px);
    padding: 2px;
    z-index: 99999;
    max-height: calc(100% - 40px);
    box-shadow: 0 10px 35px rgba(0,0,0,.18);
    border-radius: 8px;
    line-height: 1.125 !important;
    display: flex;
    flex-flow: column;
    font-size: 15px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.accessibility-block.visible {
    visibility: visible;
    opacity: 1;
}

.accessibility-block * {
    font-family: Arial, Helvetica, sans-serif;
}

.accessibility-block-inner {
    color: #000;
    padding: 0 20px 20px 20px;
    background-color: #fff;
    border-radius: 6px;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}

/* Scrollbar styling */
.accessibility-block-inner::-webkit-scrollbar {
    width: 8px;
}

.accessibility-block-inner::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.accessibility-block-inner::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.22);
    border-radius: 4px;
}

.accessibility-block-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,.35);
}

.accessibility-block-header,
.accessibility-block-footer {
    padding: 5px 15px;
}

.accessibility-block-header a,
.accessibility-block-header button,
.accessibility-block-footer a,
.accessibility-block-footer button {
    color: rgba(255,255,255,.75);
    padding: 3px 5px;
    gap: 6px;
    line-height: 1;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.accessibility-block-header a:hover,
.accessibility-block-header button:hover,
.accessibility-block-footer a:hover,
.accessibility-block-footer button:hover {
    color: rgba(255,255,255,1);
}

.accessibility-block-title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

.accessibility-block-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
}

/* ===================================================================== */
/* ACCESSIBILITY SECTIONS */
/* ===================================================================== */

.accessibility-section {
    padding-top: 30px;
}

.accessibility-section.collapsed .accessibility-section-content {
    display: none !important;
}

.accessibility-title {
    width: 100%;
    padding: 0;
    margin-bottom: 10px;
    font-weight: bold;
    color: inherit;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.accessibility-title .btnicon {
    background-color: var(--accessibility-primary-color, #5838fc);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ===================================================================== */
/* ACCESSIBILITY BUTTONS & ITEMS */
/* ===================================================================== */

/* Profile Buttons */
.accessibility-profiles .accessibility-section-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.accessibility-profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background-color: #f0f0f0;
    border: 2px solid #f0f0f0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: inherit;
    text-align: left;
}

.accessibility-profile-btn i {
    font-size: 20px;
    min-width: 20px;
}

.accessibility-profile-btn:hover {
    border-color: var(--accessibility-primary-color, #5838fc);
    background-color: rgba(88, 56, 252, 0.05);
}

.accessibility-profile-btn[aria-checked="true"] {
    background-color: var(--accessibility-primary-color, #5838fc);
    border-color: var(--accessibility-primary-color, #5838fc);
    color: #fff;
}

/* Feature Buttons */
.accessibility-block i.fas,
.accessibility-block i.far,
.accessibility-block i.fab {
    font-family: 'Font Awesome 5 Free', 'Font Awesome 5 Brands', 'FontAwesome';
    font-weight: 900;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

button.accessibility-btn {
    width: 100%;
    border-radius: 5px;
    background-color: #f0f0f0;
    border: solid 2px #f0f0f0;
    line-height: 1;
    min-height: 63px;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 10px;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.accessibility-btn i {
    font-size: 20px;
    display: block;
}

button.accessibility-btn div {
    font-size: 13px;
    text-align: center;
    line-height: 1.2;
}

button.accessibility-btn:hover {
    border-color: var(--accessibility-primary-color, #5838fc);
}

button.accessibility-btn.active {
    background-color: var(--accessibility-primary-color, #5838fc);
    border-color: var(--accessibility-primary-color, #5838fc);
    color: #fff;
}

.accessibility-item {
    flex: 0 0 calc(50% - 5px);
    margin-bottom: 10px;
}

.accessibility-item.accessibility-item-group {
    flex: 0 0 100%;
    border: solid 2px #f0f0f0;
    border-radius: 5px;
    padding: 15px;
}

.accessibility-group-buttons {
    display: flex;
    gap: 8px;
}

.accessibility-group-buttons button {
    flex: 1;
    height: auto;
    min-height: 45px;
    padding: 8px 6px;
    font-size: 13px;
}

.accessibility-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: bold;
}

.accessibility-group-title i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* ===================================================================== */
/* READING MASK */
/* ===================================================================== */

.acsb_mask {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 10000;
    background-color: rgba(0,0,0,.28);
    pointer-events: none;
}

.acsb_masktop {
    top: 0;
}

.acsb_maskbottom {
    bottom: 0;
}

/* ===================================================================== */
/* READING GUIDE */
/* ===================================================================== */

.acsb_readinguide-el {
    position: fixed;
    left: 0;
    right: 0;
    height: 10px;
    background-color: #000;
    border-top: solid 2px #ffed00;
    border-bottom: solid 2px #ffed00;
    z-index: 10000;
    pointer-events: none;
}

/* ===================================================================== */
/* TEXT ADJUSTMENTS */
/* ===================================================================== */

/* Text Size */
.acsb_textsizenormal {
    font-size: calc(16px + 2px);
}

.acsb_textsizenormal #page {
    zoom: 1.05;
}

.acsb_textsizelarge {
    font-size: calc(16px + 4px);
}

.acsb_textsizelarge #page {
    zoom: 1.07;
}

.acsb_textsizebig {
    font-size: calc(16px + 6px);
}

.acsb_textsizebig #page {
    zoom: 1.09;
}

/* Text Spacing */
.acsb_textspacingnormal * {
    word-spacing: .28em !important;
    letter-spacing: .08em !important;
}

.acsb_textspacinglarge * {
    word-spacing: .38em !important;
    letter-spacing: .18em !important;
}

.acsb_textspacingbig * {
    word-spacing: 0.48em !important;
    letter-spacing: 0.28em !important;
}

/* Line Height */
.acsb_lineheightnormal {
    line-height: 2 !important;
}

.acsb_lineheightnormal * {
    line-height: 2 !important;
}

.acsb_lineheightlarge {
    line-height: 2.7 !important;
}

.acsb_lineheightlarge * {
    line-height: 2.7 !important;
}

.acsb_lineheightbig {
    line-height: 3.4 !important;
}

.acsb_lineheightbig * {
    line-height: 3.4 !important;
}

/* Readable Font */
.acsb_readablefont body,
.acsb_readablefont h1, .acsb_readablefont h2, .acsb_readablefont h3, 
.acsb_readablefont h4, .acsb_readablefont h5, .acsb_readablefont h6 {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Dyslexic Font */
.acsb_dyslexicfont body,
.acsb_dyslexicfont h1, .acsb_dyslexicfont h2, .acsb_dyslexicfont h3, 
.acsb_dyslexicfont h4, .acsb_dyslexicfont h5, .acsb_dyslexicfont h6 {
    font-family: 'OpenDyslexic', Arial, Helvetica, sans-serif !important;
}

/* ===================================================================== */
/* VISUAL FILTERS */
/* ===================================================================== */

/* High Contrast */
.acsb_highcontrast {
    filter: contrast(135%);
}

/* High Saturation */
.acsb_highsaturation {
    filter: saturate(200%);
}

/* Low Saturation */
.acsb_lowsaturation {
    filter: saturate(50%);
}

/* Monochrome */
.acsb_monochrome {
    filter: grayscale(100%);
}

/* Invert Colors */
.acsb_invertcolors {
    filter: invert(1);
}

/* Change Colors - Swap foreground and background */
.acsb_changecolors body,
.acsb_changecolors #page,
.acsb_changecolors .content-wrapper,
.acsb_changecolors main,
.acsb_changecolors header,
.acsb_changecolors footer,
.acsb_changecolors .card,
.acsb_changecolors .modal-content,
.acsb_changecolors .dropdown-menu,
.acsb_changecolors button:not(.accessibility-btn),
.acsb_changecolors .btn,
.acsb_changecolors input,
.acsb_changecolors textarea,
.acsb_changecolors select {
    filter: hue-rotate(180deg) invert(0.9);
}

/* ===================================================================== */
/* CONTRAST MODES */
/* ===================================================================== */

.acsb_contrast .acsb-contrast-el {
    background-color: var(--acsb-bg, #000) !important;
    color: var(--acsb-color, #fff) !important;
    fill: var(--acsb-color, #fff) !important;
    border-color: var(--acsb-bocolor, #fff) !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
    text-shadow: none !important;
}

.acsb_contrastdark {
    --acsb-bg: #000;
    --acsb-color: #fff;
    --acsb-bocolor: #fff;
}

.acsb_contrastlight {
    --acsb-bg: #fff;
    --acsb-color: #000;
    --acsb-bocolor: #000;
}

/* Icon filters for contrast mode */
.acsb_contrast svg image,
.acsb_contrast img.icon,
.acsb_contrast .icon img,
.acsb_contrast .activityicon,
.acsb_contrast .activity-icon img,
.acsb_contrast [class*="icon-"] img {
    filter: var(--acsb-filtercolor) !important;
}

/* ===================================================================== */
/* HIGHLIGHTING */
/* ===================================================================== */

/* Highlight Titles */
.acsb_highlighttitles h1,
.acsb_highlighttitles h2,
.acsb_highlighttitles h3,
.acsb_highlighttitles h4,
.acsb_highlighttitles h5,
.acsb_highlighttitles h6 {
    background-color: #f0ff42 !important;
    border-color: #f0ff42 !important;
    color: #000 !important;
    text-shadow: none !important;
    padding: 5px 10px;
}

/* Highlight Links */
.acsb_highlightlinks a:not(.accessibility-block a) {
    background-color: #f0ff42 !important;
    border-color: #f0ff42 !important;
    color: #000 !important;
    text-shadow: none !important;
    opacity: 1 !important;
    padding: 2px 5px;
}

/* Highlight Buttons */
.acsb_highlightbuttons button:not(.accessibility-trigger):not(.accessibility-block button),
.acsb_highlightbuttons [type="submit"],
.acsb_highlightbuttons [role="button"] {
    background-color: #f0ff42 !important;
    border-color: #f0ff42 !important;
    color: #000 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

/* ===================================================================== */
/* ANIMATIONS & IMAGES */
/* ===================================================================== */

/* Stop Animations */
.acsb_stopanimations * {
    transition: none !important;
    animation: none !important;
}

.acsb_stopanimations *:before,
.acsb_stopanimations *:after {
    transition: none !important;
    animation: none !important;
}

/* Hide Images */
.acsb_hideimages img {
    visibility: hidden !important;
}

.acsb_hideimages * {
    background-image: none !important;
}

.acsb_hideimages *:before,
.acsb_hideimages *:after {
    background-image: none !important;
}

/* ===================================================================== */
/* BIG CURSOR */
/* ===================================================================== */

/* Using system cursors with zoom effect - more reliable than custom cursor files */
/* Big Black Cursor */
.acsb_bigcursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="black" stroke="white" stroke-width="1.5" d="M4 4 L4 28 L12 20 L16 28 L20 26 L16 18 L24 18 Z"/></svg>') 0 0, auto !important;
}

.acsb_bigcursor a,
.acsb_bigcursor input,
.acsb_bigcursor label,
.acsb_bigcursor textarea,
.acsb_bigcursor select,
.acsb_bigcursor button,
.acsb_bigcursor [role="button"] {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="black" stroke="white" stroke-width="1.5" d="M16 4 L12 12 L4 16 L12 20 L16 28 L20 20 L28 16 L20 12 Z"/></svg>') 16 16, pointer !important;
}

/* Big White Cursor */
.acsb_bigwhitecursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="white" stroke="black" stroke-width="1.5" d="M4 4 L4 28 L12 20 L16 28 L20 26 L16 18 L24 18 Z"/></svg>') 0 0, auto !important;
}

.acsb_bigwhitecursor a,
.acsb_bigwhitecursor input,
.acsb_bigwhitecursor label,
.acsb_bigwhitecursor textarea,
.acsb_bigwhitecursor select,
.acsb_bigwhitecursor button,
.acsb_bigwhitecursor [role="button"] {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="white" stroke="black" stroke-width="1.5" d="M16 4 L12 12 L4 16 L12 20 L16 28 L20 20 L28 16 L20 12 Z"/></svg>') 16 16, pointer !important;
}

/* ===================================================================== */
/* TOOLTIPS */
/* ===================================================================== */

.acsb_tooltip-el {
    position: fixed;
    background-color: rgba(0,0,0,.89);
    color: #fff;
    border-radius: 6px;
    width: auto;
    max-width: 380px;
    opacity: 0;
    word-break: break-word;
    padding: .7rem 1rem;
    font-size: 1.85rem;
    z-index: 100001;
    font-weight: bold;
    line-height: 1.4;
    transition: opacity .1s ease-in-out;
    pointer-events: none;
}

/* ===================================================================== */
/* RESPONSIVE */
/* ===================================================================== */

@media only screen and (max-width: 768px) {
    .accessibility-block {
        margin-right: 10px;
        margin-bottom: 10px;
        max-width: calc(100% - 20px);
    }
    
    .accessibility-trigger {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .accessibility-trigger.position-bottom-left,
    .accessibility-trigger.position-bottom-right {
        bottom: 20px;
    }
    
    .accessibility-trigger.position-top-left,
    .accessibility-trigger.position-top-right {
        top: 20px;
    }
    
    .accessibility-trigger.position-bottom-left,
    .accessibility-trigger.position-top-left {
        left: 20px;
    }
    
    .accessibility-trigger.position-bottom-right,
    .accessibility-trigger.position-top-right {
        right: 20px;
    }
}

/* ===================================================================== */
/* RESET BUTTON */
/* ===================================================================== */

.accessibility-reset-btn {
    width: 100%;
    background-color: #dc3545;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
}

.accessibility-reset-btn:hover {
    background-color: #c82333;
}
