/**
 * accessibility-panel.css
 * Styly pro plovoucí panel přístupnosti
 * Responzivní design, tmavý režim
 */

/* ============================================
   PLOVOUCÍ TLAČÍTKO
   ============================================ */

.accessibility-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: 3px solid #ffcc99;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(30, 60, 114, 0.6), 0 0 0 0 rgba(255, 204, 153, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.accessibility-trigger:hover,
.accessibility-trigger:focus {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 8px 35px rgba(30, 60, 114, 0.8), 0 0 0 4px rgba(255, 204, 153, 0.6);
    outline: none;
    border-color: #ffd54f;
}

.accessibility-trigger:focus-visible {
    outline: 3px solid #ffcc99;
    outline-offset: 3px;
}

.accessibility-trigger:active {
    transform: scale(0.95);
}

/* Animace pulzování pro upoutání pozornosti */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 6px 25px rgba(30, 60, 114, 0.6), 0 0 0 0 rgba(255, 204, 153, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 35px rgba(30, 60, 114, 0.9), 0 0 0 8px rgba(255, 204, 153, 0.3);
        transform: scale(1.05);
    }
}

.accessibility-trigger.pulse {
    animation: pulse 2s infinite;
}

/* ============================================
   OVERLAY (pozadí při otevřeném panelu)
   ============================================ */

.accessibility-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.accessibility-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   PANEL
   ============================================ */

.accessibility-panel {
    position: fixed;
    top: 0;
    right: -400px; /* Skrytý mimo obrazovku */
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    max-height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.accessibility-panel.active {
    right: 0;
}

/* Tmavý režim - panel */
body.dark-mode .accessibility-panel {
    background: #1A1A2E;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.6);
}

/* ============================================
   HLAVIČKA PANELU
   ============================================ */

.accessibility-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 2px solid #e0e0e0;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    flex-shrink: 0; /* Hlavička se nezmenšuje */
    position: sticky;
    top: 0;
    z-index: 10;
}

body.dark-mode .accessibility-panel-header {
    background: linear-gradient(to bottom, #16213E 0%, #1A1A2E 100%);
    border-bottom-color: #2d2d2d;
}

.accessibility-panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3c72;
    margin: 0;
}

body.dark-mode .accessibility-panel-header h2 {
    color: #4a7bc8;
}

.accessibility-close {
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.accessibility-close:hover,
.accessibility-close:focus {
    background: rgba(0, 0, 0, 0.1);
    color: #1e3c72;
}

body.dark-mode .accessibility-close {
    color: #b0b0b0;
}

body.dark-mode .accessibility-close:hover,
body.dark-mode .accessibility-close:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #4a7bc8;
}

/* ============================================
   OBSAH PANELU
   ============================================ */

