/* ============================================================
   AKSESIBILITAS WEBSITE - PPID Kota Bogor
   Toolbar posisi: kanan layar (fixed right)
   ============================================================ */

/* ---- Skip to Main Content ---- */
.skip-to-main {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #05326a;
    color: #ffffff !important;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-size: 1rem;
    font-weight: 700;
    z-index: 999999;
    text-decoration: none;
    transition: top 0.3s ease;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.skip-to-main:focus {
    top: 0;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}

/* ---- Accessibility Toggle Button ---- */
#accessibility-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: #05326a;
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: -3px 0 12px rgba(0,0,0,0.25);
    transition: background 0.3s, width 0.3s;
    outline: none;
}
#accessibility-toggle:hover,
#accessibility-toggle:focus {
    background: #15ace1;
    width: 52px;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}
#accessibility-toggle .acc-toggle-label {
    display: none;
}

/* ---- Accessibility Panel ---- */
#accessibility-panel {
    position: fixed;
    right: -340px;
    top: 0;
    width: 320px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    z-index: 99997;
    overflow-y: auto;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid #05326a;
    display: flex;
    flex-direction: column;
}
#accessibility-panel.open {
    right: 0;
}

/* Panel Header */
.acc-panel-header {
    background: #05326a;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.acc-panel-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.acc-panel-close {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.5);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.acc-panel-close:hover,
.acc-panel-close:focus {
    background: rgba(255,255,255,0.2);
    border-color: #fff;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}

/* Panel Body */
.acc-panel-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

/* Section Title */
.acc-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #05326a;
    margin: 16px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 2px solid #e8eef5;
    display: flex;
    align-items: center;
    gap: 6px;
}
.acc-section-title:first-child {
    margin-top: 0;
}

/* ---- Font Size Controls ---- */
.acc-font-size-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.acc-font-btn {
    flex: 1;
    padding: 8px 4px;
    border: 2px solid #dde3ec;
    background: #f4f7fe;
    color: #05326a;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.85rem;
}
.acc-font-btn:hover,
.acc-font-btn:focus {
    background: #05326a;
    color: #fff;
    border-color: #05326a;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}
.acc-font-btn.active {
    background: #05326a;
    color: #fff;
    border-color: #05326a;
}
.acc-font-btn[data-action="font-decrease"] { font-size: 0.78rem; }
.acc-font-btn[data-action="font-reset"]    { font-size: 0.9rem; }
.acc-font-btn[data-action="font-increase"] { font-size: 1.05rem; }

/* ---- Toggle Buttons (switch style) ---- */
.acc-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #f4f7fe;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
}
.acc-toggle-item:hover,
.acc-toggle-item:focus-within {
    border-color: #05326a;
    background: #e8eef5;
}
.acc-toggle-item.active {
    background: #e8f4fd;
    border-color: #15ace1;
}
.acc-toggle-item-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    flex: 1;
}
.acc-toggle-item-label i {
    width: 20px;
    text-align: center;
    color: #05326a;
    font-size: 0.9rem;
}
.acc-toggle-item.active .acc-toggle-item-label i {
    color: #15ace1;
}

/* Switch */
.acc-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.acc-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.acc-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 22px;
    transition: 0.3s;
}
.acc-switch-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.acc-switch input:checked + .acc-switch-slider {
    background: #15ace1;
}
.acc-switch input:checked + .acc-switch-slider::before {
    transform: translateX(18px);
}
.acc-switch input:focus + .acc-switch-slider {
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}

