/* ============================================================
   СТИЛИ ДЛЯ МОДУЛЯ ВЕРСИИ ДЛЯ СЛАБОВИДЯЩИХ
   ============================================================ */

/* ----- БАЗОВАЯ ГОРИЗОНТАЛЬНАЯ КНОПКА (вне main-content) ----- */
.accessibility-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    height: 42px;
    border: 2px solid #2ca02c;
    border-radius: 30px;
    background: #fff;
    color: #2ca02c;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    text-decoration: none;
    box-sizing: border-box;
    font-family: inherit;
    pointer-events: auto;
}
.accessibility-btn:hover {
    opacity: 0.9;
}
.accessibility-btn svg {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    flex-shrink: 0;
    overflow: visible;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}
.accessibility-btn svg * {
    stroke: currentColor !important;
    fill: none !important;
}

/* ----- ВЕРТИКАЛЬНАЯ КНОПКА-ВКЛАДКА (справа) ----- */
.accessibility-btn-vertical {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    width: 45px;
    height: 270px;
    padding: 16px 6px 12px;
    margin: 0;
    background: var(--btn-bg, #1e2a5e);
    color: #fff;
    border: none;
    border-radius: 24px 0 0 24px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.35);
    cursor: pointer;
    transition: all 0.25s ease;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: normal;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    text-decoration: none;
}

/* ИСПРАВЛЕНО: без scale(), только затемнение при наведении */
.accessibility-btn-vertical:hover {
    transform: translateY(-50%);
    filter: brightness(0.85);
    box-shadow: 0 12px 36px rgba(0,0,0,0.45);
}
.accessibility-btn-vertical:active {
    transform: translateY(-50%);
    filter: brightness(0.7);
}

.accessibility-btn-vertical .label {
    transform: rotate(-90deg);
    transform-origin: center center;
    white-space: nowrap;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    color: #fff;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
.accessibility-btn-vertical .eye {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    transform: rotate(90deg);
    flex-shrink: 0;
    margin-top: auto;
    margin-bottom: 0;
    opacity: 0.95;
    transition: opacity 0.2s;
    box-sizing: border-box;
}
/* ИСПРАВЛЕНО: иконка глаза видна (убраны stroke и stroke-width) */
.accessibility-btn-vertical .eye svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.accessibility-btn-vertical:hover .eye {
    opacity: 1;
}

/* ----- ОБЁРТКИ ----- */
.visually-impaired-btn-wrapper-fixed-right { position: static; }
.visually-impaired-btn-wrapper-fixed-top {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}
.visually-impaired-btn-wrapper-fixed-bottom {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}
.visually-impaired-btn-inline { display: inline-block; }

/* ============================================================
   ПАНЕЛЬ НАСТРОЕК (вне main-content)
   ============================================================ */
.a11y-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    background: transparent;
}
.a11y-modal.active {
    opacity: 1;
    pointer-events: auto;
}
.a11y-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 0;
}
.a11y-modal-dialog {
    position: relative;
    background: #fffefb;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px 20px;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    gap: 18px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #000;
    box-sizing: border-box;
    z-index: 1;
}
.a11y-modal.active .a11y-modal-dialog {
    transform: scale(1) translateY(0);
}
.a11y-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    outline: none;
    font-family: Arial, sans-serif;
    line-height: 1;
}
.a11y-modal-close:hover,
.a11y-modal-close:focus-visible {
    background: #f0f0f0;
    color: #000;
}

