/**
 * PROFESSIONAL CORPORATE ACCESSIBILITY TOOL
 * Clean & Compact Design - Responsive & Accessible
 * Version: 6.0 - Production Ready
 */

/* ===== RESET & BASE ===== */
.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;
}

/* ===== FLOATING TOGGLE BUTTON ===== */
#a11y-toggle {
    position: fixed;
    top:80px;
    right: 10px;
    z-index: 999998;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c7a68 0%, #3eb489 100%);
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(62, 180, 137, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#a11y-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(62, 180, 137, 0.4);
}

/* ===== MAIN PANEL - COMPACT DESIGN ===== */
#a11y-panel {
    position: fixed;
    top: 50%;
    right: 8px;
    transform: translateY(-50%) translateX(450px);
    width: 340px;
    max-width: calc(100vw - 40px);
    max-height: 85vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    z-index: 999999;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#a11y-panel.open {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* ===== HEADER ===== */
.a11y-header {
    background: linear-gradient(135deg, #2c7a68 0%, #3eb489 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.a11y-title {
    font-weight: 600;
    font-size: 16px;
}

.a11y-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.a11y-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== SCROLLABLE CONTENT ===== */
.a11y-content {
    padding: 18px;
    overflow-y: auto;
    max-height: calc(85vh - 58px);
    scrollbar-width: thin;
}

.a11y-content::-webkit-scrollbar {
    width: 5px;
}

.a11y-content::-webkit-scrollbar-track {
    background: #e0ece6;
    border-radius: 10px;
}

.a11y-content::-webkit-scrollbar-thumb {
    background: #3eb489;
    border-radius: 10px;
}

/* ===== SECTIONS ===== */
.a11y-section {
    margin-bottom: 18px;
}

.a11y-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #3eb489;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* ===== PROFILE BUTTONS ===== */
.a11y-profiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.a11y-profile-btn {
    background: #f5faf8;
    border: 1.5px solid #e0ece6;
    border-radius: 10px;
    padding: 10px 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 600;
    color: #2c7a68;
    text-align: center;
}

.a11y-profile-btn:hover {
    border-color: #3eb489;
    background: #e6f9f2;
}

.a11y-profile-btn.active {
    background: linear-gradient(135deg, #2c7a68 0%, #3eb489 100%);
    color: white;
    border-color: #3eb489;
}

/* ===== CONTROL GROUPS ===== */
.a11y-control-group {
    margin-bottom: 12px;
}

.a11y-control-label {
    font-size: 10px;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

.a11y-control {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f5faf8;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1.5px solid #e0ece6;
}

.a11y-btn {
    width: 34px;
    height: 34px;
    border: 1.5px solid #3eb489;
    border-radius: 8px;
    background: white;
    color: #3eb489;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a11y-btn:hover {
    background: #3eb489;
    color: white;
}

.a11y-value {
    flex: 1;
    text-align: center;
    font-weight: 700;
    color: #2c7a68;
    font-size: 14px;
}

/* ===== FEATURE GRID ===== */
.a11y-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.a11y-feature {
    background: #f5faf8;
    border: 1.5px solid #e0ece6;
    border-radius: 10px;
    padding: 10px 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 10px;
    font-weight: 600;
    color: #2c7a68;
    text-align: center;
}

.a11y-feature:hover {
    border-color: #3eb489;
    background: #e6f9f2;
}

.a11y-feature.active {
    background: linear-gradient(135deg, #2c7a68 0%, #3eb489 100%);
    color: white;
    border-color: #3eb489;
}

.a11y-features-extra {
    margin-top: 8px;
}

/* ===== RESET BUTTON ===== */
.a11y-reset {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #ef4444;
    background: #fef2f2;
    color: #ef4444;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0px;
}

.a11y-reset:hover {
    background: #ef4444;
    color: white;
}

/* ===== SCREEN READER HIGHLIGHT ===== */
.a11y-sr-highlight {
    background-color: #ffeb3b !important;
    color: #000000 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    outline: 2px solid #ffeb3b !important;
}

/* ===== FONT SIZE SCALING ===== */
body.a11y-font-80 { font-size: 12.8px !important; }
body.a11y-font-90 { font-size: 14.4px !important; }
body.a11y-font-100 { font-size: 16px !important; }
body.a11y-font-110 { font-size: 17.6px !important; }
body.a11y-font-120 { font-size: 19.2px !important; }
body.a11y-font-130 { font-size: 20.8px !important; }
body.a11y-font-140 { font-size: 22.4px !important; }
body.a11y-font-150 { font-size: 24px !important; }
body.a11y-font-160 { font-size: 25.6px !important; }
body.a11y-font-170 { font-size: 27.2px !important; }
body.a11y-font-180 { font-size: 28.8px !important; }
body.a11y-font-190 { font-size: 30.4px !important; }
body.a11y-font-200 { font-size: 32px !important; }

/* ===== BIGGER TEXT ===== */
body.a11y-bigger-text p,
body.a11y-bigger-text li,
body.a11y-bigger-text span:not(.a11y-value):not(.a11y-title):not(.a11y-control-label),
body.a11y-bigger-text h1,
body.a11y-bigger-text h2,
body.a11y-bigger-text h3,
body.a11y-bigger-text h4,
body.a11y-bigger-text h5,
body.a11y-bigger-text h6,
body.a11y-bigger-text label,
body.a11y-bigger-text .a11y-section-title,
body.a11y-bigger-text .a11y-profile-btn,
body.a11y-bigger-text .a11y-feature,
body.a11y-bigger-text .a11y-reset,
body.a11y-bigger-text a:not(#a11y-toggle),
body.a11y-bigger-text button:not(#a11y-toggle):not(.a11y-btn):not(.a11y-close) {
    font-size: 1.15em !important;
}

/* Prevent buttons and interactive elements from breaking layout */
body.a11y-bigger-text .a11y-btn {
    width: 38px;
    height: 38px;
    font-size: 18px !important;
}

body.a11y-bigger-text .a11y-profile-btn,
body.a11y-bigger-text .a11y-feature {
    padding: 10px 6px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

/* Exclude layout containers and navigation elements from scaling */
body.a11y-bigger-text .a11y-panel,
body.a11y-bigger-text .a11y-header,
body.a11y-bigger-text .a11y-content,
body.a11y-bigger-text .a11y-control,
body.a11y-bigger-text .a11y-profiles,
body.a11y-bigger-text .a11y-features,
body.a11y-bigger-text .a11y-control-group,
body.a11y-bigger-text #a11y-panel,
body.a11y-bigger-text #a11y-toggle {
    font-size: inherit !important;
}

/* ===== LINE HEIGHT ===== */
body.a11y-line-height p,
body.a11y-line-height li,
body.a11y-line-height div:not(.a11y-control):not(.a11y-feature):not(.a11y-profile-btn) {
    line-height: 1.8 !important;
}

/* ===== TEXT ALIGN ===== */
body.a11y-text-align p,
body.a11y-text-align li,
body.a11y-text-align div:not(.a11y-control):not(.a11y-feature):not(.a11y-profile-btn) {
    text-align: left !important;
}

/* ===== TEXT SPACING ===== */
body.a11y-text-spacing p,
body.a11y-text-spacing li,
body.a11y-text-spacing span,
body.a11y-text-spacing div:not(.a11y-control):not(.a11y-feature):not(.a11y-profile-btn),
body.a11y-text-spacing h1,
body.a11y-text-spacing h2,
body.a11y-text-spacing h3,
body.a11y-text-spacing h4,
body.a11y-text-spacing h5,
body.a11y-text-spacing h6,
body.a11y-text-spacing a,
body.a11y-text-spacing label {
    letter-spacing: 0.1em !important;
    word-spacing: 0.15em !important;
}

/* ===== HIGH CONTRAST MODE ===== */
html.a11y-high-contrast,
html.a11y-high-contrast body {
    background: #000000 !important;
    color: #ffff00 !important;
}

html.a11y-high-contrast * {
    background: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

html.a11y-high-contrast a {
    color: #00ffff !important;
}

html.a11y-high-contrast button,
html.a11y-high-contrast .a11y-feature,
html.a11y-high-contrast .a11y-profile-btn {
    background: #ffff00 !important;
    color: #000000 !important;
}

/* ===== GRAYSCALE ===== */
html.a11y-grayscale {
    filter: grayscale(100%);
}

/* ===== SATURATION ===== */
html.a11y-saturation {
    filter: saturate(150%);
}

/* ===== HIGHLIGHT LINKS ===== */
html.a11y-highlight-links a {
    background: #ffeb3b !important;
    color: #000000 !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    text-decoration: underline !important;
}

/* ===== LARGE CURSOR ===== */
html.a11y-large-cursor,
html.a11y-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 0,28 8,20 14,26 18,22 12,16 20,16" fill="%232c7a68"/><polygon points="0,0 8,8 0,8" fill="%23ffffff"/></svg>') 0 0, auto !important;
}

/* ===== DYSLEXIA FRIENDLY FONT ===== */
html.a11y-dyslexia-font,
html.a11y-dyslexia-font * {
    font-family: 'Comic Sans MS', 'OpenDyslexic', 'Verdana', sans-serif !important;
    letter-spacing: 0.1em !important;
}

/* ===== READING GUIDE ===== */
#a11y-reading-guide-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(62, 180, 137, 0.12);
    pointer-events: none;
    z-index: 999996;
    border-top: 2px solid rgba(62, 180, 137, 0.5);
    border-bottom: 2px solid rgba(62, 180, 137, 0.5);
    transition: top 0.05s ease;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 640px) {
    #a11y-panel {
        top: auto;
        bottom: 80px;
        right: 15px;
        left: 15px;
        transform: translateY(20px) translateX(0);
        width: auto;
        max-width: none;
        max-height: 90vh;
    }
    
    #a11y-panel.open {
        transform: translateY(0) translateX(0);
    }
    
    .a11y-features {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .a11y-content {
        max-height: calc(80vh - 58px);
    }
}

@media (max-width: 480px) {
    #a11y-toggle {
        width: 48px;
        height: 48px;
        font-size: 24px;
        bottom: 15px;
        right: 15px;
    }
    
    .a11y-content {
        padding: 14px;
    }
    
    .a11y-profiles {
        gap: 8px;
    }
    
    .a11y-profile-btn {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .a11y-features {
        gap: 6px;
    }
    
    .a11y-feature {
        padding: 8px 3px;
        font-size: 9px;
    }
}

/* ===== FOCUS STYLES ===== */
.a11y-btn:focus,
.a11y-feature:focus,
.a11y-profile-btn:focus,
.a11y-reset:focus,
#a11y-toggle:focus {
    outline: 2px solid #3eb489;
    outline-offset: 2px;
}

/* ===== PRINT ===== */
@media print {
    #a11y-toggle,
    #a11y-panel,
    #a11y-reading-guide-line {
        display: none !important;
    }
}