/**
 * Israeli Standard 5568 & WCAG 2.1 AA Accessibility Plugin Styles
 * Comprehensive accessibility solution for websites
 *
 * @version 1.0.0
 * @license MIT
 */

/* ===== Utility Classes ===== */

/* Screen reader only content */
.sr-only,
.a11y-skip-link:not(:focus) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Skip link - WCAG 2.4.1 */
.a11y-skip-link:focus {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 9999999 !important;
    padding: 10px 20px !important;
    background: #000 !important;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
}

/* Live region for screen reader announcements */
#a11y-live-region {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* ===== Accessibility Button ===== */

.a11y-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #007bff;
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
    z-index: 999999;
}

.a11y-button:hover {
    background: #0056b3;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.5);
}

.a11y-button:focus {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

.a11y-button:active {
    transform: scale(0.95);
}

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

/* ===== Accessibility Panel ===== */

.a11y-panel {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 320px;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Hebrew", "Noto Sans Arabic", Arial, sans-serif;
    font-weight: 700;
}

/* Panel Header */
.a11y-panel-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.a11y-panel-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.a11y-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    padding: 0;
}

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

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

/* Panel Content */
.a11y-panel-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.a11y-panel-content::-webkit-scrollbar {
    width: 8px;
}

.a11y-panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.a11y-panel-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.a11y-panel-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Control Groups */
.a11y-control-group {
    margin-bottom: 20px;
}

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

.a11y-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

/* Button Groups */
.a11y-button-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.a11y-control-btn {
    flex: 1;
    min-width: 60px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.a11y-control-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.a11y-control-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.a11y-control-btn:active,
.a11y-control-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: #ffffff;
}

.a11y-value {
    min-width: 60px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #007bff;
}

/* Toggle Buttons */
.a11y-toggle-btn {
    width: 100%;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 700;
    color: #495057;
}

.a11y-toggle-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.a11y-toggle-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.a11y-toggle-btn.active {
    background: #e7f3ff;
    border-color: #007bff;
    color: #007bff;
}

.a11y-toggle-label {
    font-weight: 700;
}

.a11y-toggle-indicator {
    width: 44px;
    height: 24px;
    background: #dee2e6;
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
}

.a11y-toggle-indicator::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.a11y-toggle-btn.active .a11y-toggle-indicator {
    background: #007bff;
}

.a11y-toggle-btn.active .a11y-toggle-indicator::after {
    transform: translateX(20px);
}

/* Select Dropdown */
.a11y-select {
    width: 100%;
    padding: 10px 12px;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.2s;
}

.a11y-select:hover {
    border-color: #adb5bd;
}

.a11y-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Reset Button */
.a11y-reset-btn {
    width: 100%;
    padding: 12px 16px;
    background: #dc3545;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.a11y-reset-btn:hover {
    background: #c82333;
}

.a11y-reset-btn:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

.a11y-reset-btn:active {
    background: #bd2130;
}

/* Statement Link */
.a11y-statement-link {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: #28a745;
    border-radius: 8px;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.2s;
}

.a11y-statement-link:hover {
    background: #218838;
}

.a11y-statement-link:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* ===== Contrast Modes ===== */

/* High Contrast Mode - WCAG 1.4.3 */
.a11y-contrast-high {
    filter: contrast(1.5) !important;
}

.a11y-contrast-high * {
    text-shadow: none !important;
    box-shadow: none !important;
}

/* Inverted Contrast Mode */
.a11y-contrast-inverted {
    filter: invert(1) hue-rotate(180deg) !important;
}

