/**
 * RSL Accessibility Widget Styles v1.4.0
 * Comprehensive styling for the accessibility overlay widget
 *
 * Customization: Override CSS variables in your own stylesheet to customize colors
 * Position: Add data-position attribute to the script tag (bottom-left, bottom-right, top-left, top-right)
 * Text-to-Speech: Enable read-aloud with highlighting for clicked text
 * Page Zoom: Scale the entire page up to 400%
 */

/* ==========================================================================
   CSS Variables - Override these to customize the widget colors
   ========================================================================== */

:root {
    /* Primary colors - used for buttons, headers, and accents */
    --rsl-a11y-primary: #667eea;
    --rsl-a11y-primary-dark: #5a6fd6;
    --rsl-a11y-primary-light: #818cf8;
    --rsl-a11y-secondary: #764ba2;

    /* Button gradient - customize the floating button appearance */
    --rsl-a11y-button-gradient: linear-gradient(135deg, var(--rsl-a11y-primary) 0%, var(--rsl-a11y-secondary) 100%);
    --rsl-a11y-button-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    --rsl-a11y-button-shadow-hover: 0 6px 24px rgba(102, 126, 234, 0.5);

    /* Header gradient - customize the panel header */
    --rsl-a11y-header-gradient: linear-gradient(135deg, var(--rsl-a11y-primary) 0%, var(--rsl-a11y-secondary) 100%);
    --rsl-a11y-header-text: #ffffff;

    /* Toggle button active state */
    --rsl-a11y-toggle-gradient: linear-gradient(135deg, var(--rsl-a11y-primary) 0%, var(--rsl-a11y-secondary) 100%);

    /* Panel colors */
    --rsl-a11y-success: #28a745;
    --rsl-a11y-panel-bg: #ffffff;
    --rsl-a11y-panel-border: #e0e0e0;
    --rsl-a11y-text: #333333;
    --rsl-a11y-text-muted: #666666;
    --rsl-a11y-hover-bg: #f5f5f5;
    --rsl-a11y-toggle-bg: #f8f9fa;
    --rsl-a11y-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);

    /* Button icon color */
    --rsl-a11y-button-icon: #ffffff;
}

[data-theme="dark"] {
    --rsl-a11y-panel-bg: #1e1e1e;
    --rsl-a11y-panel-border: #333333;
    --rsl-a11y-text: #e0e0e0;
    --rsl-a11y-text-muted: #aaaaaa;
    --rsl-a11y-hover-bg: #2a2a2a;
    --rsl-a11y-toggle-bg: #2a2a2a;
    --rsl-a11y-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Widget Immunity - Prevent accessibility settings from affecting the widget
   ========================================================================== */

.rsl-a11y-widget-button,
.rsl-a11y-widget-panel,
.rsl-a11y-widget-panel *,
.rsl-a11y-toast {
    /* Reset font properties */
    font-size: 14px !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    text-align: left !important;

    /* Prevent filters from affecting widget */
    filter: none !important;
    -webkit-filter: none !important;
}

/* Specific size overrides for different elements */
.rsl-a11y-panel-title {
    font-size: 18px !important;
}

.rsl-a11y-section-title {
    font-size: 14px !important;
}

.rsl-a11y-label {
    font-size: 13px !important;
}

.rsl-a11y-toggle-label {
    font-size: 12px !important;
}

.rsl-a11y-btn,
.rsl-a11y-btn-small,
.rsl-a11y-zoom-preset {
    font-size: 13px !important;
}

.rsl-a11y-select {
    font-size: 14px !important;
}

.rsl-a11y-tts-hint {
    font-size: 11px !important;
}

.rsl-a11y-saved-indicator {
    font-size: 12px !important;
}

/* Ensure widget is not affected by grayscale, invert, or saturation filters */
.rsl-a11y-grayscale .rsl-a11y-widget-button,
.rsl-a11y-grayscale .rsl-a11y-widget-panel,
.rsl-a11y-invert .rsl-a11y-widget-button,
.rsl-a11y-invert .rsl-a11y-widget-panel,
.rsl-a11y-low-saturation .rsl-a11y-widget-button,
.rsl-a11y-low-saturation .rsl-a11y-widget-panel,
.rsl-a11y-high-saturation .rsl-a11y-widget-button,
.rsl-a11y-high-saturation .rsl-a11y-widget-panel,
.rsl-a11y-high-contrast .rsl-a11y-widget-button,
.rsl-a11y-high-contrast .rsl-a11y-widget-panel {
    filter: none !important;
    -webkit-filter: none !important;
}

/* Prevent text alignment changes from affecting widget */
.rsl-a11y-text-left .rsl-a11y-widget-panel,
.rsl-a11y-text-center .rsl-a11y-widget-panel,
.rsl-a11y-text-right .rsl-a11y-widget-panel {
    text-align: left !important;
}

.rsl-a11y-text-left .rsl-a11y-widget-panel *,
.rsl-a11y-text-center .rsl-a11y-widget-panel *,
.rsl-a11y-text-right .rsl-a11y-widget-panel * {
    text-align: inherit !important;
}

/* Center specific elements that should be centered */
.rsl-a11y-widget-panel .rsl-a11y-zoom-presets {
    text-align: center !important;
    justify-content: center !important;
}

/* ==========================================================================
   Floating Widget Button
   ========================================================================== */

.rsl-a11y-widget-button {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--rsl-a11y-button-gradient);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rsl-a11y-button-icon);
    box-shadow: var(--rsl-a11y-button-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 999998;
}

