/* =============================================================
   ACCESSIBILITY.CSS — Modul Aksesibilitas
   Kantor Imigrasi Kelas I Non-TPI Jakarta Pusat
   ============================================================= */

/* ── Skip Link ─────────────────────────────────────────────── */
.acc-skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #FFD000;
    color: #000;
    font-weight: bold;
    font-size: 1em;
    padding: 10px 20px;
    z-index: 999999;
    border-radius: 0 0 6px 0;
    text-decoration: none;
    transition: top 0.2s;
}
.acc-skip-link:focus {
    top: 0;
}

/* ── Toolbar Toggle Button ─────────────────────────────────── */
#acc-toggle-btn {
    position: fixed;
    left: 18px;
    bottom: 18px;
    transform: scale(1);
    background: linear-gradient(135deg, #11375c, #1a5490);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 58px;
    height: 58px;
    padding: 0;
    cursor: pointer;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 0.62em;
    font-weight: bold;
    box-shadow: 0 4px 16px rgba(17,55,92,0.45);
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.2s ease;
}
#acc-toggle-btn:hover,
#acc-toggle-btn:focus {
    background: linear-gradient(135deg, #1a5490, #2470b8);
    outline: 3px solid #FFD000;
    transform: scale(1.07);
}
#acc-toggle-btn .acc-icon {
    font-size: 5em;
    line-height: 1;
}
#acc-toggle-btn.acc-hidden {
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
}
.acc-active-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #2ecc71;
    border: 2px solid #fff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.acc-active-badge i {
    font-size: 10px;
    color: #fff;
    line-height: 1;
}
#acc-toggle-btn.acc-has-active .acc-active-badge {
    display: flex;
}

/* ── Toolbar Panel ─────────────────────────────────────────── */
#acc-panel {
    position: fixed;
    left: 18px;
    bottom: 18px;
    width: 340px;
    max-height: min(640px, calc(100vh - 36px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    z-index: 99998;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.92) translateY(12px);
    opacity: 0;
    visibility: hidden;
    transform-origin: bottom left;
    transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
}
#acc-panel-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 0 0 18px 18px;
}
#acc-panel.acc-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}
#acc-panel.acc-dragging {
    transition: none;
    box-shadow: 0 18px 48px rgba(0,0,0,0.35);
    user-select: none;
}
#acc-panel.acc-panel-zoom {
    width: 420px;
    font-size: 17px;
}
@media (max-width: 480px) {
    #acc-panel.acc-panel-zoom { width: auto; }
}

/* ── Panel Header ──────────────────────────────────────────── */
.acc-panel-header {
    background: linear-gradient(135deg, #11375c, #1a5490);
    color: #fff;
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 auto;
    border-radius: 18px 18px 0 0;
    cursor: grab;
    touch-action: none;
}
.acc-panel-header:active {
    cursor: grabbing;
}
.acc-panel-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.acc-panel-header .acc-drag-handle {
    color: rgba(255,255,255,0.5);
    font-size: 1em;
    line-height: 1;
    flex-shrink: 0;
}
.acc-panel-header h3 {
    margin: 0;
    flex: 1;
    font-size: 0.85em;
    font-weight: bold;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #fff;
}
#acc-lang-select {
    flex: 1;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 0.78em;
    cursor: pointer;
}
#acc-lang-select option {
    color: #333;
    background: #fff;
}
#acc-close-btn {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 1em;
    width: 26px;
    height: 26px;
    cursor: pointer;
    border-radius: 50%;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#acc-close-btn:hover { background: rgba(255,255,255,0.25); }

/* ── Section ───────────────────────────────────────────────── */
.acc-section {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
}
.acc-section-title {
    font-size: 0.72em;
    font-weight: bold;
    color: #11375c;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.acc-section-title i {
    font-size: 1.1em;
    color: #1a5490;
}
.acc-field-label {
    font-size: 0.82em;
    color: #555;
    margin-bottom: 6px;
    display: block;
}