.a11y-contrast-inverted img,
.a11y-contrast-inverted video,
.a11y-contrast-inverted .a11y-button,
.a11y-contrast-inverted .a11y-panel {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* ===== RTL Support (Hebrew/Arabic) ===== */

[dir="rtl"] .a11y-panel {
    direction: rtl;
}

[dir="rtl"] .a11y-button-group {
    flex-direction: row-reverse;
}

[dir="rtl"] .a11y-toggle-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .a11y-toggle-indicator::after {
    left: auto;
    right: 3px;
}

[dir="rtl"] .a11y-toggle-btn.active .a11y-toggle-indicator::after {
    transform: translateX(-20px);
}

/* Hebrew font support */
html[lang="he"] {
    font-family: "Noto Sans Hebrew", Arial, sans-serif;
}

/* Arabic font support */
html[lang="ar"] {
    font-family: "Noto Sans Arabic", Arial, sans-serif;
}

/* ===== Responsive Design ===== */

@media (max-width: 480px) {
    .a11y-panel {
        min-width: 280px;
        max-width: calc(100vw - 40px);
    }

    .a11y-button {
        width: 48px;
        height: 48px;
    }

    .a11y-button svg {
        width: 24px;
        height: 24px;
    }

    .a11y-panel-content {
        padding: 16px;
    }

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

/* ===== Print Styles ===== */

@media print {
    .a11y-button,
    .a11y-panel,
    .a11y-skip-link {
        display: none !important;
    }
}

/* ===== Animation Preferences ===== */

/* Respect user's motion preferences - WCAG 2.3.3 */
@media (prefers-reduced-motion: reduce) {
    .a11y-button,
    .a11y-control-btn,
    .a11y-toggle-btn,
    .a11y-toggle-indicator,
    .a11y-toggle-indicator::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== Focus Visible Support ===== */

/* Enhanced focus indicators - WCAG 2.4.7 */
.a11y-button:focus-visible,
.a11y-control-btn:focus-visible,
.a11y-toggle-btn:focus-visible,
.a11y-select:focus-visible,
.a11y-reset-btn:focus-visible,
.a11y-statement-link:focus-visible,
.a11y-close-btn:focus-visible {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

/* ===== Accessibility Statement Page Styles ===== */

.a11y-statement-page {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Hebrew", "Noto Sans Arabic", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

.a11y-statement-page h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #007bff;
}

.a11y-statement-page h2 {
    font-size: 24px;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #0056b3;
}

.a11y-statement-page h3 {
    font-size: 20px;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #495057;
}

.a11y-statement-page p {
    margin-bottom: 15px;
}

.a11y-statement-page ul,
.a11y-statement-page ol {
    margin-bottom: 15px;
    padding-left: 30px;
}

.a11y-statement-page li {
    margin-bottom: 8px;
}

.a11y-statement-page a {
    color: #007bff;
    text-decoration: underline;
}

.a11y-statement-page a:hover {
    color: #0056b3;
}

.a11y-statement-page a:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

.a11y-statement-contact {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.a11y-statement-contact strong {
    display: block;
    margin-bottom: 10px;
    color: #007bff;
    font-size: 18px;
}

.a11y-statement-standards {
    background: #e7f3ff;
    padding: 20px;
    border-left: 4px solid #007bff;
    margin: 20px 0;
}

.a11y-statement-date {
    font-style: italic;
    color: #6c757d;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

/* RTL Support for Statement Page */
[dir="rtl"] .a11y-statement-page {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .a11y-statement-page ul,
[dir="rtl"] .a11y-statement-page ol {
    padding-left: 0;
    padding-right: 30px;
}

[dir="rtl"] .a11y-statement-standards {
    border-left: none;
    border-right: 4px solid #007bff;
}

/* ===== High Contrast Mode Support ===== */

@media (prefers-contrast: high) {
    .a11y-button {
        border: 2px solid currentColor;
    }

    .a11y-control-btn,
    .a11y-toggle-btn,
    .a11y-select {
        border-width: 3px;
    }
}

/* ===== Dark Mode Support ===== */

@media (prefers-color-scheme: dark) {
    .a11y-panel {
        background: #1a1a1a;
        color: #ffffff;
    }

    .a11y-label,
    .a11y-toggle-label {
        color: #ffffff;
    }

    .a11y-control-btn,
    .a11y-toggle-btn,
    .a11y-select {
        background: #2a2a2a;
        border-color: #444;
        color: #ffffff;
    }

    .a11y-control-btn:hover,
    .a11y-toggle-btn:hover,
    .a11y-select:hover {
        background: #333;
        border-color: #555;
    }

    .a11y-toggle-btn.active {
        background: #1a3a5a;
        border-color: #007bff;
    }

    .a11y-statement-page {
        background: #1a1a1a;
        color: #ffffff;
    }

    .a11y-statement-contact {
        background: #2a2a2a;
    }

    .a11y-statement-standards {
        background: #1a3a5a;
    }
}