/* Default position: bottom-left */
.rsl-a11y-widget-button {
    bottom: 20px;
    left: 20px;
}

/* Position variants */
.rsl-a11y-widget-button.rsl-a11y-pos-bottom-right {
    bottom: 20px;
    right: 20px;
    left: auto;
}

.rsl-a11y-widget-button.rsl-a11y-pos-top-left {
    top: 20px;
    left: 20px;
    bottom: auto;
}

.rsl-a11y-widget-button.rsl-a11y-pos-top-right {
    top: 20px;
    right: 20px;
    left: auto;
    bottom: auto;
}

.rsl-a11y-widget-button:hover {
    transform: scale(1.1);
    box-shadow: var(--rsl-a11y-button-shadow-hover);
}

.rsl-a11y-widget-button:focus {
    outline: 3px solid var(--rsl-a11y-primary);
    outline-offset: 3px;
}

.rsl-a11y-widget-button.active {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.rsl-a11y-widget-button svg {
    width: 28px;
    height: 28px;
}

/* ==========================================================================
   Settings Panel
   ========================================================================== */

.rsl-a11y-widget-panel {
    position: fixed;
    width: 360px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 140px);
    background: var(--rsl-a11y-panel-bg);
    border: 1px solid var(--rsl-a11y-panel-border);
    border-radius: 16px;
    box-shadow: var(--rsl-a11y-shadow);
    z-index: 999999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

/* Default panel position: bottom-left */
.rsl-a11y-widget-panel {
    bottom: 90px;
    left: 20px;
}

/* Panel position variants */
.rsl-a11y-widget-panel.rsl-a11y-pos-bottom-right {
    bottom: 90px;
    right: 20px;
    left: auto;
}

.rsl-a11y-widget-panel.rsl-a11y-pos-top-left {
    top: 90px;
    left: 20px;
    bottom: auto;
    transform: translateY(-20px) scale(0.95);
}

.rsl-a11y-widget-panel.rsl-a11y-pos-top-left.open {
    transform: translateY(0) scale(1);
}

.rsl-a11y-widget-panel.rsl-a11y-pos-top-right {
    top: 90px;
    right: 20px;
    left: auto;
    bottom: auto;
    transform: translateY(-20px) scale(0.95);
}

.rsl-a11y-widget-panel.rsl-a11y-pos-top-right.open {
    transform: translateY(0) scale(1);
}

.rsl-a11y-widget-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Panel Header */
.rsl-a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--rsl-a11y-header-gradient);
    color: var(--rsl-a11y-header-text);
}

