/* Base styles */
:root {
    --a4wp-font-size-base: 16px;
    --a4wp-line-height-base: 1.5;
    --a4wp-letter-spacing-base: 0;
    --a4wp-contrast-normal: #333;
    --a4wp-contrast-bg: #fff;
    --a4wp-contrast-accent: #007bff;
    --a4wp-font-family-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --a4wp-focus-outline: 2px solid #007bff;
    --a4wp-focus-offset: 2px;
}

/* Accessibility Widget Styles */
.a4wp-accessibility-widget {
    position: fixed;
    z-index: 99999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Position will be set dynamically via inline styles */
}

.a4wp-widget-toggle {
    width: 60px;
    height: 60px;
    background: var(--a4wp-contrast-accent);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.a4wp-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.a4wp-widget-toggle:focus {
    outline: var(--a4wp-focus-outline);
    outline-offset: var(--a4wp-focus-offset);
}

.a4wp-widget-toggle svg {
    width: 30px;
    height: 30px;
}

.a4wp-widget-panel {
    position: absolute;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.a4wp-widget-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Position from bottom (icon in bottom half) */
.a4wp-widget-panel.open-upward {
    bottom: 80px;
}

/* Position from top (icon in top half) */
.a4wp-widget-panel.open-downward {
    top: 80px;
    transform: translateY(-20px);
}

.a4wp-widget-panel.open-downward.active {
    transform: translateY(0);
}

/* Position centered (icon in middle) */
.a4wp-widget-panel.open-centered {
    top: 50%;
    transform: translateY(-50%);
}

.a4wp-widget-panel.open-centered.active {
    transform: translateY(-50%);
}

/* Horizontal alignment */
.a4wp-widget-panel.align-right {
    right: 0;
}

.a4wp-widget-panel.align-left {
    left: 0;
}

.a4wp-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.a4wp-widget-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--a4wp-contrast-normal);
    margin: 0;
}

.a4wp-widget-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a4wp-widget-close:hover {
    color: var(--a4wp-contrast-normal);
}

.a4wp-widget-close svg {
    width: 20px;
    height: 20px;
}

.a4wp-widget-section {
    margin-bottom: 1.5rem;
}

.a4wp-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--a4wp-contrast-normal);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.a4wp-section-title svg {
    width: 20px;
    height: 20px;
    color: var(--a4wp-contrast-accent);
}

.a4wp-option-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.a4wp-option-btn {
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    color: var(--a4wp-contrast-normal);
}

.a4wp-option-btn:hover {
    background: #e8e8e8;
}

.a4wp-option-btn.active {
    background: var(--a4wp-contrast-accent);
    color: white;
    border-color: var(--a4wp-contrast-accent);
}

.a4wp-option-btn:focus {
    outline: var(--a4wp-focus-outline);
    outline-offset: var(--a4wp-focus-offset);
}

.a4wp-slider-container {
    margin-top: 0.75rem;
}

.a4wp-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.a4wp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--a4wp-contrast-accent);
    cursor: pointer;
    transition: all 0.3s ease;
}

.a4wp-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.a4wp-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--a4wp-contrast-accent);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.a4wp-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.a4wp-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #666;
}

.a4wp-toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    justify-content: space-between;
}

.a4wp-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.a4wp-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

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

.a4wp-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .a4wp-switch-slider {
    background-color: var(--a4wp-contrast-accent);
}

input:checked + .a4wp-switch-slider:before {
    transform: translateX(26px);
}

.a4wp-reset-btn {
    width: 100%;
    padding: 0.75rem;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.a4wp-reset-btn:hover {
    background: #d32f2f;
}

.a4wp-reset-btn:focus {
    outline: var(--a4wp-focus-outline);
    outline-offset: var(--a4wp-focus-offset);
}

.a4wp-reset-btn svg {
    width: 20px;
    height: 20px;
}

/* High contrast mode */
body.a4wp-high-contrast {
    --a4wp-contrast-normal: #000;
    --a4wp-contrast-bg: #fff;
    --a4wp-contrast-accent: #0056b3;
}

body.a4wp-high-contrast * {
    color: var(--a4wp-contrast-normal) !important;
    background-color: var(--a4wp-contrast-bg) !important;
    border-color: #000 !important;
}

body.a4wp-high-contrast a,
body.a4wp-high-contrast button {
    text-decoration: underline !important;
    font-weight: bold !important;
}

/* Dark mode */
body.a4wp-dark-mode {
    --a4wp-contrast-normal: #e0e0e0;
    --a4wp-contrast-bg: #1a1a1a;
    --a4wp-contrast-accent: #4dabf7;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.a4wp-dark-mode .a4wp-widget-panel {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.a4wp-dark-mode .a4wp-widget-title,
body.a4wp-dark-mode .a4wp-section-title {
    color: #e0e0e0;
}

body.a4wp-dark-mode .a4wp-option-btn {
    background: #3a3a3a;
    color: #e0e0e0;
}

body.a4wp-dark-mode .a4wp-option-btn:hover {
    background: #4a4a4a;
}

/* Dyslexia font */
body.a4wp-dyslexia-font,
body.a4wp-dyslexia-font * {
    font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

/* Link highlighting */
body.a4wp-highlight-links a {
    background: yellow !important;
    color: black !important;
    padding: 2px 4px !important;
    border-radius: 2px !important;
    text-decoration: underline !important;
}

/* Focus indicators */
body.a4wp-enhanced-focus *:focus {
    outline: 3px solid #ff6b6b !important;
    outline-offset: 3px !important;
}

/* Responsive */
@media (max-width: 480px) {
    .a4wp-widget-panel {
        width: 280px;
    }
}

/* Font size adjustments */
body.a4wp-font-small {
    font-size: 14px;
}

body.a4wp-font-medium {
    font-size: 16px;
}

body.a4wp-font-large {
    font-size: 20px;
}

body.a4wp-font-xlarge {
    font-size: 24px;
}

/* OpenDyslexic Font */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/ttf/OpenDyslexic-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
