/* Accessibility Widget & Menu Styles */

:root {
    --acc-primary: #6750A4;
    --acc-primary-dark: #21005D;
    --acc-surface: #FEF7FF;
    --acc-surface-variant: #E8DEF8;
    --acc-text: #1D1B20;
    --acc-text-secondary: #49454F;
    --acc-card-bg: #FFFFFF;
    --acc-border: #E7E0EC;
}

/* Floating Trigger Button */
.acc-trigger-btn {
    position: fixed;
    z-index: 1000000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6750A4 0%, #523E90 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    pointer-events: auto !important;
    box-shadow: 0 4px 20px rgba(103, 80, 164, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    outline: none;
    backdrop-filter: blur(4px);
}

.acc-trigger-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.acc-trigger-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Hide floating button on mobile (lg breakpoint matching navbar) */
@media (max-width: 1023px) {
    .acc-trigger-btn {
        display: none !important;
    }
}

/* Widget Positions */
.acc-pos-bottom-right {
    bottom: 20px;
    right: 20px;
}

.acc-pos-bottom-left {
    bottom: 20px;
    left: 20px;
}

.acc-pos-top-right {
    top: 120px;
    right: 20px;
}

/* Offset for navbar */
.acc-pos-top-left {
    top: 120px;
    left: 20px;
}

/* Menu Overlay/Modal */
.acc-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    /* Hidden by default */
    width: 100%;
    height: 100vh;
    max-width: 420px;
    background-color: var(--acc-surface);
    z-index: 1000001;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    transition: right 0.4s cubic-bezier(0.2, 1, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.acc-menu-overlay.active {
    right: 0;
}

/* Header */
.acc-header {
    background-color: var(--acc-primary);
    color: white;
    padding: 24px 24px 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.acc-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: white;
    letter-spacing: -0.025em;
}

.acc-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.acc-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: rotate(90deg);
}

/* Content Body */
.acc-body {
    padding: 24px;
    flex: 1;
}

/* Language & Profile Section */
.acc-section-top {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.acc-dropdown {
    background: white;
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--acc-border);
    transition: all 0.2s;
}

.acc-dropdown:hover {
    border-color: var(--acc-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -3px rgba(0, 0, 0, 0.05);
}

.acc-dropdown-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--acc-surface-variant);
    color: var(--acc-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
}

/* Grid Layout for Features */
.acc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.acc-card {
    background: var(--acc-card-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--acc-border);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.acc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-color: var(--acc-primary);
}

.acc-card:active {
    transform: scale(0.98);
}

.acc-card.active {
    background: var(--acc-surface-variant);
    border-color: var(--acc-primary);
}

.acc-card.active-bg {
    background: var(--acc-primary);
    color: white;
}

/* Active Indicator */
.acc-card.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--acc-primary);
}

.acc-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--acc-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    color: var(--acc-text-secondary);
    transition: all 0.2s;
}

.acc-card:hover .acc-card-icon {
    background: var(--acc-surface-variant);
    color: var(--acc-primary);
}

.acc-card.active .acc-card-icon {
    background: var(--acc-primary);
    color: white;
}

.acc-card.active-bg .acc-card-icon {
    background: white;
    color: var(--acc-primary);
}

.acc-card-text {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--acc-text);
}

/* Reset Button */
.acc-reset-btn {
    width: 100%;
    background: var(--acc-primary);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 24px 0;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(103, 80, 164, 0.3);
}

.acc-reset-btn:hover {
    background: #523E90;
    transform: translateY(-2px);
    box-shadow: 0 8px 10px -3px rgba(103, 80, 164, 0.4);
}

.acc-reset-btn:active {
    transform: scale(0.98);
}


/* Widget Position Settings */
.acc-settings {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-top: 10px;
}

.acc-position-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
}

.acc-radio-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    cursor: pointer;
}

/* --- Accessibility Modifications Classes (Applied to BODY or HTML) --- */

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

/* High Contrast */
html.acc-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
    box-shadow: none !important;
}