.rsl-a11y-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.rsl-a11y-panel-title svg {
    opacity: 0.9;
}

.rsl-a11y-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

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

.rsl-a11y-close-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Panel Body */
.rsl-a11y-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* Sections */
.rsl-a11y-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rsl-a11y-panel-border);
}

.rsl-a11y-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.rsl-a11y-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--rsl-a11y-text);
}

.rsl-a11y-section-title svg {
    color: var(--rsl-a11y-primary);
}

/* ==========================================================================
   Controls
   ========================================================================== */

.rsl-a11y-control {
    margin-bottom: 16px;
}

.rsl-a11y-control:last-child {
    margin-bottom: 0;
}

.rsl-a11y-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--rsl-a11y-text-muted);
    font-weight: 500;
}

/* Slider Group */
.rsl-a11y-slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rsl-a11y-btn-small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--rsl-a11y-panel-border);
    background: var(--rsl-a11y-toggle-bg);
    color: var(--rsl-a11y-text);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.rsl-a11y-btn-small:hover {
    background: var(--rsl-a11y-hover-bg);
    border-color: var(--rsl-a11y-primary);
}

.rsl-a11y-btn-small:focus {
    outline: 2px solid var(--rsl-a11y-primary);
    outline-offset: 2px;
}

/* Range Slider */
.rsl-a11y-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--rsl-a11y-panel-border);
    border-radius: 3px;
    cursor: pointer;
}

.rsl-a11y-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--rsl-a11y-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s ease;
}

.rsl-a11y-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.rsl-a11y-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--rsl-a11y-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.rsl-a11y-slider:focus {
    outline: none;
}

.rsl-a11y-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Select Dropdown */
.rsl-a11y-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--rsl-a11y-panel-border);
    border-radius: 8px;
    background: var(--rsl-a11y-toggle-bg);
    color: var(--rsl-a11y-text);
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 36px;
}

.rsl-a11y-select:focus {
    outline: none;
    border-color: var(--rsl-a11y-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .rsl-a11y-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23aaa'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* Button Group (Text Alignment) */
.rsl-a11y-btn-group {
    display: flex;
    gap: 8px;
}

.rsl-a11y-btn-icon {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--rsl-a11y-panel-border);
    border-radius: 8px;
    background: var(--rsl-a11y-toggle-bg);
    color: var(--rsl-a11y-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.rsl-a11y-btn-icon:hover {
    background: var(--rsl-a11y-hover-bg);
    border-color: var(--rsl-a11y-primary);
}

.rsl-a11y-btn-icon:focus {
    outline: 2px solid var(--rsl-a11y-primary);
    outline-offset: 2px;
}

.rsl-a11y-btn-icon.active {
    background: var(--rsl-a11y-primary);
    border-color: var(--rsl-a11y-primary);
    color: #ffffff;
}

/* ==========================================================================
   Toggle Grid
   ========================================================================== */

.rsl-a11y-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.rsl-a11y-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border: 1px solid var(--rsl-a11y-panel-border);
    border-radius: 12px;
    background: var(--rsl-a11y-toggle-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.rsl-a11y-toggle:hover {
    background: var(--rsl-a11y-hover-bg);
    border-color: var(--rsl-a11y-primary);
}

.rsl-a11y-toggle:focus {
    outline: 2px solid var(--rsl-a11y-primary);
    outline-offset: 2px;
}

.rsl-a11y-toggle.active {
    background: var(--rsl-a11y-toggle-gradient);
    border-color: transparent;
    color: var(--rsl-a11y-header-text);
}

.rsl-a11y-toggle-icon {
    margin-bottom: 8px;
    color: var(--rsl-a11y-text-muted);
    transition: color 0.2s ease;
}

.rsl-a11y-toggle.active .rsl-a11y-toggle-icon {
    color: var(--rsl-a11y-header-text);
}

.rsl-a11y-toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--rsl-a11y-text);
    line-height: 1.3;
}

.rsl-a11y-toggle.active .rsl-a11y-toggle-label {
    color: var(--rsl-a11y-header-text);
}

/* ==========================================================================
   Panel Footer
   ========================================================================== */

.rsl-a11y-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--rsl-a11y-toggle-bg);
    border-top: 1px solid var(--rsl-a11y-panel-border);
}

