/* Enhanced WCAG Accessibility Plugin - zilli 20250723 */ 
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif; 
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    background-color: #ffffff; 
}

.demo-content {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px;
}

h1, h2, h3 {
    color: #2c3e50;
}

.demo-section {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.demo-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
    font-size: 16px;
}

.demo-button:hover {
    background: #2980b9;
}

/* Main widget styles */
/* Page wrapper: receives CSS filter classes instead of body, so that
   filters don't create a new stacking context that breaks position:fixed on the widget */
#wcag-page-wrapper {
    min-height: 100%;
}

.wcag-accessibility-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: Arial, sans-serif;
}

.wcag-toggle-btn {
    background: #005fcc;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcag-toggle-btn:hover {
    background: #0047a3;
    transform: scale(1.1);
}

.wcag-toggle-btn:focus {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

.wcag-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    padding: 20px;
    display: none;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
}

.wcag-panel.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.wcag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.wcag-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
}

.wcag-language-toggle {
    background: #ecf0f1;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    color: #34495e;
    transition: all 0.2s ease;
}

.wcag-language-toggle:hover {
    background: #3498db;
    color: white;
}

/* Control groups */
.wcag-control-group {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.wcag-control-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: bold;
    color: #34495e;
    font-size: 14px;
}

/* Arrow controls */
.wcag-arrow-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
}

.wcag-arrow-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wcag-arrow-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.wcag-arrow-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.wcag-arrow-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.wcag-control-label {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
    text-align: center;
    flex: 1;
    margin: 0 10px;
}

/* Toggle grid */
.wcag-toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.wcag-toggle-grid.three-cols {
    grid-template-columns: 1fr 1fr 1fr;
}

.wcag-toggle-btn-option {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 12px;
    color: #495057;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 65px;
}

.wcag-toggle-btn-option:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateY(-1px);
}

.wcag-toggle-btn-option.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.wcag-toggle-btn-option:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.wcag-toggle-icon {
    font-size: 16px;
    margin-bottom: 2px;
}

/* Color palette */
.wcag-color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.wcag-color-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.wcag-color-option:hover {
    transform: scale(1.1);
    border-color: #3498db;
}

.wcag-color-option.active {
    border-color: #2c3e50;
    border-width: 3px;
}

.wcag-color-option.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

/* Preset buttons */
.wcag-preset-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.wcag-preset-btn {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 12px;
    color: #495057;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 65px;
    flex: 1;
    min-width: 0;
}

.wcag-preset-btn:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateY(-1px);
}

.wcag-preset-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* Reset and action buttons */
.wcag-reset-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    margin: 10px 0;
    width: 100%;
    transition: all 0.2s ease;
}

.wcag-reset-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.wcag-action-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.wcag-action-btn {
    flex: 1;
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.wcag-action-btn:hover {
    background: #7f8c8d;
}

/* Slider control */
.wcag-slider-control {
    margin: 10px 0;
}

.wcag-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    appearance: none;
    margin: 8px 0;
}

.wcag-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.wcag-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Accessibility features */
.wcag-high-contrast {
    filter: contrast(150%) brightness(1.2) !important;
}

.wcag-grayscale {
    filter: grayscale(100%) !important;
}

.wcag-invert-colors {
    filter: invert(1) hue-rotate(180deg) !important;
}

.wcag-sepia {
    filter: sepia(100%) !important;
}

.wcag-protanopia {
    filter: url('#protanopia-filter') !important;
}

.wcag-deuteranopia {
    filter: url('#deuteranopia-filter') !important;
}

.wcag-tritanopia {
    filter: url('#tritanopia-filter') !important;
}

.wcag-monochromacy {
    filter: grayscale(100%) contrast(120%) !important;
}

/* Color vision deficiency filters */
.wcag-color-red-blind {
    filter: url('#protanopia-filter') !important;
}

.wcag-color-green-blind {
    filter: url('#deuteranopia-filter') !important;
}

.wcag-color-blue-blind {
    filter: url('#tritanopia-filter') !important;
}

/* Custom color themes */
.wcag-dark-theme {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
}

.wcag-dark-theme * {
    background-color: #2d2d2d !important;
    color: #ffffff !important;
    border-color: #444444 !important;
}

.wcag-yellow-black {
    background-color: #000000 !important;
    color: #ffff00 !important;
}

.wcag-yellow-black * {
    background-color: #000000 !important;
    color: #ffff00 !important;
}

.wcag-blue-white {
    background-color: #0066cc !important;
    color: #ffffff !important;
}

.wcag-blue-white * {
    background-color: #0066cc !important;
    color: #ffffff !important;
}

.wcag-green-white {
    background-color: #006600 !important;
    color: #ffffff !important;
}

.wcag-green-white * {
    background-color: #006600 !important;
    color: #ffffff !important;
}

/* Reading features */
.wcag-reading-guide {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    z-index: 9999;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.wcag-reading-guide.active {
    display: block;
}

.wcag-reading-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
    pointer-events: none;
    display: none;
}

.wcag-reading-mask.active {
    display: block;
}