/* ── Profil Cepat ──────────────────────────────────────────── */
.acc-profiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.acc-profile-btn {
    background: #f5f7fa;
    border: 2px solid #e0e5ec;
    border-radius: 12px;
    padding: 10px 4px;
    cursor: pointer;
    text-align: center;
    font-size: 0.75em;
    color: #333;
    transition: all 0.2s;
    line-height: 1.3;
}
.acc-profile-btn .acc-profile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0 auto 5px;
    border-radius: 50%;
    background: #e8f0fb;
    font-size: 1.05em;
    color: #11375c;
    transition: background 0.2s, color 0.2s;
}
.acc-profile-btn.active .acc-profile-icon {
    background: rgba(255,255,255,0.18);
    color: #fff;
}
.acc-profile-btn:hover,
.acc-profile-btn:focus {
    border-color: #11375c;
    background: #e8f0fb;
    outline: none;
}
.acc-profile-btn.active {
    border-color: #11375c;
    background: #11375c;
    color: #fff;
    box-shadow: 0 4px 10px rgba(17,55,92,0.3);
}

/* ── Font Size Control ─────────────────────────────────────── */
.acc-font-btns {
    display: flex;
    gap: 6px;
    align-items: center;
}
.acc-font-btns button {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    padding: 4px 10px;
    font-weight: bold;
    transition: background 0.2s;
}
.acc-font-btns button:hover { background: #11375c; color: #fff; }
.acc-font-btns .acc-font-normal  { font-size: 0.85em; }
.acc-font-btns .acc-font-large   { font-size: 1.1em; }
.acc-font-btns .acc-font-xlarge  { font-size: 1.4em; }
.acc-font-btns .acc-font-xxlarge { font-size: 1.7em; padding: 2px 8px; }
.acc-font-btns .active { background: #11375c; color: #fff; border-color: #11375c; }

/* ── Line Height Slider ────────────────────────────────────── */
.acc-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.acc-slider-row label {
    font-size: 0.82em;
    color: #555;
    min-width: 90px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.acc-speed-icon {
    font-size: 0.85em;
    color: #888;
}
.acc-slider-row input[type=range] {
    flex: 1;
    accent-color: #11375c;
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.acc-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 7px 0;
}
.acc-toggle-row label {
    font-size: 0.85em;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.acc-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.acc-switch input { opacity: 0; width: 0; height: 0; }
.acc-switch-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}
.acc-switch-slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.acc-switch input:checked + .acc-switch-slider { background: #11375c; }
.acc-switch input:checked + .acc-switch-slider:before { transform: translateX(18px); }
.acc-switch input:focus + .acc-switch-slider { outline: 2px solid #FFD000; }

/* ── Color Mode Buttons ────────────────────────────────────── */
.acc-color-btns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}
.acc-color-btn {
    border: 2px solid #e0e5ec;
    border-radius: 12px;
    padding: 10px 4px;
    cursor: pointer;
    text-align: center;
    font-size: 0.75em;
    font-weight: bold;
    line-height: 1.3;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.acc-color-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0 auto 5px;
    border-radius: 50%;
    font-size: 1.05em;
    transition: background 0.2s, color 0.2s;
}
.acc-color-btn i { font-size: 1em; }
.acc-color-btn:hover  { border-color: #11375c; }
.acc-color-btn.btn-dark   { background: #111; color: #fff; }
.acc-color-btn.btn-dark   .acc-color-icon { background: rgba(255,255,255,0.12); color: #fff; }
.acc-color-btn.btn-light  { background: #fffde7; color: #333; }
.acc-color-btn.btn-light  .acc-color-icon { background: rgba(0,0,0,0.06); color: #333; }
.acc-color-btn.btn-high   { background: #000; color: #ff0; border-color: #ff0; }
.acc-color-btn.btn-high   .acc-color-icon { background: rgba(255,255,0,0.15); color: #ff0; }
.acc-color-btn.btn-mono   { background: #888; color: #fff; }
.acc-color-btn.btn-mono   .acc-color-icon { background: rgba(255,255,255,0.15); color: #fff; }
.acc-color-btn.active { border-color: #FFD000; box-shadow: 0 0 0 2px #FFD000; }

/* ── TTS Controls ──────────────────────────────────────────── */
.acc-tts-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.acc-tts-btn {
    flex: 1;
    padding: 7px 4px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.acc-tts-btn:hover    { background: #11375c; color: #fff; border-color: #11375c; }
.acc-tts-btn.active   { background: #11375c; color: #fff; border-color: #11375c; }
.acc-tts-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.acc-tts-btn-wide {
    width: 100%;
    margin-top: 6px;
}
.acc-hint-text {
    font-size: 0.75em;
    color: #767676;
    margin: 5px 0 0;
    line-height: 1.4;
}
.acc-tts-progress {
    width: 100%;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}
.acc-tts-progress-bar {
    height: 100%;
    background: #11375c;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}
#acc-tts-lang {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.82em;
    margin-top: 6px;
    color: #333;
}

/* ── Skip Buttons ──────────────────────────────────────────── */
.acc-skip-btns {
    display: flex;
    gap: 6px;
}
.acc-skip-btns a {
    flex: 1;
    padding: 6px 4px;
    background: #f0f4f8;
    border: 1px solid #d0d9e3;
    border-radius: 5px;
    text-align: center;
    font-size: 0.78em;
    color: #11375c !important;
    text-decoration: none !important;
    font-weight: bold;
    transition: all 0.2s;
}
.acc-skip-btns a:hover {
    background: #11375c;
    color: #fff !important;
    border-color: #11375c;
}

/* ── Reset Button ──────────────────────────────────────────── */
.acc-reset-fixed {
    flex: 0 0 auto;
    background: #fff;
    box-shadow: 0 4px 8px -4px rgba(0,0,0,0.12);
}
.acc-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
}
#acc-reset-btn,
#acc-zoom-btn {
    width: 100%;
    padding: 10px 6px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78em;
    font-weight: bold;
    color: #555;
    transition: all 0.2s;
    line-height: 1.3;
}
#acc-reset-btn:hover { background: #e74c3c; color: #fff; border-color: #e74c3c; }
#acc-zoom-btn:hover { background: #11375c; color: #fff; border-color: #11375c; }
#acc-zoom-btn.active { background: #11375c; color: #fff; border-color: #11375c; }

/* ── Reading Line ──────────────────────────────────────────── */
#acc-reading-line {
    display: none;
    position: fixed;
    width: 100%;
    height: 3px;
    background: #e74c3c;
    pointer-events: none;
    z-index: 99990;
    top: 0;
    left: 0;
}
#acc-reading-mask-top,
#acc-reading-mask-bottom {
    display: none;
    position: fixed;
    width: 100%;
    background: rgba(0,0,0,0.45);
    pointer-events: none;
    z-index: 99989;
    left: 0;
}

/* ── TTS Word Highlight ────────────────────────────────────── */
.acc-tts-highlight {
    background: #FFD000 !important;
    color: #000 !important;
    border-radius: 2px;
}

/* =============================================================
   BODY STATE CLASSES
   ============================================================= */

/* ── Font Size ─────────────────────────────────────────────── */
body.acc-font-1 { font-size: 17px !important; }
body.acc-font-2 { font-size: 19px !important; }
body.acc-font-3 { font-size: 21px !important; }
body.acc-font-1 p, body.acc-font-1 li, body.acc-font-1 td,
body.acc-font-1 span, body.acc-font-1 a { font-size: 1em !important; }
body.acc-font-2 p, body.acc-font-2 li, body.acc-font-2 td,
body.acc-font-2 span, body.acc-font-2 a { font-size: 1em !important; }
body.acc-font-3 p, body.acc-font-3 li, body.acc-font-3 td,
body.acc-font-3 span, body.acc-font-3 a { font-size: 1em !important; }

/* Panel & toggle button tetap pada skala fontnya sendiri, tidak ikut membesar */
body.acc-font-1 #acc-panel, body.acc-font-2 #acc-panel, body.acc-font-3 #acc-panel,
body.acc-font-1 #acc-toggle-btn, body.acc-font-2 #acc-toggle-btn, body.acc-font-3 #acc-toggle-btn {
    font-size: 14px !important;
}
body.acc-font-1 #acc-panel span, body.acc-font-2 #acc-panel span, body.acc-font-3 #acc-panel span,
body.acc-font-1 #acc-panel p,    body.acc-font-2 #acc-panel p,    body.acc-font-3 #acc-panel p,
body.acc-font-1 #acc-panel a,    body.acc-font-2 #acc-panel a,    body.acc-font-3 #acc-panel a,
body.acc-font-1 #acc-panel li,   body.acc-font-2 #acc-panel li,   body.acc-font-3 #acc-panel li,
body.acc-font-1 #acc-panel td,   body.acc-font-2 #acc-panel td,   body.acc-font-3 #acc-panel td {
    font-size: unset !important;
}

/* ── Line Height ───────────────────────────────────────────── */
body.acc-line-height-1 *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *) { line-height: 1.8 !important; }
body.acc-line-height-2 *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *) { line-height: 2.2 !important; }

/* ── Highlight Links ───────────────────────────────────────── */
body.acc-highlight-links a {
    text-decoration: underline !important;
    background: #fff9c4 !important;
    color: #000 !important;
    padding: 1px 3px;
    border-radius: 2px;
}

/* ── Readable Font ─────────────────────────────────────────── */
body.acc-readable-font,
body.acc-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.03em !important;
}

/* ── Dyslexic Font ─────────────────────────────────────────── */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/open-dyslexic-regular.otf') format('opentype');
    font-display: swap;
}
body.acc-dyslexic-font,
body.acc-dyslexic-font * {
    font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

/* ── Big Cursor ────────────────────────────────────────────── */
body.acc-big-cursor,
body.acc-big-cursor *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *) {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4 L8 40 L18 30 L26 46 L32 43 L24 27 L38 27 Z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

/* ── Stop Animation ────────────────────────────────────────── */
body.acc-stop-animation *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *),
body.acc-stop-animation *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *)::before,
body.acc-stop-animation *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *)::after {
    animation: none !important;
    transition: none !important;
}

/* ── Hide Images ───────────────────────────────────────────── */
body.acc-hide-images img,
body.acc-hide-images figure,
body.acc-hide-images .slide-container,
body.acc-hide-images [style*="background-image"] {
    visibility: hidden !important;
}

/* ── Color Modes ───────────────────────────────────────────── */
body.acc-color-dark {
    background: #121212 !important;
    color: #e0e0e0 !important;
}
body.acc-color-dark *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *) {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
    border-color: #444 !important;
}
body.acc-color-dark a { color: #90caf9 !important; }

body.acc-color-light {
    background: #fffde7 !important;
}
body.acc-color-light *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *) {
    background-color: #fffde7 !important;
    color: #212121 !important;
}

body.acc-color-high {
    background: #000 !important;
    color: #fff !important;
}
body.acc-color-high *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *) {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
body.acc-color-high a  { color: #FFD000 !important; }
body.acc-color-high img { filter: invert(1) contrast(1.2) !important; }

body.acc-color-mono *:not(#acc-panel):not(#acc-panel *):not(#acc-toggle-btn):not(#acc-toggle-btn *) {
    filter: grayscale(100%) !important;
}

/* ── Click to Read cursor ──────────────────────────────────── */
body.acc-click-to-read p,
body.acc-click-to-read h1, body.acc-click-to-read h2,
body.acc-click-to-read h3, body.acc-click-to-read h4,
body.acc-click-to-read h5, body.acc-click-to-read h6,
body.acc-click-to-read li, body.acc-click-to-read td,
body.acc-click-to-read blockquote {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='%2311375c' opacity='0.85'/%3E%3Ctext x='16' y='21' text-anchor='middle' font-size='16' fill='white'%3E🔊%3C/text%3E%3C/svg%3E") 16 16, pointer !important;
    transition: background 0.15s;
}
body.acc-click-to-read p:hover,
body.acc-click-to-read h1:hover, body.acc-click-to-read h2:hover,
body.acc-click-to-read h3:hover, body.acc-click-to-read h4:hover,
body.acc-click-to-read li:hover, body.acc-click-to-read td:hover {
    background: rgba(17,55,92,0.07) !important;
    border-radius: 4px;
    outline: 2px dashed #11375c;
}

/* ── TTS Active element highlight ──────────────────────────── */
.acc-tts-reading {
    background: #fff9c4 !important;
    outline: 2px solid #FFD000 !important;
    border-radius: 4px;
    scroll-margin-top: 80px;
}

/* ── Focus Visible (keyboard nav) ─────────────────────────── */
body *:focus-visible {
    outline: 3px solid #FFD000 !important;
    outline-offset: 2px !important;
}

/* ── Scrollbar toolbar ─────────────────────────────────────── */
#acc-panel-body::-webkit-scrollbar { width: 5px; }
#acc-panel-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
#acc-panel-body::-webkit-scrollbar-thumb:hover { background: #11375c; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
    #acc-panel {
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: calc(100vh - 16px);
    }
    #acc-toggle-btn { left: 12px; bottom: 12px; }
}
