/**
 * ActWise Accessibility Plugin Styles
 * Works with any theme — no theme dependency.
 */

/* Trigger Button */
.actwise-a11y-trigger {
    position: fixed;
    bottom: 24px;
    left: 20px;
    z-index: 99998;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #2563EB;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

[dir="rtl"] .actwise-a11y-trigger {
    left: 20px;
    right: auto;
}

.actwise-a11y-trigger:hover {
    transform: scale(1.1);
    background: #1D4ED8;
}

@media (max-width: 768px) {
    .actwise-a11y-trigger {
        width: 48px;
        height: 48px;
        bottom: 20px;
    }
}

/* Panel */
.actwise-a11y-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99999;
    width: 340px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[dir="rtl"] .actwise-a11y-panel {
    left: 20px;
    right: auto;
}

.actwise-a11y-panel[hidden] {
    display: none;
}

.actwise-a11y-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.actwise-a11y-panel__header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.actwise-a11y-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #6B7280;
    padding: 4px;
    border-radius: 4px;
    display: flex;
}

.actwise-a11y-close:hover {
    color: #111827;
    background: #E5E7EB;
}

.actwise-a11y-panel__body {
    padding: 16px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Option rows */
.actwise-a11y-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}

.actwise-a11y-option__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
}

.actwise-a11y-option__controls {
    display: flex;
    gap: 4px;
}

/* Font size buttons */
.actwise-a11y-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1.5px solid #D1D5DB;
    background: transparent;
    color: #111827;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.actwise-a11y-btn:hover {
    border-color: #2563EB;
    background: #EFF6FF;
}

/* Toggle switch */
.actwise-a11y-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.actwise-a11y-toggle__track {
    display: block;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: #D1D5DB;
    position: relative;
    transition: background 0.3s;
}

.actwise-a11y-toggle[aria-checked="true"] .actwise-a11y-toggle__track {
    background: #2563EB;
}

.actwise-a11y-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

[dir="rtl"] .actwise-a11y-toggle__thumb {
    left: auto;
    right: 2px;
}

.actwise-a11y-toggle[aria-checked="true"] .actwise-a11y-toggle__thumb {
    transform: translateX(20px);
}

[dir="rtl"] .actwise-a11y-toggle[aria-checked="true"] .actwise-a11y-toggle__thumb {
    transform: translateX(-20px);
}

/* Reset button */
.actwise-a11y-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    background: transparent;
    color: #6B7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.actwise-a11y-reset:hover {
    border-color: #DC2626;
    color: #DC2626;
    background: #FEF2F2;
}

/* Reading Guide */
.actwise-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 40px;
    z-index: 99990;
    pointer-events: none;
    border-top: 2px solid rgba(37, 99, 235, 0.5);
    border-bottom: 2px solid rgba(37, 99, 235, 0.5);
    background: rgba(37, 99, 235, 0.05);
    transition: top 0.05s linear;
}

.actwise-reading-guide[hidden] {
    display: none;
}

/* Keep toolbar above filters */
.actwise-a11y-trigger,
.actwise-a11y-panel {
    position: fixed !important;
    z-index: 999999 !important;
}

/* ===== Active State Classes ===== */

body.actwise-a11y-contrast {
    filter: contrast(1.4);
}

body.actwise-a11y-grayscale {
    filter: grayscale(1);
}

body.actwise-a11y-contrast.actwise-a11y-grayscale {
    filter: contrast(1.4) grayscale(1);
}

body.actwise-a11y-invert {
    filter: invert(1) hue-rotate(180deg);
}

body.actwise-a11y-invert img,
body.actwise-a11y-invert video,
body.actwise-a11y-invert svg {
    filter: invert(1) hue-rotate(180deg);
}

body.actwise-a11y-spacing * {
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}

body.actwise-a11y-lineheight * {
    line-height: 2 !important;
}

body.actwise-a11y-links a {
    outline: 2px solid #2563EB !important;
    outline-offset: 2px !important;
    text-decoration: underline !important;
}

body.actwise-a11y-no-animations *,
body.actwise-a11y-no-animations *::before,
body.actwise-a11y-no-animations *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

body.actwise-a11y-big-cursor,
body.actwise-a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M5 3l14 9-6 1 4 8-3 1-4-8-5 4V3z' fill='%23111827' stroke='%23fff' stroke-width='1'/%3E%3C/svg%3E") 4 4, auto !important;
}

/* Mobile */
@media (max-width: 768px) {
    .actwise-a11y-panel {
        width: calc(100% - 40px);
        max-height: 70vh;
    }
}
