/**
 * Apoio19 WCAG 2.2 Accessibility Plugin - Frontend Stylesheet
 */

/* Skip Link (WCAG 2.4.1 Bypass Blocks) */
.apoio19-skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: #c45a2b;
    color: #f5f0e8 !important;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 999999;
    text-decoration: none;
    transition: top 0.3s ease;
    font-family: 'Manrope', sans-serif;
}

.apoio19-skip-link:focus {
    top: 20px;
    outline: 3px solid #1a1a1a;
}

/* Keyboard Focus Enhancements (WCAG 2.4.13 Focus Appearance) */
body.apoio19-focus-active :focus-visible {
    outline: 3px solid #c45a2b !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(26, 26, 26, 0.8), 0 0 0 9px #c45a2b !important;
}

/* Target Size Minimums (WCAG 2.5.8) */
body.apoio19-target-size-active a:not(main p a):not(footer p a),
body.apoio19-target-size-active button,
body.apoio19-target-size-active input[type="button"],
body.apoio19-target-size-active input[type="submit"],
body.apoio19-target-size-active input[type="reset"],
body.apoio19-target-size-active input[type="checkbox"],
body.apoio19-target-size-active input[type="radio"],
body.apoio19-target-size-active select {
    min-width: 24px !important;
    min-height: 24px !important;
    box-sizing: border-box;
}

/* Floating Round Trigger Button */
.apoio19-wcag-floating-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #c45a2b;
    color: #f5f0e8;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(196, 90, 43, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.apoio19-wcag-floating-trigger .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.apoio19-wcag-floating-trigger:hover {
    background: #1a1a1a;
    box-shadow: 0 6px 20px rgba(26, 26, 26, 0.4);
    transform: scale(1.08);
}

.apoio19-wcag-floating-trigger:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 3px;
}

/* Elementor Widget Integration classes */
.apoio19-el-toggle-wrapper {
    width: 100%;
}
.apoio19-wcag-toggle-btn.el-wcag-toggle-btn {
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}
.apoio19-wcag-toggle-btn.el-wcag-toggle-btn.el-wcag-toggle-justify {
    width: 100%;
    justify-content: center;
}

/* Sidebar Accessibility Drawer */
.apoio19-wcag-sidebar {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100%;
    background: #fff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Manrope', sans-serif;
    color: #1a1a1a;
    box-sizing: border-box;
}

.apoio19-wcag-sidebar.open {
    right: 0;
}

.apoio19-wcag-sidebar-header {
    background: #1a1a1a;
    color: #f5f0e8;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #c45a2b;
}

.apoio19-wcag-sidebar-header h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.25rem;
    margin: 0;
    color: #f5f0e8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.apoio19-wcag-sidebar-header h2 .dashicons {
    color: #c45a2b;
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.apoio19-wcag-close-btn {
    background: transparent;
    border: none;
    color: #f5f0e8;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.apoio19-wcag-close-btn:hover {
    color: #c45a2b;
}

.apoio19-wcag-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Sidebar Sections */
.apoio19-wcag-section {
    border-bottom: 1px solid #e9e6e0;
    padding-bottom: 20px;
}

.apoio19-wcag-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 14px 0;
    color: #1a1a1a;
}

.apoio19-wcag-section p.section-desc {
    font-size: 0.8125rem;
    color: #666;
    line-height: 1.4;
    margin: -8px 0 14px 0;
}

/* Panel Buttons & Options */
.apoio19-wcag-btn-group {
    display: flex;
    gap: 8px;
}