.rsl-a11y-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rsl-a11y-btn-reset {
    background: transparent;
    color: var(--rsl-a11y-text-muted);
    border: 1px solid var(--rsl-a11y-panel-border);
}

.rsl-a11y-btn-reset:hover {
    background: var(--rsl-a11y-hover-bg);
    color: var(--rsl-a11y-text);
}

.rsl-a11y-btn-reset:focus {
    outline: 2px solid var(--rsl-a11y-primary);
    outline-offset: 2px;
}

.rsl-a11y-saved-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--rsl-a11y-success);
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.rsl-a11y-saved-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Reading Guide
   ========================================================================== */

.rsl-a11y-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(255, 235, 59, 0.3);
    border-top: 2px solid #ffc107;
    border-bottom: 2px solid #ffc107;
    pointer-events: none;
    z-index: 999990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.rsl-a11y-reading-guide.active {
    opacity: 1;
    visibility: visible;
}

[data-theme="dark"] .rsl-a11y-reading-guide {
    background: rgba(255, 235, 59, 0.15);
}

/* ==========================================================================
   Reading Mask
   ========================================================================== */

.rsl-a11y-reading-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 999989;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.rsl-a11y-reading-mask.active {
    opacity: 1;
    visibility: visible;
}

.rsl-a11y-mask-top,
.rsl-a11y-mask-bottom {
    position: fixed;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
}

.rsl-a11y-mask-top {
    top: 0;
    height: 0;
    transition: height 0.05s linear;
}

.rsl-a11y-mask-bottom {
    bottom: 0;
    top: 100px;
    transition: top 0.05s linear;
}

/* ==========================================================================
   Fallback Toast
   ========================================================================== */

.rsl-a11y-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background: #333333;
    color: #ffffff;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.rsl-a11y-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Accessibility Effect Classes
   ========================================================================== */

/* High Contrast */
html.rsl-a11y-high-contrast {
    filter: contrast(1.5);
}

html.rsl-a11y-high-contrast .rsl-a11y-widget-panel,
html.rsl-a11y-high-contrast .rsl-a11y-widget-button {
    filter: contrast(0.67); /* Reset for widget */
}

/* Invert Colors */
html.rsl-a11y-invert {
    filter: invert(1) hue-rotate(180deg);
}

html.rsl-a11y-invert img,
html.rsl-a11y-invert video,
html.rsl-a11y-invert iframe,
html.rsl-a11y-invert .rsl-a11y-widget-panel,
html.rsl-a11y-invert .rsl-a11y-widget-button {
    filter: invert(1) hue-rotate(180deg); /* Revert for images and widget */
}

/* Grayscale */
html.rsl-a11y-grayscale {
    filter: grayscale(1);
}

html.rsl-a11y-grayscale .rsl-a11y-widget-panel,
html.rsl-a11y-grayscale .rsl-a11y-widget-button {
    filter: grayscale(0); /* Keep widget colorful */
}

/* Low Saturation */
html.rsl-a11y-low-saturation {
    filter: saturate(0.5);
}

html.rsl-a11y-low-saturation .rsl-a11y-widget-panel,
html.rsl-a11y-low-saturation .rsl-a11y-widget-button {
    filter: saturate(2);
}

/* High Saturation */
html.rsl-a11y-high-saturation {
    filter: saturate(2);
}

html.rsl-a11y-high-saturation .rsl-a11y-widget-panel,
html.rsl-a11y-high-saturation .rsl-a11y-widget-button {
    filter: saturate(0.5);
}

