/* ========================================================
   WCAG WIDGET UI STYLING
   ======================================================== */
.wcag-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Floating Action Button */
.wcag-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #9333ea);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    font-size: 28px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wcag-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

/* Panel */
.wcag-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    transform-origin: bottom right;
    visibility: visible;
}
.wcag-panel.hidden {
    opacity: 0;
    transform: scale(0.9);
    visibility: hidden;
    pointer-events: none;
}

.wcag-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wcag-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #212529;
}

.wcag-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
    padding: 0;
}
.wcag-close-btn:hover {
    color: #dc3545;
}

.wcag-body {
    padding: 20px;
    max-height: 450px;
    overflow-y: auto;
}

.wcag-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.wcag-option-col {
    flex-direction: column;
    align-items: flex-start;
}
.wcag-option label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

/* Text Size Controls */
.wcag-text-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}
.wcag-size-btn {
    padding: 8px;
    border: 1px solid #ced4da;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    font-weight: 500;
    color: #495057;
}
.wcag-size-btn:hover {
    background: #e9ecef;
}
.wcag-size-btn.active {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

/* Toggle Switch */
.wcag-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    margin-bottom: 0 !important;
}
.wcag-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.wcag-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #adb5bd;
    transition: .3s;
    border-radius: 24px;
}
.wcag-slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.wcag-toggle input:checked + .wcag-slider {
    background-color: #4f46e5;
}
.wcag-toggle input:checked + .wcag-slider:before {
    transform: translateX(22px);
}

/* Reset Button */
.wcag-reset-btn {
    width: 100%;
    padding: 10px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
    transition: background 0.2s;
}
.wcag-reset-btn:hover {
    background: #f5c6cb;
}

/* TTS Indicator */
.wcag-tts-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.wcag-tts-indicator.hidden {
    opacity: 0;
    transform: translate(-50%, -20px);
    pointer-events: none;
}


/* ========================================================
   GLOBAL ACCESSIBILITY CLASSES APPLIED TO HTML
   ======================================================== */

/* 1. Ukuran Teks (Zoom) */
html.font-size-md { font-size: 110% !important; }
html.font-size-lg { font-size: 125% !important; }
html.font-size-xl { font-size: 140% !important; }

/* 2. Kontras Tinggi */
html.high-contrast, 
html.high-contrast body, 
html.high-contrast div:not(.wcag-widget):not(.wcag-widget *), 
html.high-contrast p, 
html.high-contrast span, 
html.high-contrast a, 
html.high-contrast h1, 
html.high-contrast h2, 
html.high-contrast h3, 
html.high-contrast h4, 
html.high-contrast h5, 
html.high-contrast h6, 
html.high-contrast button:not(.wcag-widget *), 
html.high-contrast input {
    background-color: #000000 !important;
    color: #FFFF00 !important;
    border-color: #FFFF00 !important;
}

/* 3. Ramah Disleksia */
html.dyslexia-font, 
html.dyslexia-font body, 
html.dyslexia-font p,
html.dyslexia-font span,
html.dyslexia-font div:not(.wcag-widget),
html.dyslexia-font h1, html.dyslexia-font h2, html.dyslexia-font h3,
html.dyslexia-font h4, html.dyslexia-font h5, html.dyslexia-font h6,
html.dyslexia-font a, html.dyslexia-font li {
    font-family: 'Comic Sans MS', 'OpenDyslexic', 'Arial', sans-serif !important;
    letter-spacing: 0.15em !important;
    word-spacing: 0.35em !important;
    line-height: 1.8 !important;
}

/* 4. Garis Bawah Tautan */
html.link-underline a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px !important;
}

/* 5. TTS Cursor Mode */
html.tts-active, html.tts-active * {
    cursor: cell !important;
}
