/* ==========================================================================
   HOSPITAL ACCESSIBILITY WIDGET (WCAG 2.1 COMPLIANT)
   RSIA Harapan Bunda Kudus - CodeIgniter 4
   ========================================================================== */

:root {
    --acc-primary: #0d6efd;
    --acc-primary-hover: #0b5ed7;
    --acc-bg: #ffffff;
    --acc-surface: #f8fafc;
    --acc-border: #e2e8f0;
    --acc-text: #1e293b;
    --acc-text-muted: #64748b;
    --acc-radius: 14px;
    --acc-font-scale: 100%;
    --acc-line-height-scale: 1.5;
    --acc-letter-spacing: normal;
}

/* FLOATING TRIGGER BUTTON */
.acc-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--acc-primary);
    color: #ffffff;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 16px rgba(13, 110, 253, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999990;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    padding: 0;
    outline: none;
}

.acc-floating-btn:hover {
    transform: scale(1.08);
    background-color: var(--acc-primary-hover);
    box-shadow: 0 6px 22px rgba(13, 110, 253, 0.5);
}

.acc-floating-btn svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

.acc-active-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #10b981;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* BACKDROP & PANEL */
.acc-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999995;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.acc-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.acc-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -8px 0 35px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--acc-text);
}

.acc-panel.active {
    right: 0;
}

/* HEADER */
.acc-header {
    background: linear-gradient(135deg, #0d6efd, #0052cc);
    color: #ffffff;
    padding: 20px 20px 16px 20px;
    position: relative;
}

.acc-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

/* Multi-language Selector dengan Scrollable Menu */
.acc-lang-wrapper {
    position: relative;
}

.acc-lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
    outline: none;
}

.acc-lang-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.acc-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #ffffff;
    border: 1px solid var(--acc-border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 6px;
    min-width: 190px;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 1000000;
}

.acc-lang-menu::-webkit-scrollbar {
    width: 6px;
}
.acc-lang-menu::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.acc-lang-menu::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.acc-lang-menu.show {
    display: block;
}

.acc-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--acc-text);
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s;
    user-select: none;
}

.acc-lang-item:hover,
.acc-lang-item.active {
    background: #eff6ff;
    color: var(--acc-primary);
    font-weight: 700;
}

.acc-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.acc-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.acc-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.acc-title-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acc-title-icon svg {
    width: 26px;
    height: 26px;
    fill: #ffffff;
}

.acc-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
}

.acc-subtitle {
    margin: 2px 0 0 0;
    font-size: 11px;
    opacity: 0.85;
}

/* BODY */
.acc-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.acc-section {
    background: #ffffff;
    border-radius: var(--acc-radius);
    padding: 14px;
    border: 1px solid var(--acc-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.acc-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--acc-text-muted);
    margin: 0 0 12px 0;
}

/* GRIDS */
.acc-top-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.acc-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* Stepper Card */
.acc-stepper-box {
    background: #f8fafc;
    border: 1px solid var(--acc-border);
    border-radius: 12px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.acc-stepper-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--acc-text);
}

.acc-stepper-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.acc-step-circle-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0d6efd;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    outline: none;
}

.acc-step-circle-btn:hover {
    background: #0b5ed7;
    transform: scale(1.05);
}

.acc-step-circle-btn:active {
    transform: scale(0.95);
}

.acc-step-text {
    font-size: 12px;
    font-weight: 700;
    min-width: 52px;
    text-align: center;
    color: var(--acc-text);
}

/* Card Buttons */
.acc-card-btn {
    background: #f8fafc;
    border: 1px solid var(--acc-border);
    border-radius: 12px;
    padding: 12px 6px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    user-select: none;
    color: var(--acc-text);
    min-height: 80px;
    outline: none;
}

.acc-card-btn:hover {
    border-color: var(--acc-primary);
    background: #eff6ff;
}

.acc-card-btn.active {
    background: #eff6ff;
    border-color: var(--acc-primary);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.2);
    color: var(--acc-primary);
    font-weight: 600;
}