/* Highlight Links */
html.rsl-a11y-highlight-links a:not(.rsl-a11y-widget-button):not([class*="rsl-a11y"]) {
    background-color: #ffeb3b !important;
    color: #000000 !important;
    text-decoration: underline !important;
    padding: 2px 4px !important;
    border-radius: 2px !important;
}

html.rsl-a11y-highlight-links a:not(.rsl-a11y-widget-button):not([class*="rsl-a11y"]):hover {
    background-color: #ffc107 !important;
}

/* Highlight Headings */
html.rsl-a11y-highlight-headings h1:not([class*="rsl-a11y"]),
html.rsl-a11y-highlight-headings h2:not([class*="rsl-a11y"]),
html.rsl-a11y-highlight-headings h3:not([class*="rsl-a11y"]),
html.rsl-a11y-highlight-headings h4:not([class*="rsl-a11y"]),
html.rsl-a11y-highlight-headings h5:not([class*="rsl-a11y"]),
html.rsl-a11y-highlight-headings h6:not([class*="rsl-a11y"]) {
    background-color: #e3f2fd !important;
    padding: 8px 12px !important;
    border-left: 4px solid #2196f3 !important;
    border-radius: 4px !important;
}

[data-theme="dark"].rsl-a11y-highlight-headings h1:not([class*="rsl-a11y"]),
[data-theme="dark"].rsl-a11y-highlight-headings h2:not([class*="rsl-a11y"]),
[data-theme="dark"].rsl-a11y-highlight-headings h3:not([class*="rsl-a11y"]),
[data-theme="dark"].rsl-a11y-highlight-headings h4:not([class*="rsl-a11y"]),
[data-theme="dark"].rsl-a11y-highlight-headings h5:not([class*="rsl-a11y"]),
[data-theme="dark"].rsl-a11y-highlight-headings h6:not([class*="rsl-a11y"]) {
    background-color: rgba(33, 150, 243, 0.2) !important;
}

/* Big Cursor */
html.rsl-a11y-big-cursor,
html.rsl-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 fill='%23000' stroke='%23fff' stroke-width='1' d='M7 2l12 11.5-5.5 1 3.5 6.5-2.5 1.5-3.5-6.5-4 3.5z'/%3E%3C/svg%3E") 0 0, auto !important;
}

html.rsl-a11y-big-cursor a,
html.rsl-a11y-big-cursor button,
html.rsl-a11y-big-cursor [role="button"],
html.rsl-a11y-big-cursor input,
html.rsl-a11y-big-cursor select,
html.rsl-a11y-big-cursor textarea {
    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 fill='%23000' stroke='%23fff' stroke-width='1' d='M11 1v4h2V1h-2zm0 18v4h2v-4h-2zM4.22 3.81L2.81 5.22l2.83 2.83 1.41-1.41-2.83-2.83zm12.73 12.73l-1.41 1.41 2.83 2.83 1.41-1.41-2.83-2.83zM1 11v2h4v-2H1zm18 0v2h4v-2h-4zM6.05 16.54l-2.83 2.83 1.41 1.41 2.83-2.83-1.41-1.41zM18.78 3.81l-2.83 2.83 1.41 1.41 2.83-2.83-1.41-1.41z'/%3E%3Ccircle cx='12' cy='12' r='4' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E") 24 24, pointer !important;
}

/* Focus Indicator */
html.rsl-a11y-focus-indicator *:focus {
    outline: 3px solid #ff5722 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(255, 87, 34, 0.3) !important;
}

html.rsl-a11y-focus-indicator .rsl-a11y-widget-panel *:focus {
    outline: 2px solid var(--rsl-a11y-primary) !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}

/* Stop Animations */
html.rsl-a11y-stop-animations,
html.rsl-a11y-stop-animations *,
html.rsl-a11y-stop-animations *::before,
html.rsl-a11y-stop-animations *::after {
    animation: none !important;
    transition: none !important;
}

/* Exception for widget panel */
html.rsl-a11y-stop-animations .rsl-a11y-widget-panel,
html.rsl-a11y-stop-animations .rsl-a11y-widget-panel * {
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s !important;
}

