/* Основные стили панели с фиксированными стилями */
.vh-toolbar {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 999999;
    font-family: Arial, sans-serif !important;
    font-size: 16px !important;
}

.vh-toolbar.vh-position-left {
    left: 0;
    right: auto;
}

.vh-toolbar.vh-position-left .vh-toggle-btn {
    border-radius: 0 5px 5px 0;
}

.vh-toolbar.vh-position-left .vh-panel {
    right: auto;
    left: 60px;
}

.vh-toggle-btn {
    background: #0057B8 !important;
    color: white !important;
    border: none !important;
    padding: 15px 10px !important;
    border-radius: 5px 0 0 5px !important;
    cursor: pointer !important;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 16px !important;
    line-height: 1.2 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    font-family: Arial, sans-serif !important;
    min-height: 200px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

.vh-toggle-btn:hover {
    background: #004494 !important;
    transform: translateX(-3px);
}

.vh-icon {
    font-size: 24px !important;
}

.vh-panel {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: white !important;
    border: 3px solid #0057B8 !important;
    border-radius: 10px;
    padding: 20px !important;
    width: 420px;
    max-width: 90vw;
    max-height: 85vh;
    box-shadow: 0 5px 30px rgba(0,0,0,0.35) !important;
    font-family: Arial, sans-serif !important;
    font-size: 16px !important;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #0057B8 #f0f0f0;
}

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

.vh-panel::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.vh-panel::-webkit-scrollbar-thumb {
    background: #0057B8;
    border-radius: 4px;
}

.vh-panel-title {
    color: #0057B8 !important;
    margin: 0 0 20px 0 !important;
    font-size: 1.3em !important;
    text-align: center !important;
    font-family: Arial, sans-serif !important;
    font-weight: 700 !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #0057B8 !important;
}

.vh-control-group {
    margin-bottom: 20px !important;
    font-family: Arial, sans-serif !important;
}

.vh-control-group h4 {
    margin: 0 0 12px 0 !important;
    color: #222222 !important;
    font-size: 1.1em !important;
    font-weight: 700 !important;
    font-family: Arial, sans-serif !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vh-control-group h4::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 18px;
    background: #0057B8 !important;
    border-radius: 2px;
}

.vh-btn {
    background: #ffffff !important;
    border: 2px solid #0057B8 !important;
    color: #0057B8 !important;
    padding: 12px 18px !important;
    margin: 0 8px 8px 0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 1em !important;
    transition: all 0.3s !important;
    font-family: Arial, sans-serif !important;
    min-width: 70px !important;
    text-align: center !important;
    outline: none !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.vh-btn:hover {
    background: #0057B8 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,87,184,0.3) !important;
}

.vh-btn.active {
    background: #0057B8 !important;
    color: white !important;
    border-color: #0057B8 !important;
    box-shadow: 0 0 0 3px rgba(0,87,184,0.3) !important;
}

.vh-btn-reset {
    background: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

.vh-btn-close {
    background: #495057 !important;
    color: white !important;
    border-color: #495057 !important;
}

.vh-btn-speech {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
    font-weight: 700 !important;
}

.vh-btn-speech.active {
    background: #218838 !important;
    border-color: #218838 !important;
}

.vh-btn-speech.stopped {
    background: #6c757d !important;
    border-color: #6c757d !important;
}

.vh-speech-icon {
    font-size: 16px !important;
    margin-right: 8px !important;
}

/* Улучшенные контрастные схемы */
body.vh-contrast-black-white {
    background: #000000 !important;
    color: #ffffff !important;
}

body.vh-contrast-black-white a:not(.vh-btn) {
    color: #66ccff !important;
    text-decoration: underline !important;
}

body.vh-contrast-black-white button:not(.vh-btn),
body.vh-contrast-black-white input:not(.vh-toolbar input) {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
}

body.vh-contrast-blue-yellow {
    background: #000080 !important;
    color: #ffff00 !important;
}

body.vh-contrast-blue-yellow a:not(.vh-btn) {
    color: #ffff99 !important;
    text-decoration: underline !important;
}

body.vh-contrast-yellow-black {
    background: #ffff00 !important;
    color: #000000 !important;
}

body.vh-contrast-yellow-black a:not(.vh-btn) {
    color: #0000ff !important;
    text-decoration: underline !important;
}

body.vh-images-hide img,
body.vh-images-hide picture,
body.vh-images-hide video,
body.vh-images-hide iframe[src*="youtube"],
body.vh-images-hide iframe[src*="vimeo"] {
    display: none !important;
}

body.vh-images-hide .vh-images-hide-replacement {
    display: block !important;
    padding: 10px;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    text-align: center;
    font-style: italic;
}

body.vh-letter-spacing-wide {
    letter-spacing: 0.12em !important;
}

body.vh-line-height-wide {
    line-height: 2.2 !important;
}

/* Стили для выделения читаемого текста */
.vh-reading-highlight {
    background-color: rgba(255, 255, 0, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.3s;
    box-shadow: 0 0 0 3px rgba(255, 255, 0, 0.5);
}

/* Индикатор чтения */
.vh-speech-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0057B8 !important;
    color: white !important;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 100000;
    display: none;
    font-family: Arial, sans-serif !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
    animation: pulse 2s infinite;
    border-left: 4px solid #28a745 !important;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 87, 184, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 87, 184, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 87, 184, 0); }
}

.vh-speech-indicator-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.vh-speech-text {
    font-weight: 700 !important;
    font-size: 1.1em !important;
}

.vh-speech-indicator .vh-btn {
    margin: 0 !important;
    background: rgba(255,255,255,0.3) !important;
    border-color: rgba(255,255,255,0.5) !important;
    color: white !important;
    padding: 6px 12px !important;
    font-size: 0.95em !important;
    font-weight: 700 !important;
}

.vh-speech-indicator .vh-btn:hover {
    background: rgba(255,255,255,0.4) !important;
}

/* Слайдер для скорости речи */
.vh-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa !important;
    border-radius: 8px;
    border: 2px solid #dee2e6 !important;
    font-family: Arial, sans-serif !important;
}

.vh-slider-label {
    font-weight: 700 !important;
    color: #222222 !important;
    min-width: 80px;
    font-size: 1em !important;
}

.vh-slider,
.vh-font-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 10px;
    background: #dee2e6 !important;
    border-radius: 5px;
    outline: none;
    font-family: Arial, sans-serif !important;
}

.vh-slider::-webkit-slider-thumb,
.vh-font-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #0057B8 !important;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}

.vh-slider::-moz-range-thumb,
.vh-font-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #0057B8 !important;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}

.vh-slider-value,
.vh-font-slider-value {
    min-width: 50px;
    text-align: center;
    font-size: 1.1em !important;
    font-weight: 700 !important;
    color: #0057B8 !important;
    background: white !important;
    padding: 6px 10px;
    border-radius: 4px;
    border: 2px solid #dee2e6 !important;
    font-family: Arial, sans-serif !important;
}

/* Кнопки действий */
.vh-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 2px solid #dee2e6 !important;
}

