/**
 * AccessiShop - Accessibility Widget Styles
 * @author KundaliWeb
 */

/* Widget trigger button */
.accessishop-widget-trigger {
    position: fixed;
    z-index: 999999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 28px;
    line-height: 1;
    color: #fff;
    padding: 0;
}

.accessishop-widget-trigger:hover,
.accessishop-widget-trigger:focus {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.accessishop-widget-trigger:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Positions */
.accessishop-widget-trigger.bottom-right { bottom: 20px; right: 20px; }
.accessishop-widget-trigger.bottom-left { bottom: 20px; left: 20px; }
.accessishop-widget-trigger.top-right { top: 20px; right: 20px; }
.accessishop-widget-trigger.top-left { top: 20px; left: 20px; }

/* Panel */
.accessishop-panel {
    position: fixed;
    z-index: 999998;
    width: 340px;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.accessishop-panel.is-open {
    display: flex;
}

/* Panel positions */
.accessishop-panel.bottom-right { bottom: 90px; right: 20px; }
.accessishop-panel.bottom-left { bottom: 90px; left: 20px; }
.accessishop-panel.top-right { top: 90px; right: 20px; }
.accessishop-panel.top-left { top: 90px; left: 20px; }

/* Panel header */
.accessishop-panel-header {
    padding: 16px 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.accessishop-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.accessishop-panel-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.accessishop-panel-close:hover,
.accessishop-panel-close:focus {
    background: rgba(255, 255, 255, 0.2);
    outline: 2px solid #fff;
}

/* Reset button */
.accessishop-reset-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 8px;
}

.accessishop-reset-btn:hover,
.accessishop-reset-btn:focus {
    background: rgba(255, 255, 255, 0.3);
}

/* Panel body */
.accessishop-panel-body {
    padding: 12px 16px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

/* Feature toggle */
.accessishop-feature {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid #eee;
}

.accessishop-feature:last-child {
    border-bottom: none;
}

.accessishop-feature-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333;
    flex: 1;
}

.accessishop-feature-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.accessishop-feature-text {
    line-height: 1.3;
}

/* Toggle switch */
.accessishop-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.accessishop-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.accessishop-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 24px;
    transition: background-color 0.2s;
}

.accessishop-toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.accessishop-toggle input:checked + .accessishop-toggle-slider {
    background-color: #2196F3;
}

.accessishop-toggle input:checked + .accessishop-toggle-slider::before {
    transform: translateX(20px);
}

.accessishop-toggle input:focus-visible + .accessishop-toggle-slider {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
}

/* Text size controls */
.accessishop-text-controls {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.accessishop-text-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #ccc;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.accessishop-text-btn:hover,
.accessishop-text-btn:focus {
    border-color: #2196F3;
    color: #2196F3;
}

.accessishop-text-btn.active {
    background: #2196F3;
    border-color: #2196F3;
    color: #fff;
}

/* ===== Text size buttons - fix overflow ===== */
.accessishop-text-btn {
    min-width: 38px;
    width: auto;
    padding: 0 6px;
    font-size: 12px;
    white-space: nowrap;
}

/* ===== Body classes for accessibility features ===== */

/* --- High contrast --- */
body.accessishop-high-contrast {
    background-color: #000 !important;
    color: #fff !important;
}

body.accessishop-high-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

body.accessishop-high-contrast a {
    color: #ff0 !important;
    text-decoration: underline !important;
}

body.accessishop-high-contrast img {
    filter: grayscale(100%) contrast(1.2);
}

/* --- Dyslexia-friendly --- */
body.accessishop-dyslexia,
body.accessishop-dyslexia * {
    font-family: 'Comic Sans MS', 'OpenDyslexic', 'Verdana', sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.15em !important;
}

/* --- Large text (120%) --- */
body.accessishop-large-text {
    font-size: 120% !important;
}

body.accessishop-large-text .accessishop-panel .accessishop-feature-text {
    font-size: 17px !important;
}
body.accessishop-large-text .accessishop-panel-header h3 {
    font-size: 19px !important;
}

/* --- XL text (140%) --- */
body.accessishop-xl-text {
    font-size: 140% !important;
}

body.accessishop-xl-text .accessishop-panel .accessishop-feature-text {
    font-size: 20px !important;
}
body.accessishop-xl-text .accessishop-panel-header h3 {
    font-size: 22px !important;
}

/* --- No animations --- */
body.accessishop-no-animations,
body.accessishop-no-animations * {
    animation: none !important;
    transition: none !important;
}

/* --- Line spacing --- */
body.accessishop-line-spacing-1,
body.accessishop-line-spacing-1 * {
    line-height: 2.0 !important;
}

body.accessishop-line-spacing-2,
body.accessishop-line-spacing-2 * {
    line-height: 2.5 !important;
}

/* --- Letter spacing --- */
body.accessishop-letter-spacing-1,
body.accessishop-letter-spacing-1 * {
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

body.accessishop-letter-spacing-2,
body.accessishop-letter-spacing-2 * {
    letter-spacing: 0.1em !important;
    word-spacing: 0.2em !important;
}

/* --- Reading guide overlay --- */
.accessishop-reading-guide {
    display: none;
    position: fixed;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(255, 235, 59, 0.25);
    border-top: 2px solid rgba(255, 235, 59, 0.6);
    border-bottom: 2px solid rgba(255, 235, 59, 0.6);
    z-index: 999997;
    pointer-events: none;
}

/* --- Highlight links --- */
body.accessishop-highlight-links a {
    text-decoration: underline !important;
    outline: 2px solid currentColor !important;
    outline-offset: 2px !important;
    padding: 2px 4px !important;
}

/* --- Big cursor --- */
body.accessishop-big-cursor,
body.accessishop-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l28 20H20l8 16-4 2-8-16-8 12z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

/* ==========================================================
   WIDGET PROTECTION — reset all body effects on the widget
   These rules MUST come LAST to override everything above.
   ========================================================== */
.accessishop-panel,
.accessishop-panel *,
.accessishop-widget-trigger,
.accessishop-reading-guide {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    line-height: normal !important;
    animation: unset !important;
    cursor: auto !important;
}

.accessishop-panel {
    font-size: 14px !important;
    background: #fff !important;
    color: #333 !important;
    border-color: #eee !important;
}

.accessishop-panel * {
    background-color: transparent !important;
    color: inherit !important;
    border-color: inherit !important;
}

.accessishop-panel .accessishop-panel-header {
    color: #fff !important;
}

.accessishop-panel .accessishop-panel-header,
.accessishop-panel .accessishop-panel-header * {
    color: #fff !important;
}

.accessishop-panel .accessishop-panel-close,
.accessishop-panel .accessishop-reset-btn {
    color: #fff !important;
}

.accessishop-panel .accessishop-feature-label {
    color: #333 !important;
}

.accessishop-panel .accessishop-feature-icon {
    font-size: 20px !important;
}

.accessishop-panel .accessishop-feature-text {
    font-size: 14px !important;
    color: #333 !important;
}

/* High contrast: widget gets white text on dark bg */
body.accessishop-high-contrast .accessishop-panel {
    background: #1a1a1a !important;
    border-color: #555 !important;
}

body.accessishop-high-contrast .accessishop-panel * {
    color: #fff !important;
    border-color: #555 !important;
}

body.accessishop-high-contrast .accessishop-panel .accessishop-feature {
    border-bottom-color: #444 !important;
}

body.accessishop-high-contrast .accessishop-panel .accessishop-toggle-slider {
    background-color: #555 !important;
}

body.accessishop-high-contrast .accessishop-panel input:checked + .accessishop-toggle-slider {
    background-color: #2196F3 !important;
}

body.accessishop-high-contrast .accessishop-panel .accessishop-toggle-slider::before {
    background-color: #fff !important;
}

body.accessishop-high-contrast .accessishop-text-btn {
    background: #333 !important;
    color: #fff !important;
    border-color: #666 !important;
}

body.accessishop-high-contrast .accessishop-text-btn.active {
    background: #2196F3 !important;
    color: #fff !important;
    border-color: #2196F3 !important;
}

.accessishop-panel .accessishop-toggle-slider {
    background-color: #ccc !important;
}

.accessishop-panel input:checked + .accessishop-toggle-slider {
    background-color: #2196F3 !important;
}

.accessishop-panel .accessishop-toggle-slider::before {
    background-color: #fff !important;
}

.accessishop-panel-header h3 {
    font-size: 16px !important;
}

.accessishop-text-btn {
    font-size: 12px !important;
    min-width: 38px;
    background: #fff !important;
    color: #333 !important;
    border-color: #ccc !important;
}

.accessishop-text-btn.active {
    background: #2196F3 !important;
    color: #fff !important;
    border-color: #2196F3 !important;
}

.accessishop-reset-btn {
    font-size: 12px !important;
}

.accessishop-panel-close {
    font-size: 22px !important;
}

.accessishop-widget-trigger {
    font-size: 28px !important;
    color: #fff !important;
}

.accessishop-panel a {
    color: #2196F3 !important;
    text-decoration: none !important;
    outline: none !important;
    padding: 0 !important;
}

.accessishop-panel img {
    filter: none !important;
}

/* --- Responsive --- */
@media (max-width: 400px) {
    .accessishop-panel {
        width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px !important;
    }
}