/* Hide Images */
html.rsl-a11y-hide-images img:not(.rsl-a11y-widget-panel img),
html.rsl-a11y-hide-images svg:not(.rsl-a11y-widget-panel svg):not(.rsl-a11y-widget-button svg),
html.rsl-a11y-hide-images video,
html.rsl-a11y-hide-images picture,
html.rsl-a11y-hide-images [role="img"] {
    opacity: 0.1 !important;
}

/* Text Alignment */
html.rsl-a11y-text-left body,
html.rsl-a11y-text-left p,
html.rsl-a11y-text-left div,
html.rsl-a11y-text-left span,
html.rsl-a11y-text-left li {
    text-align: left !important;
}

html.rsl-a11y-text-center body,
html.rsl-a11y-text-center p,
html.rsl-a11y-text-center div,
html.rsl-a11y-text-center span,
html.rsl-a11y-text-center li {
    text-align: center !important;
}

html.rsl-a11y-text-right body,
html.rsl-a11y-text-right p,
html.rsl-a11y-text-right div,
html.rsl-a11y-text-right span,
html.rsl-a11y-text-right li {
    text-align: right !important;
}

/* Prevent alignment on widget */
.rsl-a11y-widget-panel,
.rsl-a11y-widget-panel * {
    text-align: initial !important;
}

.rsl-a11y-toggle {
    text-align: center !important;
}

/* ==========================================================================
   Text-to-Speech Styles
   ========================================================================== */

.rsl-a11y-tts-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rsl-a11y-tts-toggle-row {
    display: flex;
    justify-content: center;
}

.rsl-a11y-tts-main-toggle {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

.rsl-a11y-tts-controls {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: var(--rsl-a11y-toggle-bg);
    border-radius: 12px;
    border: 1px solid var(--rsl-a11y-panel-border);
}

.rsl-a11y-tts-controls.active {
    display: flex;
}

.rsl-a11y-tts-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.rsl-a11y-tts-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 2px solid var(--rsl-a11y-panel-border);
    border-radius: 50%;
    background: var(--rsl-a11y-panel-bg);
    color: var(--rsl-a11y-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.rsl-a11y-tts-btn:hover:not(:disabled) {
    background: var(--rsl-a11y-primary);
    border-color: var(--rsl-a11y-primary);
    color: var(--rsl-a11y-header-text);
    transform: scale(1.05);
}

.rsl-a11y-tts-btn:focus {
    outline: 2px solid var(--rsl-a11y-primary);
    outline-offset: 2px;
}

.rsl-a11y-tts-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rsl-a11y-tts-btn.active {
    background: var(--rsl-a11y-toggle-gradient);
    border-color: transparent;
    color: var(--rsl-a11y-header-text);
}

.rsl-a11y-tts-speed {
    margin-top: 4px;
}

.rsl-a11y-tts-speed .rsl-a11y-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rsl-a11y-speed-label {
    font-size: 0.75rem;
    color: var(--rsl-a11y-text-muted);
    min-width: 30px;
    text-align: center;
}

.rsl-a11y-tts-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 10px;
    font-size: 0.8rem;
    color: var(--rsl-a11y-text-muted);
    background: rgba(102, 126, 234, 0.08);
    border-radius: 8px;
    text-align: center;
}

.rsl-a11y-tts-hint svg {
    flex-shrink: 0;
    color: var(--rsl-a11y-primary);
}

/* TTS Reading Highlight - applied to element being read */
.rsl-a11y-tts-reading {
    background-color: rgba(102, 126, 234, 0.15) !important;
    outline: 2px solid var(--rsl-a11y-primary) !important;
    outline-offset: 2px !important;
    border-radius: 4px !important;
    animation: rsl-a11y-tts-pulse 1.5s ease-in-out infinite !important;
}

@keyframes rsl-a11y-tts-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0);
    }
}

