/* =====================================================
   מערכת נגישות - קול האזרח
   תואם תקנות נגישות ישראליות ו-WCAG 2.1 AA
   ===================================================== */

/* ================== כפתור נגישות צף ================== */
.accessibility-toggle {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    color: white;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s ease;
}

.accessibility-toggle:hover,
.accessibility-toggle:focus {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    outline: 3px solid #ffc107;
    outline-offset: 3px;
}

/* ================== פאנל נגישות ================== */
.accessibility-panel {
    position: fixed;
    left: 20px;
    bottom: 90px;
    width: 320px;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 99998;
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.accessibility-panel.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.accessibility-panel-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0056b3 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.accessibility-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.accessibility-close:hover,
.accessibility-close:focus {
    opacity: 1;
}

.accessibility-panel-body {
    padding: 15px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.accessibility-section {
    margin-bottom: 20px;
}

.accessibility-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e9ecef;
}

.accessibility-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.accessibility-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.accessibility-btn:hover,
.accessibility-btn:focus {
    background: #e9ecef;
    border-color: #0d6efd;
    outline: none;
}

.accessibility-btn.active {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

.accessibility-btn i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.accessibility-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

.accessibility-btn-full {
    grid-column: span 2;
}

/* כפתורי גודל טקסט */
.font-size-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.font-size-btn {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.font-size-btn:hover,
.font-size-btn:focus {
    background: #e9ecef;
    border-color: #0d6efd;
}

/* כפתור איפוס */
.accessibility-reset {
    width: 100%;
    padding: 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    margin-top: 10px;
}

.accessibility-reset:hover,
.accessibility-reset:focus {
    background: #c82333;
}

/* קישור להצהרת נגישות */
.accessibility-statement-link {
    display: block;
    text-align: center;
    padding: 10px;
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.85rem;
    border-top: 1px solid #e9ecef;
    margin-top: 10px;
}

.accessibility-statement-link:hover {
    text-decoration: underline;
}

/* ================== מצבי נגישות ================== */

/* הגדלת טקסט */
body.acc-font-size-1 { font-size: 110% !important; }
body.acc-font-size-2 { font-size: 120% !important; }
body.acc-font-size-3 { font-size: 130% !important; }
body.acc-font-size-4 { font-size: 140% !important; }
body.acc-font-size-5 { font-size: 150% !important; }

body.acc-font-size-1 *,
body.acc-font-size-2 *,
body.acc-font-size-3 *,
body.acc-font-size-4 *,
body.acc-font-size-5 * {
    font-size: inherit !important;
    line-height: 1.6 !important;
}

/* ניגודיות גבוהה */
body.acc-high-contrast {
    filter: contrast(1.3) !important;
}

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

/* גווני אפור */
body.acc-grayscale {
    filter: grayscale(100%) !important;
}

/* ניגודיות הפוכה */
body.acc-invert {
    filter: invert(100%) hue-rotate(180deg) !important;
}

body.acc-invert img,
body.acc-invert video {
    filter: invert(100%) hue-rotate(180deg) !important;
}

/* הדגשת קישורים */
body.acc-highlight-links a {
    background-color: #ffff00 !important;
    color: #000 !important;
    padding: 2px 4px !important;
    text-decoration: underline !important;
    font-weight: bold !important;
}

body.acc-highlight-links a:hover,
body.acc-highlight-links a:focus {
    background-color: #0d6efd !important;
    color: #fff !important;
}

/* הדגשת כותרות */
body.acc-highlight-titles h1,
body.acc-highlight-titles h2,
body.acc-highlight-titles h3,
body.acc-highlight-titles h4,
body.acc-highlight-titles h5,
body.acc-highlight-titles h6 {
    background-color: #000 !important;
    color: #ffff00 !important;
    padding: 5px 10px !important;
}

/* גופן קריא */
body.acc-readable-font,
body.acc-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.05em !important;
}

/* מרווח שורות */
body.acc-line-height,
body.acc-line-height * {
    line-height: 2 !important;
}

/* מרווח מילים */
body.acc-word-spacing,
body.acc-word-spacing * {
    word-spacing: 0.3em !important;
}

/* סמן גדול */
body.acc-big-cursor,
body.acc-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='M5 3l14 9-7 2-4 7-3-18z'/%3E%3C/svg%3E"), auto !important;
}

/* עצירת אנימציות */
body.acc-stop-animations,
body.acc-stop-animations * {
    animation: none !important;
    transition: none !important;
}

/* הדגשת פוקוס */
body.acc-focus-highlight *:focus {
    outline: 4px solid #ff6600 !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 0 6px rgba(255, 102, 0, 0.3) !important;
}

/* קו קריאה */
body.acc-reading-line {
    cursor: none;
}

.reading-line {
    position: fixed;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(255, 255, 0, 0.3);
    pointer-events: none;
    z-index: 99990;
    border-top: 2px solid #ff6600;
    border-bottom: 2px solid #ff6600;
    display: none;
}

body.acc-reading-line .reading-line {
    display: block;
}

/* מסכת קריאה */
body.acc-reading-mask::before,
body.acc-reading-mask::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99989;
    pointer-events: none;
}

body.acc-reading-mask::before {
    top: 0;
    height: var(--mask-top, 40%);
}

body.acc-reading-mask::after {
    bottom: 0;
    height: var(--mask-bottom, 40%);
}

/* ================== התאמות למובייל ================== */
@media (max-width: 768px) {
    .accessibility-toggle {
        width: 50px;
        height: 50px;
        font-size: 22px;
        left: 10px;
        bottom: 10px;
    }

    .accessibility-panel {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 70px;
        max-height: 70vh;
    }

    .accessibility-options {
        grid-template-columns: 1fr 1fr;
    }
}

/* ================== דילוג לתוכן ראשי ================== */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #0d6efd;
    color: white;
    padding: 15px 30px;
    text-decoration: none;
    font-weight: bold;
    z-index: 100000;
    border-radius: 0 0 8px 8px;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid #ffc107;
}

/* ================== ARIA והתאמות כלליות ================== */
[role="button"] {
    cursor: pointer;
}

/* ודא שכל האלמנטים האינטראקטיביים ניתנים לפוקוס */
a, button, input, select, textarea, [tabindex]:not([tabindex="-1"]) {
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #0d6efd;
}

/* ודא קונטרסט מינימלי */
.visually-hidden {
    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;
}