.apoio19-widget-btn {
    flex: 1;
    background: #f5f0e8;
    border: 1px solid #d9d2c2;
    color: #1a1a1a;
    padding: 10px 14px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.apoio19-widget-btn:hover {
    background: #e6dfd1;
    border-color: #c45a2b;
}

.apoio19-widget-btn.active {
    background: #c45a2b;
    border-color: #c45a2b;
    color: #f5f0e8;
}

.apoio19-widget-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Colour Contrast Previews */
.apoio19-wcag-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.apoio19-wcag-btn-grid .apoio19-widget-btn {
    flex-direction: column;
    padding: 12px 8px;
    font-size: 0.8125rem;
    line-height: 1.2;
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-bottom: 6px;
    border: 1px solid #d9d2c2;
    display: block;
}

.color-preview.contrast-high { background: #000; border-color: #fff; }
.color-preview.contrast-yellow { background: #000; border-color: #ff0; }
.color-preview.contrast-greyscale { background: linear-gradient(135deg, #333, #ccc); }
.color-preview.contrast-normal { background: #fff; }

/* Toggles Options */
.apoio19-wcag-list-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apoio19-widget-btn-toggle {
    width: 100%;
    background: #f5f0e8;
    border: 1px solid #d9d2c2;
    color: #1a1a1a;
    padding: 12px 14px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: inherit;
}

.apoio19-widget-btn-toggle:hover {
    background: #e6dfd1;
    border-color: #c45a2b;
}

.toggle-indicator {
    width: 14px;
    height: 14px;
    border: 2px solid #ccd0d4;
    border-radius: 3px;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    background: #fff;
}

.apoio19-widget-btn-toggle.active {
    background: #fdfdfd;
    border-color: #c45a2b;
}

.apoio19-widget-btn-toggle.active .toggle-indicator {
    background: #c45a2b;
    border-color: #c45a2b;
}

.apoio19-widget-btn-toggle.active .toggle-indicator:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 4px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Help Widget Links */
.apoio19-help-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.apoio19-help-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f5f0e8;
    border: 1px solid #d9d2c2;
    border-radius: 4px;
    color: #1a1a1a !important;
    text-decoration: none !important;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.apoio19-help-links li a:hover {
    border-color: #c45a2b;
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.apoio19-help-links .dashicons {
    color: #c45a2b;
}

.apoio19-help-links strong {
    font-weight: 700;
}

/* Reset All Button */
.apoio19-wcag-section-reset {
    margin-top: auto;
    padding-top: 15px;
}

.apoio19-reset-all-btn {
    width: 100%;
    background: #fff;
    border: 1px dashed #c45a2b;
    color: #c45a2b;
    padding: 12px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.apoio19-reset-all-btn:hover {
    background: #fcf4f0;
    border-style: solid;
}

/* Backdrop Overlay */
.apoio19-wcag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.apoio19-wcag-overlay.show {
    display: block;
    opacity: 1;
}

/* Accessibility Modes (Overriding styles via Body Classes) */

/* Large Cursor */
body.large-cursor,
body.large-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><polygon points="0,0 24,12 14,14 12,24" fill="white" stroke="black" stroke-width="2"/></svg>'), auto !important;
}

/* Underline Links */
body.underline-links a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 4px !important;
}

/* Stop animations */
body.stop-animations,
body.stop-animations * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
}

/* OpenDyslexic or Readable Font Face & overrides */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/npm/opendyslexic@1.0.3/OpenDyslexic-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}
body.dyslexia-font,
body.dyslexia-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
}

/* Contrast themes overrides (excluding the sidebar drawer so they remain accessible) */
html.contrast-high,
body.contrast-high {
    background-color: #000000 !important;
    background: #000000 !important;
    color: #ffffff !important;
}

body.contrast-high *:not(.apoio19-wcag-sidebar):not(.apoio19-wcag-sidebar *):not([vw]):not([vw] *) {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
body.contrast-high a:not(.apoio19-wcag-sidebar *):not([vw] *),
body.contrast-high a:not(.apoio19-wcag-sidebar *):not([vw] *) * {
    color: #00ffff !important;
    text-decoration: underline !important;
}
body.contrast-high button:not(.apoio19-wcag-sidebar *):not([vw] *),
body.contrast-high input[type="submit"]:not(.apoio19-wcag-sidebar *):not([vw] *),
body.contrast-high input[type="button"]:not(.apoio19-wcag-sidebar *):not([vw] *) {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

html.contrast-yellow,
body.contrast-yellow {
    background-color: #000000 !important;
    background: #000000 !important;
    color: #ffff00 !important;
}

body.contrast-yellow *:not(.apoio19-wcag-sidebar):not(.apoio19-wcag-sidebar *):not([vw]):not([vw] *) {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
body.contrast-yellow a:not(.apoio19-wcag-sidebar *):not([vw] *),
body.contrast-yellow a:not(.apoio19-wcag-sidebar *):not([vw] *) * {
    color: #ffff00 !important;
    text-decoration: underline !important;
}
body.contrast-yellow button:not(.apoio19-wcag-sidebar *):not([vw] *),
body.contrast-yellow input[type="submit"]:not(.apoio19-wcag-sidebar *):not([vw] *),
body.contrast-yellow input[type="button"]:not(.apoio19-wcag-sidebar *):not([vw] *) {
    background: #000 !important;
    color: #ff0 !important;
    border: 2px solid #ff0 !important;
}

body.contrast-greyscale {
    filter: grayscale(1) !important;
}

/* Small targets warning wrapper style */
.wcag-small-target {
    position: relative;
}
body.apoio19-target-size-active .wcag-small-target {
    outline: 2px dashed #c45a2b !important;
    outline-offset: 1px !important;
}

/* Auslan Video Modal */
.apoio19-auslan-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(4px);
    z-index: 2000000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 20px;
}

.apoio19-auslan-modal-content {
    background: #1a1a1a;
    border: 2px solid #c45a2b;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    position: relative;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.apoio19-auslan-modal-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 5px;
    line-height: 1;
}

.apoio19-auslan-modal-close:hover {
    color: #c45a2b;
}

.apoio19-auslan-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 4px;
    background: #000;
}

.apoio19-auslan-video-container iframe,
.apoio19-auslan-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

/* Adjust close button layout on mobile screens */
@media (max-width: 600px) {
    .apoio19-auslan-modal-content {
        padding: 5px;
        margin-top: 30px;
    }
    .apoio19-auslan-modal-close {
        top: -40px;
        right: 5px;
        font-size: 28px;
    }
}