/* TTS Enabled cursor style - show speaker icon when hovering readable content */
html.rsl-a11y-tts-enabled p,
html.rsl-a11y-tts-enabled h1,
html.rsl-a11y-tts-enabled h2,
html.rsl-a11y-tts-enabled h3,
html.rsl-a11y-tts-enabled h4,
html.rsl-a11y-tts-enabled h5,
html.rsl-a11y-tts-enabled h6,
html.rsl-a11y-tts-enabled li,
html.rsl-a11y-tts-enabled td,
html.rsl-a11y-tts-enabled th,
html.rsl-a11y-tts-enabled blockquote,
html.rsl-a11y-tts-enabled label {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23667eea' d='M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z'/%3E%3C/svg%3E") 12 12, pointer;
}

/* Don't apply TTS cursor to widget itself */
html.rsl-a11y-tts-enabled .rsl-a11y-widget-panel,
html.rsl-a11y-tts-enabled .rsl-a11y-widget-panel * {
    cursor: default;
}

html.rsl-a11y-tts-enabled .rsl-a11y-widget-panel button,
html.rsl-a11y-tts-enabled .rsl-a11y-widget-panel input,
html.rsl-a11y-tts-enabled .rsl-a11y-widget-panel select {
    cursor: pointer;
}

/* Dark mode TTS adjustments */
[data-theme="dark"] .rsl-a11y-tts-hint {
    background: rgba(102, 126, 234, 0.12);
}

[data-theme="dark"] .rsl-a11y-tts-reading {
    background-color: rgba(102, 126, 234, 0.25) !important;
}

/* ==========================================================================
   Page Zoom Styles
   ========================================================================== */

.rsl-a11y-zoom-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    justify-content: center;
}

.rsl-a11y-zoom-preset {
    padding: 6px 12px;
    border: 1px solid var(--rsl-a11y-panel-border);
    border-radius: 6px;
    background: var(--rsl-a11y-panel-bg);
    color: var(--rsl-a11y-text);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rsl-a11y-zoom-preset:hover {
    background: var(--rsl-a11y-hover-bg);
    border-color: var(--rsl-a11y-primary);
}

.rsl-a11y-zoom-preset:focus {
    outline: 2px solid var(--rsl-a11y-primary);
    outline-offset: 2px;
}

.rsl-a11y-zoom-preset.active {
    background: var(--rsl-a11y-toggle-gradient);
    color: var(--rsl-a11y-header-text);
    border-color: transparent;
}

.rsl-a11y-btn-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--rsl-a11y-panel-border);
    border-radius: 6px;
    background: var(--rsl-a11y-panel-bg);
    color: var(--rsl-a11y-text);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.rsl-a11y-btn-small:hover {
    background: var(--rsl-a11y-primary);
    color: var(--rsl-a11y-header-text);
    border-color: var(--rsl-a11y-primary);
}

.rsl-a11y-btn-small:focus {
    outline: 2px solid var(--rsl-a11y-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 400px) {
    .rsl-a11y-widget-panel {
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        bottom: 85px;
    }

    .rsl-a11y-widget-button {
        left: 15px;
        bottom: 15px;
        width: 50px;
        height: 50px;
    }

    .rsl-a11y-toggle-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .rsl-a11y-toggle {
        padding: 12px 8px;
    }

    .rsl-a11y-toggle-icon svg {
        width: 20px;
        height: 20px;
    }

    .rsl-a11y-toggle-label {
        font-size: 0.7rem;
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .rsl-a11y-widget-button,
    .rsl-a11y-widget-panel,
    .rsl-a11y-toggle,
    .rsl-a11y-btn,
    .rsl-a11y-slider::-webkit-slider-thumb,
    .rsl-a11y-reading-guide,
    .rsl-a11y-reading-mask,
    .rsl-a11y-saved-indicator,
    .rsl-a11y-toast {
        transition: none;
    }
}

/* ==========================================================================
   Print Styles - Hide Widget
   ========================================================================== */

@media print {
    .rsl-a11y-widget-button,
    .rsl-a11y-widget-panel,
    .rsl-a11y-reading-guide,
    .rsl-a11y-reading-mask {
        display: none !important;
    }
}