.a11y-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: Arial, sans-serif;
    color: #000;
    font-size: 16px;
    line-height: 1.4;
}
.a11y-panel * {
    box-sizing: border-box;
    font-family: inherit;
}
.panel-header h3 {
    margin: 0 0 4px;
    font-size: 1.2rem;
    color: #2c3e50;
    font-weight: bold;
}
.toggle-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.toggle-item {
    flex: 1 1 180px;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #000;
}
.toggle-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    margin: 0;
    cursor: pointer;
    color: #000;
}
.toggle-item .switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}
.toggle-item .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-item .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 22px;
}
.toggle-item .slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.toggle-item input:checked + .slider {
    background-color: #2c3e50;
}
.toggle-item input:checked + .slider:before {
    transform: translateX(22px);
}
.image-on-icon, .image-off-icon { font-size: 1.1rem; }
.toggle-item.image-hidden .image-on-icon { display: none; }
.toggle-item.image-hidden .image-off-icon { display: inline; }
.toggle-item:not(.image-hidden) .image-off-icon { display: none; }

.font-size-row {
    display: flex;
    gap: 6px;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 6px;
    justify-content: space-between;
}
.font-size-btn {
    flex: 1;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
    outline: none;
    min-width: 40px;
}
.font-size-btn.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    color: #2c3e50;
}
.font-size-btn:hover:not(.active),
.font-size-btn:focus-visible:not(.active) {
    background: rgba(255,255,255,0.7);
}

.spacing-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.spacing-item {
    flex: 1 1 150px;
}
.spacing-item h4 {
    margin: 0 0 4px;
    font-size: 0.9rem;
    color: #2c3e50;
}
.spacing-slider {
    width: 100%;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
}
.spacing-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #2c3e50;
    border-radius: 50%;
    cursor: pointer;
}
.spacing-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #888;
    margin-top: 2px;
}

.color-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.color-scheme-btn {
    flex: 1 1 80px;
    padding: 8px 4px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: #f5f5f5;
    color: #333;
    outline: none;
}
.color-scheme-btn.active {
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44,62,80,0.2);
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    outline: none;
    margin-top: 4px;
    font-size: 16px;
}
.reset-btn:hover,
.reset-btn:focus-visible {
    background: #34495e;
}

.accessibility-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

/* ============================================================
   СТИЛИ ДЛЯ ИЗОБРАЖЕНИЙ (внутри main-content)
   ============================================================ */
.image-overlay-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.image-overlay {
    position: absolute;
    inset: 0;
    background: #e7e7e7;
    border: 2px dashed #999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 16px;
    text-align: center;
    z-index: 10;
    word-break: break-word;
    padding: 4px;
    line-height: 1.3;
    overflow: auto;
}

/* ============================================================
   ЦВЕТОВЫЕ СХЕМЫ – ТОЛЬКО ДЛЯ #main-content
   ============================================================ */
#main-content {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
#main-content img,
#main-content svg,
#main-content video,
#main-content canvas {
    max-width: 100%;
    height: auto;
}

#main-content.inverted-scheme,
#main-content.inverted-scheme * {
    background: #222 !important;
    color: #fff !important;
    border-color: #444 !important;
    background-image: none !important;
}
#main-content.blue-scheme,
#main-content.blue-scheme * {
    background: #9dd1ff !important;
    color: #000080 !important;
    border-color: #7ab8ef !important;
    background-image: none !important;
}
#main-content.dark-scheme,
#main-content.dark-scheme * {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
    background-image: none !important;
}
#main-content.high-contrast-scheme,
#main-content.high-contrast-scheme * {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
    background-image: none !important;
}
#main-content.yellow-black-scheme,
#main-content.yellow-black-scheme * {
    background: #ffff00 !important;
    color: #000000 !important;
    border-color: #000000 !important;
    background-image: none !important;
}

/* Адаптивность */
@media (max-width: 600px) {
    .a11y-modal-dialog { width: 95%; padding: 20px 16px; }
    .toggle-row { flex-direction: column; }
    .accessibility-btn-vertical {
        width: 40px;
        height: 240px;
        padding: 12px 4px 8px;
        border-radius: 18px 0 0 18px;
    }
    .accessibility-btn-vertical .label { font-size: 10px; letter-spacing: 0.04em; }
    .accessibility-btn-vertical .eye { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .accessibility-btn-vertical { transition: none; }
    .accessibility-btn-vertical:hover { transform: translateY(-50%); }
}