.vh-actions .vh-btn {
    flex: 1;
    margin: 0 !important;
    padding: 14px !important;
    font-weight: 700 !important;
    font-size: 1.05em !important;
}

/* Подпись автора плагина */
.vh-credits {
    margin-top: 10px !important;
    padding-top: 10px !important;
    border-top: 1px solid #dee2e6 !important;
    text-align: center !important;
    font-size: 0.95em !important;
    color: #444444 !important;
    font-family: Arial, sans-serif !important;
}

.vh-credits p {
    margin: 0 !important;
    font-size: inherit !important;
    font-weight: 600 !important;
}

.vh-credits a {
    color: #0057B8 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    transition: color 0.3s !important;
}

.vh-credits a:hover {
    color: #004494 !important;
    text-decoration: underline !important;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .vh-panel {
        width: 380px;
    }
}

@media (max-width: 768px) {
    .vh-toolbar {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        transform: none;
        width: 100%;
    }
    
    .vh-toolbar.vh-position-left {
        left: 0;
        right: auto;
    }
    
    .vh-toggle-btn {
        writing-mode: horizontal-tb !important;
        width: 100% !important;
        padding: 12px !important;
        border-radius: 0 !important;
        min-height: auto !important;
        justify-content: center;
        gap: 8px;
        font-size: 1.1em !important;
    }
    
    .vh-toggle-btn .vh-icon {
        font-size: 20px !important;
    }
    
    .vh-panel {
        position: fixed !important;
        right: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        top: 50% !important;
        width: 95% !important;
        max-width: 400px !important;
        max-height: 85vh !important;
        padding: 15px !important;
    }
    
    .vh-btn {
        padding: 10px 12px !important;
        margin: 0 5px 8px 0 !important;
        font-size: 0.95em !important;
    }
    
    .vh-speech-indicator {
        bottom: 70px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
    }
    
    .vh-credits {
        font-size: 0.85em !important;
    }
}

@media (max-width: 480px) {
    .vh-panel {
        padding: 12px !important;
    }
    
    .vh-control-group {
        margin-bottom: 15px !important;
    }
    
    .vh-btn {
        padding: 10px !important;
        min-width: 50px !important;
        font-size: 0.9em !important;
    }
    
    .vh-slider-container {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .vh-slider-label {
        min-width: 100% !important;
    }
    
    .vh-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .vh-credits {
        font-size: 0.8em !important;
    }
}

/* Поддержка для устройств с touch-экранами */
@media (hover: none) and (pointer: coarse) {
    .vh-btn {
        min-height: 48px !important;
        padding: 14px 18px !important;
    }
    
    .vh-slider,
    .vh-font-slider {
        height: 14px !important;
    }
    
    .vh-slider::-webkit-slider-thumb,
    .vh-font-slider::-webkit-slider-thumb {
        width: 30px !important;
        height: 30px !important;
    }
}

/* Улучшенная читаемость текста в панели */
.vh-panel,
.vh-control-group,
.vh-btn,
.vh-slider-label,
.vh-panel-title {
    color: #222222 !important;
    text-shadow: 0 1px 1px rgba(255,255,255,0.8) !important;
}

/* Усиление контраста для активных элементов */
.vh-btn.active,
.vh-btn:hover {
    text-shadow: 0 1px 1px rgba(0,0,0,0.2) !important;
}