/* ---- Color Blindness Buttons ---- */
.acc-colorblind-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 4px;
}
.acc-colorblind-btn {
    padding: 8px 6px;
    border: 2px solid #dde3ec;
    background: #f4f7fe;
    color: #333;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.acc-colorblind-btn .cb-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: block;
}
.acc-colorblind-btn:hover,
.acc-colorblind-btn:focus {
    border-color: #05326a;
    background: #e8eef5;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}
.acc-colorblind-btn.active {
    background: #05326a;
    color: #fff;
    border-color: #05326a;
}
.acc-colorblind-btn.active .cb-dot {
    border: 2px solid rgba(255,255,255,0.5);
}
/* Dot colors */
.cb-dot-protanopia   { background: linear-gradient(135deg, #4a90d9, #b8d4f0); }
.cb-dot-deuteranopia { background: linear-gradient(135deg, #e8a838, #f5d78e); }
.cb-dot-tritanopia   { background: linear-gradient(135deg, #e84040, #f5a0a0); }
.cb-dot-normal       { background: linear-gradient(135deg, #05326a, #15ace1); }

/* ---- TTS Button ---- */
.acc-tts-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.acc-tts-btn {
    width: 100%;
    padding: 9px 12px;
    border: 2px solid #dde3ec;
    background: #f4f7fe;
    color: #05326a;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.acc-tts-btn:hover,
.acc-tts-btn:focus {
    background: #05326a;
    color: #fff;
    border-color: #05326a;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}
.acc-tts-btn.active {
    background: #15ace1;
    color: #fff;
    border-color: #15ace1;
}
.acc-tts-status {
    font-size: 0.72rem;
    color: #666;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    min-height: 24px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.acc-tts-status.speaking {
    background: #e8f4fd;
    color: #05326a;
}

/* ---- Screen Reader Info ---- */
.acc-sr-info {
    background: #e8f4fd;
    border: 1px solid #b8d4f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.75rem;
    color: #05326a;
    margin-bottom: 6px;
}
.acc-sr-info ul {
    margin: 6px 0 0 0;
    padding-left: 16px;
}
.acc-sr-info ul li {
    margin-bottom: 3px;
}

/* ---- Reset Button ---- */
.acc-reset-btn {
    width: 100%;
    padding: 10px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.acc-reset-btn:hover,
.acc-reset-btn:focus {
    background: #b02a37;
    outline: 3px solid #ffdd00;
    outline-offset: 2px;
}

/* Panel Footer */
.acc-panel-footer {
    padding: 12px 16px;
    border-top: 1px solid #e8eef5;
    flex-shrink: 0;
}

/* ---- Overlay when panel is open (mobile) ---- */
#accessibility-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99996;
}
#accessibility-overlay.show {
    display: block;
}

/* ============================================================
   ACCESSIBILITY MODES — Applied to <html> or <body>
   ============================================================ */

/* ---- Font Size ---- */
html.acc-font-large  { font-size: 118% !important; }
html.acc-font-xlarge { font-size: 136% !important; }
html.acc-font-small  { font-size: 88% !important; }

/* ---- High Contrast ---- */
html.acc-high-contrast,
html.acc-high-contrast body {
    background: #000000 !important;
    color: #ffffff !important;
}
html.acc-high-contrast *:not(script):not(style):not(svg):not(path) {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    text-shadow: none !important;
    box-shadow: none !important;
}
html.acc-high-contrast a,
html.acc-high-contrast a * {
    color: #ffff00 !important;
    text-decoration: underline !important;
}
html.acc-high-contrast img {
    filter: contrast(1.2) brightness(0.9) !important;
}
html.acc-high-contrast .navbar,
html.acc-high-contrast .navbar-transparent,
html.acc-high-contrast .container-fluid.sticky-top {
    background: #000 !important;
    border-bottom: 2px solid #fff !important;
}
html.acc-high-contrast .btn {
    border: 2px solid #fff !important;
}

/* ---- Grayscale ---- */
html.acc-grayscale {
    filter: grayscale(100%) !important;
}

/* ---- Negative Contrast ---- */
html.acc-negative-contrast {
    filter: invert(100%) hue-rotate(180deg) !important;
}
html.acc-negative-contrast img,
html.acc-negative-contrast video {
    filter: invert(100%) hue-rotate(180deg) !important;
}

/* ---- Highlight Links ---- */
html.acc-highlight-links a {
    background: #ffff00 !important;
    color: #000000 !important;
    text-decoration: underline !important;
    outline: 2px solid #ff6600 !important;
    padding: 0 2px !important;
    border-radius: 2px !important;
}

/* ---- Readable Font (Dyslexia-friendly) ---- */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('../lib/fonts/OpenDyslexic-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}
html.acc-readable-font,
html.acc-readable-font body,
html.acc-readable-font p,
html.acc-readable-font h1,
html.acc-readable-font h2,
html.acc-readable-font h3,
html.acc-readable-font h4,
html.acc-readable-font h5,
html.acc-readable-font h6,
html.acc-readable-font span,
html.acc-readable-font a,
html.acc-readable-font li,
html.acc-readable-font td,
html.acc-readable-font th,
html.acc-readable-font label,
html.acc-readable-font input,
html.acc-readable-font button,
html.acc-readable-font textarea {
    font-family: 'Arial', 'Helvetica', sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.15em !important;
    line-height: 1.8 !important;
}

/* ---- Color Blindness Filters ---- */
/* Protanopia (red-blind): shift red toward yellow */
html.acc-colorblind-protanopia {
    filter: url('#protanopia-filter') !important;
}
/* Deuteranopia (green-blind): shift green toward yellow */
html.acc-colorblind-deuteranopia {
    filter: url('#deuteranopia-filter') !important;
}
/* Tritanopia (blue-blind): shift blue toward green */
html.acc-colorblind-tritanopia {
    filter: url('#tritanopia-filter') !important;
}

/* ---- Screen Reader Mode ---- */
html.acc-screen-reader *:focus {
    outline: 4px solid #ffdd00 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(255, 221, 0, 0.4) !important;
}
html.acc-screen-reader a:focus,
html.acc-screen-reader button:focus,
html.acc-screen-reader input:focus,
html.acc-screen-reader select:focus,
html.acc-screen-reader textarea:focus,
html.acc-screen-reader [tabindex]:focus {
    outline: 4px solid #ffdd00 !important;
    outline-offset: 3px !important;
    background: rgba(255, 221, 0, 0.15) !important;
}
html.acc-screen-reader .skip-to-main {
    /* Always visible in screen reader mode */
    position: fixed;
    top: 0 !important;
    z-index: 999999;
}

/* ---- TTS Highlight ---- */
.acc-tts-highlight {
    background: #ffff99 !important;
    color: #000 !important;
    border-radius: 2px;
    outline: 2px solid #ff9900;
}

/* ---- ARIA Live Region ---- */
#acc-live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---- SVG Filters (hidden) ---- */
#acc-svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---- KBD Styling ---- */
.acc-sr-info kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 0.7rem;
    font-family: monospace;
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    color: #333;
    white-space: nowrap;
}

/* ---- Scrollbar styling for panel ---- */
#accessibility-panel::-webkit-scrollbar,
.acc-panel-body::-webkit-scrollbar {
    width: 5px;
}
#accessibility-panel::-webkit-scrollbar-track,
.acc-panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}
#accessibility-panel::-webkit-scrollbar-thumb,
.acc-panel-body::-webkit-scrollbar-thumb {
    background: #05326a;
    border-radius: 4px;
}

/* ---- Responsive ---- */
@media (max-width: 576px) {
    #accessibility-panel {
        width: 100vw;
        right: -100vw;
    }
    #accessibility-panel.open {
        right: 0;
    }
    #accessibility-toggle {
        top: auto;
        bottom: 100px;
        transform: none;
        border-radius: 8px 0 0 8px;
    }
}