.acc-card-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.acc-card-btn span {
    font-size: 11px;
    line-height: 1.2;
}

/* FOOTER */
.acc-footer {
    padding: 14px 18px;
    background: #ffffff;
    border-top: 1px solid var(--acc-border);
    display: flex;
    gap: 10px;
}

.acc-btn-reset {
    flex: 1;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}

.acc-btn-reset:hover {
    background: #fca5a5;
    color: #991b1b;
}

.acc-btn-close-full {
    background: #f1f5f9;
    color: var(--acc-text);
    border: 1px solid var(--acc-border);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   EFFECTS & HIGHLIGHTS
   ========================================================================== */
html.acc-font-scaled {
    font-size: var(--acc-font-scale) !important;
}

html.acc-line-height-scaled * {
    line-height: var(--acc-line-height-scale) !important;
}

html.acc-letter-spacing-scaled * {
    letter-spacing: var(--acc-letter-spacing) !important;
}

html.acc-font-weight-bold * {
    font-weight: 700 !important;
}
html.acc-font-weight-bolder * {
    font-weight: 900 !important;
}
html.acc-font-weight-light * {
    font-weight: 300 !important;
}

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Lexend:wght@400;600;700&display=swap');

html.acc-dyslexic-font,
html.acc-dyslexic-font * {
    font-family: 'Lexend', 'Open Sans', Verdana, Arial, sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

html.acc-high-contrast {
    background-color: #000000 !important;
}

/* Override UNIVERSAL: paksa background hitam & teks putih ke SEMUA elemen
   di halaman, kecuali widget aksesibilitas itu sendiri (#acc-widget-container).
   Ini memastikan heading, label, badge, atau komponen apapun yang sebelumnya
   tidak ke-cover tetap ikut berubah, bukan cuma tag yang didaftar manual. */
html.acc-high-contrast body,
html.acc-high-contrast body *:not(#acc-widget-container):not(#acc-widget-container *) {
    background-color: #000000 !important;
    background-image: none !important;
    color: #ffffff !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Kontainer besar dibedakan sedikit warnanya biar ada kedalaman visual */
html.acc-high-contrast div:not(#acc-widget-container *),
html.acc-high-contrast section:not(#acc-widget-container *),
html.acc-high-contrast article:not(#acc-widget-container *),
html.acc-high-contrast header:not(#acc-widget-container *),
html.acc-high-contrast footer:not(#acc-widget-container *),
html.acc-high-contrast nav:not(#acc-widget-container *),
html.acc-high-contrast .card:not(#acc-widget-container *) {
    background-color: #121212 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

/* Heading tetap kuning menonjol (sebelumnya TIDAK ter-cover — ini sumber
   utama bug "jadi hitam") */
html.acc-high-contrast h1:not(#acc-widget-container *),
html.acc-high-contrast h2:not(#acc-widget-container *),
html.acc-high-contrast h3:not(#acc-widget-container *),
html.acc-high-contrast h4:not(#acc-widget-container *),
html.acc-high-contrast h5:not(#acc-widget-container *),
html.acc-high-contrast h6:not(#acc-widget-container *) {
    color: #ffff00 !important;
}

html.acc-high-contrast p:not(#acc-widget-container *),
html.acc-high-contrast span:not(#acc-widget-container *),
html.acc-high-contrast li:not(#acc-widget-container *),
html.acc-high-contrast td:not(#acc-widget-container *),
html.acc-high-contrast th:not(#acc-widget-container *),
html.acc-high-contrast label:not(#acc-widget-container *) {
    color: #ffffff !important;
}

html.acc-high-contrast a:not(#acc-widget-container *),
html.acc-high-contrast button:not(#acc-widget-container *),
html.acc-high-contrast input:not(#acc-widget-container *),
html.acc-high-contrast select:not(#acc-widget-container *),
html.acc-high-contrast textarea:not(#acc-widget-container *) {
    color: #00ffff !important;
    background-color: #000000 !important;
    border-color: #00ffff !important;
}

/* Gambar & ikon: background transparan supaya gambar aslinya tetap terlihat,
   bukan ketutup kotak hitam */
html.acc-high-contrast img:not(#acc-widget-container *),
html.acc-high-contrast svg:not(#acc-widget-container *),
html.acc-high-contrast video:not(#acc-widget-container *),
html.acc-high-contrast picture:not(#acc-widget-container *) {
    background-color: transparent !important;
    filter: none !important;
}

/* Widget aksesibilitas sendiri tidak pernah ikut berubah */
html.acc-high-contrast .acc-panel,
html.acc-high-contrast .acc-panel * {
    filter: none !important;
}

html.acc-light-contrast {
    background-color: #ffffff !important;
}
html.acc-light-contrast body,
html.acc-light-contrast p,
html.acc-light-contrast span,
html.acc-light-contrast h1,
html.acc-light-contrast h2,
html.acc-light-contrast h3,
html.acc-light-contrast h4,
html.acc-light-contrast h5,
html.acc-light-contrast h6,
html.acc-light-contrast li {
    color: #000000 !important;
    background-color: #ffffff !important;
}

html.acc-monochrome {
    filter: grayscale(100%) !important;
}

html.acc-big-cursor,
html.acc-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'%3E%3Cpath fill='%23000000' stroke='%23ffffff' stroke-width='2' d='M4.5 3v16l4.7-4.2l3 6.9l2.8-1.2l-3-6.9h5.5z'/%3E%3C/svg%3E"), auto !important;
}

/* HIGHLIGHT LINKS */
html.acc-highlight-links a {
    text-decoration: underline 3px solid #ffbf00 !important;
    background-color: #fef08a !important;
    color: #000000 !important;
    font-weight: 700 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
}

/* HIGHLIGHT CONTENT */
html.acc-highlight-content p:hover,
html.acc-highlight-content h1:hover,
html.acc-highlight-content h2:hover,
html.acc-highlight-content h3:hover,
html.acc-highlight-content h4:hover,
html.acc-highlight-content h5:hover,
html.acc-highlight-content h6:hover,
html.acc-highlight-content .card:hover,
html.acc-highlight-content article:hover,
html.acc-highlight-content section:hover,
html.acc-highlight-content li:hover {
    outline: 2px dashed #0d6efd !important;
    outline-offset: 4px !important;
    background-color: rgba(13, 110, 253, 0.05) !important;
    border-radius: 4px !important;
}

/* STOP ANIMATIONS */
html.acc-pause-animations *,
html.acc-pause-animations *::before,
html.acc-pause-animations *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* HIDE IMAGES */
html.acc-hide-images img,
html.acc-hide-images video,
html.acc-hide-images [style*="background-image"] {
    opacity: 0.05 !important;
    visibility: hidden !important;
}

#acc-reading-ruler {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 6px;
    background: #0d6efd;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.8), 0 0 20px rgba(13, 110, 253, 0.4);
    pointer-events: none;
    z-index: 999980;
    display: none;
    transform: translateY(-50%);
}

#acc-reading-mask-top,
#acc-reading-mask-bottom {
    position: fixed;
    left: 0;
    width: 100vw;
    background: rgba(0, 0, 0, 0.65);
    pointer-events: none;
    z-index: 999980;
    display: none;
}
#acc-reading-mask-top {
    top: 0;
    height: 40vh;
}
#acc-reading-mask-bottom {
    bottom: 0;
    height: 40vh;
}

.acc-tts-speaking {
    outline: 3px solid #10b981 !important;
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-radius: 4px;
}

html.acc-align-left * {
    text-align: left !important;
}
html.acc-align-center * {
    text-align: center !important;
}
html.acc-align-right * {
    text-align: right !important;
}
html.acc-align-justify * {
    text-align: justify !important;
}

@media (max-width: 480px) {
    .acc-panel {
        max-width: 100%;
    }
    .acc-floating-btn {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }
}