html.acc-contrast img {
    filter: grayscale(100%) contrast(150%);
}

/* Invert Colors (Optional, not explicitly requested but good to have) */
html.acc-invert {
    filter: invert(100%);
}

html.acc-invert img {
    filter: invert(100%);
}

/* Text Sizing */
html.acc-text-sm {
    font-size: 85% !important;
}

html.acc-text-lg {
    font-size: 115% !important;
}

html.acc-text-xl {
    font-size: 130% !important;
}

/* Dyslexia Friendly */
html.acc-dyslexia *:not(.material-symbols-outlined):not(.bi):not(.fa):not(.fas):not(.far):not(.fab),
html.acc-dyslexia body {
    font-family: 'Lexend', 'Roboto', 'Verdana', sans-serif !important;
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
}

/* Link Underlines */
html.acc-links-underline a {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
}

/* Large Cursor */
html.acc-cursor-big,
html.acc-cursor-big * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="black"><path d="M7 2l12 11.2-5.8.5 3.3 7.3-2.2.9-3.2-7.4-4.4 4.6V2z"/></svg>'), auto !important;
}

/* Reading Guide / Tooltip (Simple Implementation) */
/* .. future .. */

/* Hide Images */
html.acc-hide-images img,
html.acc-hide-images [style*="background-image"] {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Line Height */
html.acc-line-height-lg * {
    line-height: 2 !important;
}

/* Letter Spacing */
html.acc-spacing-lg * {
    letter-spacing: 0.15em !important;
}

/* Saturation */
html.acc-saturation-high {
    filter: saturate(300%);
}

html.acc-saturation-low {
    filter: saturate(50%);
}

/* Animation Pause */
html.acc-pause-animations *,
html.acc-pause-animations *:before,
html.acc-pause-animations *:after {
    animation-play-state: paused !important;
    transition: none !important;
}

/* Text Align */
html.acc-align-left * {
    text-align: left !important;
}

html.acc-align-right * {
    text-align: right !important;
}

html.acc-align-center * {
    text-align: center !important;
}

html.acc-align-justify * {
    text-align: justify !important;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .acc-menu-overlay {
        max-width: 100%;
    }

    .acc-grid,
    .acc-profile-grid {
        grid-template-columns: 1fr;
    }

    .acc-profile-card,
    .acc-card {
        padding: 12px;
    }

    .acc-card-text,
    .acc-p-text {
        font-size: 0.9rem;
    }
}

/* Screen Reader Highlight */
.sr-highlight {
    outline: 3px solid #FFA726 !important;
    background-color: rgba(255, 167, 38, 0.1) !important;
    cursor: help !important;
}

/* --- Accessibility Profiles --- */
/* --- Accessibility Profiles --- */
.acc-profile-section {
    background: var(--acc-surface);
    margin-bottom: 24px;
}

.acc-profile-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
    color: var(--acc-text);
}

.acc-profile-header:hover {
    background: var(--acc-surface-variant);
    color: var(--acc-primary);
}

.acc-profile-content {
    display: none;
    padding: 12px 0;
    background: var(--acc-surface);
}

.acc-profile-content.open {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.acc-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.acc-profile-card {
    background: white;
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: 1px solid var(--acc-border);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.acc-profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
    border-color: var(--acc-primary);
}

.acc-profile-card.active {
    background: var(--acc-surface-variant);
    border-color: var(--acc-primary);
    box-shadow: 0 0 0 2px var(--acc-primary) inset;
}

.acc-p-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--acc-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--acc-text);
    flex-shrink: 0;
    transition: all 0.2s;
}

.acc-profile-card:hover .acc-p-icon {
    background: white;
    color: var(--acc-primary);
}

.acc-profile-card.active .acc-p-icon {
    background: var(--acc-primary);
    color: white;
}

.acc-p-icon .material-symbols-outlined {
    font-size: 20px;
}

.acc-p-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--acc-text);
    line-height: 1.25;
}