/* ==========================================================================
   SIPS Accessibility Widget (Native PWA Offline-Ready)
   ========================================================================== */

/* Floating Button (Bottom-Left) */
.sips-a11y-trigger {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 24px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #ffffff !important;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
    z-index: 1040;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
}

.sips-a11y-trigger:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.45);
    color: #ffffff !important;
}

.sips-a11y-trigger:active {
    transform: scale(0.95);
}

.sips-a11y-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: none;
}

.sips-a11y-badge.active {
    display: block;
}

/* Accessibility Popup Panel */
.sips-a11y-panel {
    position: fixed;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    left: 24px;
    width: 330px;
    max-width: calc(100vw - 48px);
    max-height: calc(85vh - env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(226, 232, 240, 0.9);
    z-index: 1045;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    animation: sipsA11ySlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sips-a11y-panel.show {
    display: flex;
}

@keyframes sipsA11ySlideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sips-a11y-header {
    padding: 16px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #ffffff;
    border-top-left-radius: 17px;
    border-top-right-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sips-a11y-header h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sips-a11y-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

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

.sips-a11y-body {
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: #f8fafc;
}

.sips-a11y-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sips-a11y-btn i {
    font-size: 22px;
    color: #2563eb;
    transition: color 0.2s;
}

.sips-a11y-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    transform: translateY(-1px);
}

.sips-a11y-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.sips-a11y-btn.active i {
    color: #ffffff;
}

.sips-a11y-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sips-a11y-btn-reset {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sips-a11y-btn-reset:hover {
    background: #fca5a5;
    color: #991b1b;
}

/* Speech Status Toast */
.sips-tts-indicator {
    position: fixed;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    left: 24px;
    background: #0f172a;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 1046;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.sips-tts-indicator.active {
    display: flex;
}

/* ==========================================================================
   Accessibility Modifications Classes
   ========================================================================== */

/* Font Size Scaling */
body.a11y-font-md {
    font-size: 115% !important;
}
body.a11y-font-md h1, body.a11y-font-md h2, body.a11y-font-md h3, 
body.a11y-font-md h4, body.a11y-font-md h5, body.a11y-font-md h6,
body.a11y-font-md p, body.a11y-font-md span, body.a11y-font-md a,
body.a11y-font-md button, body.a11y-font-md input, body.a11y-font-md select {
    font-size: 1.15em !important;
}

body.a11y-font-lg {
    font-size: 130% !important;
}
body.a11y-font-lg h1, body.a11y-font-lg h2, body.a11y-font-lg h3, 
body.a11y-font-lg h4, body.a11y-font-lg h5, body.a11y-font-lg h6,
body.a11y-font-lg p, body.a11y-font-lg span, body.a11y-font-lg a,
body.a11y-font-lg button, body.a11y-font-lg input, body.a11y-font-lg select {
    font-size: 1.3em !important;
}

/* High Contrast (Yellow on Black) */
body.a11y-contrast-high,
body.a11y-contrast-high #content-wrapper,
body.a11y-contrast-high .card,
body.a11y-contrast-high .modal-content,
body.a11y-contrast-high header,
body.a11y-contrast-high footer,
body.a11y-contrast-high #sidebar-wrapper {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}
body.a11y-contrast-high a,
body.a11y-contrast-high p,
body.a11y-contrast-high h1,
body.a11y-contrast-high h2,
body.a11y-contrast-high h3,
body.a11y-contrast-high h4,
body.a11y-contrast-high h5,
body.a11y-contrast-high h6,
body.a11y-contrast-high span,
body.a11y-contrast-high td,
body.a11y-contrast-high th {
    color: #ffff00 !important;
}
body.a11y-contrast-high button,
body.a11y-contrast-high .btn {
    background: #ffff00 !important;
    color: #000000 !important;
    border-color: #ffff00 !important;
    font-weight: bold !important;
}

/* Dark Mode */
body.a11y-dark-mode,
body.a11y-dark-mode #content-wrapper,
body.a11y-dark-mode .card,
body.a11y-dark-mode .modal-content,
body.a11y-dark-mode header,
body.a11y-dark-mode #sidebar-wrapper {
    background-color: #111827 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
body.a11y-dark-mode a:not(.btn) {
    color: #60a5fa !important;
}
body.a11y-dark-mode .text-muted,
body.a11y-dark-mode .text-dark {
    color: #9ca3af !important;
}

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

/* Dyslexia Friendly */
body.a11y-dyslexia,
body.a11y-dyslexia * {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif !important;
    letter-spacing: 0.08em !important;
}

/* Highlight Links */
body.a11y-highlight-links a {
    text-decoration: underline !important;
    background-color: #fef08a !important;
    color: #854d0e !important;
    padding: 0 4px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
}

/* Text Spacing */
body.a11y-text-spacing * {
    line-height: 1.9 !important;
    letter-spacing: 0.1em !important;
    word-spacing: 0.18em !important;
}

/* Large Cursor */
body.a11y-large-cursor,
body.a11y-large-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 24 24'%3E%3Cpath fill='%23000000' stroke='%23ffffff' stroke-width='1.5' d='M4.5.79v22.42l6.56-6.57h9.23L4.5.79z'/%3E%3C/svg%3E"), auto !important;
}

/* TTS Hover Highlighting */
body.a11y-tts-active *:hover {
    outline: 2px dashed #2563eb !important;
    cursor: help !important;
}