.accessibility-panel-content {
    padding: 1rem 1.25rem 1.5rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sekce */
.accessibility-section {
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #e0e0e0;
}

body.dark-mode .accessibility-section {
    border-bottom-color: #2d2d2d;
}

.accessibility-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.accessibility-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Nadpis sekce */
.accessibility-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

body.dark-mode .accessibility-section-title {
    color: #e0e0e0;
}

.accessibility-section-title i {
    color: #2a5298;
    font-size: 1.1rem;
}

body.dark-mode .accessibility-section-title i {
    color: #4a7bc8;
}

/* ============================================
   OVLÁDÁNÍ VELIKOSTI PÍSMA
   ============================================ */

.font-size-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.font-size-display {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e3c72;
    min-width: 60px;
    text-align: center;
}

body.dark-mode .font-size-display {
    color: #4a7bc8;
}

.btn-control {
    width: 40px;
    height: 40px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #333;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-control:hover,
.btn-control:focus {
    background: #1e3c72;
    border-color: #1e3c72;
    color: white;
    transform: scale(1.05);
}

body.dark-mode .btn-control {
    background: #16213E;
    border-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .btn-control:hover,
body.dark-mode .btn-control:focus {
    background: #2a5298;
    border-color: #2a5298;
}

/* ============================================
   PŘEPÍNAČ REŽIMU (SVĚTLÝ/TMAVÝ)
   ============================================ */

.theme-toggle-group {
    display: flex;
    gap: 0.5rem;
}

.btn-theme {
    flex: 1;
    padding: 0.6rem 0.8rem;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.85rem;
}

.btn-theme i {
    font-size: 1.3rem;
}

.btn-theme:hover,
.btn-theme:focus {
    border-color: #1e3c72;
    transform: translateY(-2px);
}

.btn-theme.active {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-color: #1e3c72;
    color: white;
}

body.dark-mode .btn-theme {
    background: #16213E;
    border-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .btn-theme:hover,
body.dark-mode .btn-theme:focus {
    border-color: #4a7bc8;
}

body.dark-mode .btn-theme.active {
    background: linear-gradient(135deg, #2a5298 0%, #4a7bc8 100%);
    border-color: #2a5298;
}

/* ============================================
   TOGGLE SWITCH (Vysoký kontrast, Animace, Odkazy)
   ============================================ */

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 26px;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.2);
}

.toggle-label {
    font-size: 0.95rem;
    color: #333;
}

body.dark-mode .toggle-label {
    color: #e0e0e0;
}

body.dark-mode .toggle-slider {
    background: #2d2d2d;
}

body.dark-mode .toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #2a5298 0%, #4a7bc8 100%);
}

/* ============================================
   ODDĚLOVAČ
   ============================================ */

.accessibility-divider {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 1rem 0;
}

body.dark-mode .accessibility-divider {
    border-top-color: #2d2d2d;
}

/* ============================================
   TEXT-TO-SPEECH OVLÁDÁNÍ
   ============================================ */

.accessibility-section-tts {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
    padding: 0.6rem;
    border-radius: 8px;
    border: 2px solid #d0e0ff;
}

body.dark-mode .accessibility-section-tts {
    background: linear-gradient(135deg, #16213E 0%, #1A1A2E 100%);
    border-color: #2d2d2d;
}

.tts-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.btn-tts {
    flex: 0 0 auto;
    padding: 0.75rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-tts i {
    font-size: 1.2rem;
}

.btn-tts-primary {
    flex: 1;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-color: #1e3c72;
    color: white;
    font-weight: 600;
}

.btn-tts:hover:not(:disabled),
.btn-tts:focus:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-tts-primary:hover,
.btn-tts-primary:focus {
    background: linear-gradient(135deg, #162b4d 0%, #1e3c72 100%);
}

.btn-tts:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-tts:active:not(:disabled) {
    transform: translateY(0);
}

body.dark-mode .btn-tts {
    background: #16213E;
    border-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .btn-tts-primary {
    background: linear-gradient(135deg, #2a5298 0%, #4a7bc8 100%);
    border-color: #2a5298;
}

/* TTS Status */
.tts-status {
    font-size: 0.85rem;
    color: #666;
    min-height: 20px;
    font-style: italic;
}

body.dark-mode .tts-status {
    color: #b0b0b0;
}

/* TTS Speed Control */
.tts-speed-control {
    margin-top: 0.6rem;
}

.tts-speed-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #333 !important;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

body.dark-mode .tts-speed-label {
    color: #e0e0e0 !important;
}

.tts-speed-label i {
    color: #2a5298;
    font-size: 0.9rem;
}

body.dark-mode .tts-speed-label i {
    color: #4a7bc8;
}

#tts-speed-value {
    font-weight: 600;
    color: #1e3c72;
}

body.dark-mode #tts-speed-value {
    color: #4a7bc8;
}

.tts-speed-slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.tts-speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tts-speed-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .tts-speed-slider {
    background: #2d2d2d;
}

body.dark-mode .tts-speed-slider::-webkit-slider-thumb {
    background: linear-gradient(135deg, #2a5298 0%, #4a7bc8 100%);
}

body.dark-mode .tts-speed-slider::-moz-range-thumb {
    background: linear-gradient(135deg, #2a5298 0%, #4a7bc8 100%);
}

/* ============================================
   TLAČÍTKO RESET
   ============================================ */

.btn-reset {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-reset:hover,
.btn-reset:focus {
    border-color: #ff9800;
    color: #ff9800;
    background: rgba(255, 152, 0, 0.05);
}

body.dark-mode .btn-reset {
    border-color: #2d2d2d;
    color: #b0b0b0;
}

body.dark-mode .btn-reset:hover,
body.dark-mode .btn-reset:focus {
    border-color: #ffa726;
    color: #ffa726;
    background: rgba(255, 167, 38, 0.1);
}

/* ============================================
   RESPONZIVITA
   ============================================ */

@media (max-width: 768px) {
    .accessibility-trigger {
        /* bottom: 80px;  Výše, aby nepřekrývalo obsah */
        bottom: 20px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        z-index: 999; /* Nižší než panel, ale nad obsahem */
    }
    
    /* Skrytí tlačítka při scrollování dolů (volitelné) */
    .accessibility-trigger.hide-on-scroll {
        transform: translateY(100px);
        opacity: 0;
        pointer-events: none;
    }
    
    .accessibility-panel {
        width: 100%;
        max-width: 100%;
        right: -100%; /* Celá šířka mimo obrazovku */
    }
    
    .accessibility-panel.active {
        right: 0;
    }
   
   /* Panel přes celou výšku na mobilu */
    .accessibility-panel {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height - pro mobily s adresním řádkem */
    }
    
    /* Overlay tmavší na mobilu */
    .accessibility-overlay.active {
        background: rgba(0, 0, 0, 0.7);
    }
   
    .accessibility-panel-header {
        padding: 1rem 1rem 0.75rem;
    }
    
    .accessibility-panel-header h2 {
        font-size: 1.25rem;
    }
    
    .accessibility-panel-content {
        padding: 1rem;
    }
    
    .accessibility-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .btn-tts {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
}

/* ============================================
   ANIMACE
   ============================================ */

@keyframes slideInRight {
    from {
        right: -400px;
        opacity: 0;
    }
    to {
        right: 0;
        opacity: 1;
    }
}

.accessibility-panel.active {
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   PREFERS REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .accessibility-trigger,
    .accessibility-panel,
    .accessibility-overlay,
    .btn-control,
    .btn-theme,
    .btn-tts,
    .toggle-slider::before {
        transition: none;
        animation: none;
    }
    
    .accessibility-trigger.pulse {
        animation: none;
    }
}

/* ============================================
   TOOLTIP PRO PLOVOUCÍ TLAČÍTKO
   ============================================ */

.accessibility-trigger::after {
    content: 'Přístupnost';
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #1e3c72;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
}

.accessibility-trigger::before {
    content: '';
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1e3c72;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 9999;
}

.accessibility-trigger:hover::after,
.accessibility-trigger:focus::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.accessibility-trigger:hover::before,
.accessibility-trigger:focus::before {
    opacity: 1;
    visibility: visible;
}

/* Tmavý režim - tooltip */
body.dark-mode .accessibility-trigger::after {
    background: #4a7bc8;
}

body.dark-mode .accessibility-trigger::before {
    border-left-color: #4a7bc8;
}

/* Mobilní - skrýt tooltip (šetříme místo) */
@media (max-width: 768px) {
    .accessibility-trigger::after,
    .accessibility-trigger::before {
        display: none;
    }
}