.wcag-reading-window {
    position: absolute;
    left: 0;
    right: 0;
    height: 100px;
    background: transparent;
    box-shadow: 0 0 0 50px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Focus enhancement */
.wcag-focus-highlight {
    outline: 4px solid #e74c3c !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5) !important;
}

/* Text sizing */
.wcag-text-zoom-tiny { font-size: 0.7em !important; }
.wcag-text-zoom-small { font-size: 0.85em !important; }
.wcag-text-zoom-normal { font-size: 1em !important; }
.wcag-text-zoom-large { font-size: 1.2em !important; }
.wcag-text-zoom-xlarge { font-size: 1.5em !important; }
.wcag-text-zoom-xxlarge { font-size: 2em !important; }
.wcag-text-zoom-huge { font-size: 2.5em !important; }

/* Line height */
.wcag-line-height-tight { line-height: 1.2 !important; }
.wcag-line-height-normal { line-height: 1.4 !important; }
.wcag-line-height-relaxed { line-height: 1.8 !important; }
.wcag-line-height-loose { line-height: 2.2 !important; }
.wcag-line-height-extra-loose { line-height: 2.8 !important; }

/* Letter spacing */
.wcag-letter-spacing-tight { letter-spacing: -0.05em !important; }
.wcag-letter-spacing-normal { letter-spacing: normal !important; }
.wcag-letter-spacing-wide { letter-spacing: 0.1em !important; }
.wcag-letter-spacing-wider { letter-spacing: 0.2em !important; }
.wcag-letter-spacing-widest { letter-spacing: 0.3em !important; }

/* Word spacing */
.wcag-word-spacing-tight { word-spacing: -0.1em !important; }
.wcag-word-spacing-normal { word-spacing: normal !important; }
.wcag-word-spacing-wide { word-spacing: 0.2em !important; }
.wcag-word-spacing-wider { word-spacing: 0.4em !important; }

/* Link highlighting */
.wcag-highlight-links a {
    background: #fff3cd !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    text-decoration: underline !important;
    color: #856404 !important;
    font-weight: bold !important;
    border: 2px solid #ffeaa7 !important;
}

/* Heading highlighting */
.wcag-highlight-headings h1,
.wcag-highlight-headings h2,
.wcag-highlight-headings h3,
.wcag-highlight-headings h4,
.wcag-highlight-headings h5,
.wcag-highlight-headings h6 {
    background: #e8f4f8 !important;
    padding: 8px 12px !important;
    border-left: 5px solid #3498db !important;
    margin: 15px 0 !important;
    border-radius: 0 5px 5px 0 !important;
}

/* Image highlighting */
.wcag-highlight-images img {
    border: 3px solid #f39c12 !important;
    border-radius: 5px !important;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.3) !important;
}

/* Animation controls */
.wcag-no-animations,
.wcag-no-animations * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

.wcag-slow-animations,
.wcag-slow-animations * {
    animation-duration: 3s !important;
    transition-duration: 1s !important;
}

/* Cursor styles */
.wcag-big-cursor,
.wcag-big-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M2 2 L2 14 L6 10 L12 16 L16 12 L10 6 L14 2 Z" fill="black" stroke="white" stroke-width="2"/></svg>'), auto !important;
}

.wcag-white-cursor,
.wcag-white-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M2 2 L2 12 L5 9 L10 14 L12 12 L7 7 L10 2 Z" fill="white" stroke="black" stroke-width="2"/></svg>'), auto !important;
}

.wcag-black-cursor,
.wcag-black-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M2 2 L2 12 L5 9 L10 14 L12 12 L7 7 L10 2 Z" fill="black" stroke="white" stroke-width="2"/></svg>'), auto !important;
}

/* Font family changes */
.wcag-font-dyslexic,
.wcag-font-dyslexic * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive !important;
}

.wcag-font-readable,
.wcag-font-readable * {
    font-family: 'Verdana', 'Arial', sans-serif !important;
}

.wcag-font-serif,
.wcag-font-serif * {
    font-family: 'Georgia', 'Times New Roman', serif !important;
}

/* Page structure highlighting */
.wcag-highlight-structure main {
    outline: 3px solid #27ae60 !important;
    outline-offset: 5px !important;
}

.wcag-highlight-structure nav {
    outline: 3px solid #3498db !important;
    outline-offset: 5px !important;
}

.wcag-highlight-structure aside {
    outline: 3px solid #f39c12 !important;
    outline-offset: 5px !important;
}

.wcag-highlight-structure footer {
    outline: 3px solid #9b59b6 !important;
    outline-offset: 5px !important;
}

/* Text alignment */
.wcag-text-left { text-align: left !important; }
.wcag-text-center { text-align: center !important; }
.wcag-text-right { text-align: right !important; }
.wcag-text-justify { text-align: justify !important; }

/* Saturation control */
.wcag-saturation-0 { filter: saturate(0%) !important; }
.wcag-saturation-50 { filter: saturate(50%) !important; }
.wcag-saturation-75 { filter: saturate(75%) !important; }
.wcag-saturation-100 { filter: saturate(100%) !important; }
.wcag-saturation-125 { filter: saturate(125%) !important; }
.wcag-saturation-150 { filter: saturate(150%) !important; }
.wcag-saturation-200 { filter: saturate(200%) !important; }

/* Brightness control */
.wcag-brightness-50 { filter: brightness(50%) !important; }
.wcag-brightness-75 { filter: brightness(75%) !important; }
.wcag-brightness-100 { filter: brightness(100%) !important; }
.wcag-brightness-125 { filter: brightness(125%) !important; }
.wcag-brightness-150 { filter: brightness(150%) !important; }
.wcag-brightness-200 { filter: brightness(200%) !important; }

/* Screen reader helper */
.wcag-screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Print styles */
@media print {
    .wcag-accessibility-widget {
        display: none !important;
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .wcag-panel {
        width: 95vw;
        right: 2.5vw;
        max-height: 80vh;
    }
    
    .wcag-toggle-grid {
        grid-template-columns: 1fr;
    }
    
    .wcag-toggle-grid.three-cols {
        grid-template-columns: 1fr 1fr;
    }
    
    .wcag-color-palette {
        grid-template-columns: repeat(3, 1fr);
    }
}