/* ============ КАСТОМНЕ КОНТЕКСТНЕ МЕНЮ ============ */

/* ============ ВИДАЛЕНО ДУБЛЬОВАНЕ МЕНЮ ============ */
/*
   Видалено дубльований #word-context-menu
   Єдина версія меню знаходиться в reader-base.css
*/

/* Елементи меню (стилі для .menu-item, якщо потрібні додаткові) */
.menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.15s;
    color: #1e293b;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background-color: #f8fafc;
    border-left-color: #8b5cf6;
}

.menu-item:active {
    background-color: #f1f5f9;
}

.menu-item .material-symbols-outlined {
    font-size: 20px;
    color: #64748b;
    transition: color 0.15s;
}

.menu-item:hover .material-symbols-outlined {
    color: #8b5cf6;
}

.menu-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

.menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.menu-item.disabled .material-symbols-outlined {
    color: #94a3b8;
}

/* ============ ТУЛТІПИ ============ */

.transcription-tooltip {
    position: absolute;
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-family: 'Fira Code', monospace;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    white-space: nowrap;
    animation: tooltipAppear 0.2s ease;
    pointer-events: none;
}

.transcription-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #1e293b;
}

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

/* ============ ІНТЕРАКТИВНІ СЛОВА ============ */

.word {
    cursor: pointer;
    display: inline-block;
    transition: all 0.2s;
    border-radius: 4px;
    padding: 0 2px;
    position: relative;
}

.word:hover {
    background-color: rgba(139, 92, 246, 0.1);
}

.word.playing {
    background-color: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.word.long-press {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% {
        background-color: rgba(139, 92, 246, 0);
    }
    50% {
        background-color: rgba(139, 92, 246, 0.3);
    }
    100% {
        background-color: rgba(139, 92, 246, 0);
    }
}

.word.loading::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #c4b5fd, #8b5cf6);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 2px;
}

@keyframes loading {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 0%;
    }
}

/* ============ КНОПКИ TTS ============ */

.tts-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
}

.tts-button:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    transform: scale(1.05);
}

.tts-button.playing {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
    animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(139, 92, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    }
}

/* ============ ВИБІР РЕЖИМУ ПЕРЕКЛАДУ ============ */

.mode-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.mode-option:hover {
    border-color: #8b5cf6;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mode-option.active {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.mode-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-icon .material-symbols-outlined {
    font-size: 28px;
    color: #8b5cf6;
}

.mode-details {
    flex: 1;
}

.mode-name {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.mode-description {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
}

.mode-suitable {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.mode-example {
    font-size: 12px;
    color: #8b5cf6;
    font-family: 'Fira Code', monospace;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
}

/* ============ ПРОГРЕС-БАР ЧИТАННЯ ============ */

.reading-progress {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    height: 3px;
    background: #e2e8f0;
    z-index: 101;
}

.reading-progress-bar {
    height: 100%;
    background: #8b5cf6;
    transition: width 0.3s ease;
    width: 0%;
}

/* ============ КНОПКА ПОВЕРНЕННЯ ДО ПОЧАТКУ ============ */

.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #8b5cf6;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: all 0.2s;
    opacity: 0;
    visibility: hidden;
    z-index: 90;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.scroll-top-btn .material-symbols-outlined {
    font-size: 24px;
}

/* ============ ПІДСВІТКА ПОШУКУ ============ */

.search-highlight {
    background-color: rgba(250, 204, 21, 0.3);
    border-radius: 4px;
    padding: 0 2px;
    transition: background-color 0.2s;
}

.search-highlight.current {
    background-color: rgba(139, 92, 246, 0.3);
    border: 1px solid #8b5cf6;
}

/* ============ ЗАКЛАДКИ ============ */

.bookmark-indicator {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: #8b5cf6;
    border-radius: 4px;
    animation: bookmarkPulse 2s infinite;
}

@keyframes bookmarkPulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* ============ АНІМАЦІЯ ДЛЯ НОВИХ СЛІВ ============ */

.word-added {
    animation: wordAdded 1s ease;
}

@keyframes wordAdded {
    0% {
        background-color: rgba(16, 185, 129, 0);
    }
    30% {
        background-color: rgba(16, 185, 129, 0.3);
    }
    100% {
        background-color: rgba(16, 185, 129, 0);
    }
}

/* ============ АДАПТАЦІЯ ДЛЯ МОБІЛЬНИХ ============ */

@media (max-width: 768px) {
    .mode-option {
        padding: 12px;
    }
    
    .mode-icon {
        width: 40px;
        height: 40px;
    }
    
    .mode-icon .material-symbols-outlined {
        font-size: 24px;
    }
    
    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .scroll-top-btn {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
}

/* ============ ТЕМНА ТЕМА ДЛЯ МЕНЮ ============ */

.theme-dark .menu-item {
    color: #e2e8f0;
}

.theme-dark .menu-item:hover {
    background-color: #334155;
}

.theme-dark .menu-item .material-symbols-outlined {
    color: #94a3b8;
}

.theme-dark .menu-divider {
    background: #334155;
}

.theme-dark .transcription-tooltip {
    background: #0f172a;
    color: #e2e8f0;
}

.theme-dark .transcription-tooltip::before {
    border-bottom-color: #0f172a;
}

/* ============ ТЕМА СЕПІЯ ДЛЯ МЕНЮ ============ */

.theme-sepia .menu-item {
    color: #5b4636;
}

.theme-sepia .menu-item:hover {
    background-color: #f3ede3;
}

.theme-sepia .menu-divider {
    background: #d9c8b4;
}

/* ============ ПАНЕЛЬ СЛОВНИКА ============ */

.vocabulary-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.vocabulary-panel.open {
    right: 0;
}

.vocabulary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.vocabulary-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.vocabulary-header .close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.vocabulary-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.vocabulary-actions .btn-secondary {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.vocabulary-actions .btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.vocabulary-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.vocabulary-empty {
    text-align: center;
    padding: 32px 16px;
    color: #9ca3af;
    font-size: 14px;
}

.vocabulary-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.vocabulary-item:hover {
    background: #f9fafb;
}

.vocabulary-word {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.vocabulary-translation {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 6px;
}

.vocabulary-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
}

.vocabulary-status.status-0 {
    background: #fef3c7;
    color: #d97706;
}

.vocabulary-status.status-1 {
    background: #dbeafe;
    color: #2563eb;
}

.vocabulary-status.status-2 {
    background: #d1fae5;
    color: #059669;
}

/* Темна тема */
body.theme-dark .vocabulary-panel {
    background: #1f2937;
    border-left: 1px solid #374151;
}

body.theme-dark .vocabulary-header {
    background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
}

body.theme-dark .vocabulary-actions {
    background: #111827;
    border-bottom-color: #374151;
}

body.theme-dark .vocabulary-actions .btn-secondary {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

body.theme-dark .vocabulary-item {
    border-bottom-color: #374151;
}

body.theme-dark .vocabulary-item:hover {
    background: #374151;
}

body.theme-dark .vocabulary-word {
    color: #f3f4f6;
}

body.theme-dark .vocabulary-translation {
    color: #9ca3af;
}

/* Сепія тема */
body.theme-sepia .vocabulary-panel {
    background: #fbf5e8;
}

body.theme-sepia .vocabulary-header {
    background: linear-gradient(135deg, #b97f3a 0%, #9b5e2e 100%);
}

/* Мобільна версія */
@media (max-width: 768px) {
    .vocabulary-panel {
        width: 280px;
        right: -280px;
    }
}