/**
 * Pronunciation Guide Styles
 */

/* Enable pronunciation on hover */
.pronunciation-enabled {
    cursor: help;
}

.pronunciable-word {
    position: relative;
    display: inline-block;
    padding: 0 2px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.pronunciable-word:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--color-primary);
}

/* Pronunciation Tooltip */
.pronunciation-tooltip {
    position: fixed;
    z-index: 10002;
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-primary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.pronunciation-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: all;
}

.pronunciation-tooltip.bottom {
    transform: translateY(10px);
}

.pronunciation-tooltip.bottom.visible {
    transform: translateY(0);
}

/* Tooltip Arrow */
.pronunciation-tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-primary);
    border-bottom: 1px solid var(--border-primary);
}

.pronunciation-tooltip.bottom::before {
    bottom: auto;
    top: -6px;
    transform: translateX(-50%) rotate(225deg);
}

.pronunciation-content {
    padding: 1rem;
    min-width: 200px;
    max-width: 300px;
}

.pronunciation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.pronunciation-original {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-play-audio {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-play-audio:hover {
    background: var(--color-primary);
    color: white;
}

.btn-play-audio svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.pronunciation-phonetic {
    font-size: 1.25rem;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 0.75rem;
    font-family: 'Courier New', Courier, monospace;
}

.pronunciation-breakdown {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.pronunciation-breakdown strong {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--color-primary);
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

.pronunciation-tips {
    border-top: 1px solid var(--border-primary);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.pronunciation-tip {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.pronunciation-tip:last-child {
    margin-bottom: 0;
}

/* Toggle Switch */
.pronunciation-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Language-specific styling */
.pronunciation-tooltip[data-language="zh"] .pronunciation-phonetic,
.pronunciation-tooltip[data-language="ja"] .pronunciation-phonetic,
.pronunciation-tooltip[data-language="ko"] .pronunciation-phonetic,
.pronunciation-tooltip[data-language="ar"] .pronunciation-phonetic {
    font-size: 1.125rem;
}

/* Animation for word highlighting */
@keyframes pronunciation-pulse {
    0% {
        background: transparent;
    }
    50% {
        background: rgba(102, 126, 234, 0.2);
    }
    100% {
        background: transparent;
    }
}

.pronunciable-word.playing {
    animation: pronunciation-pulse 1s ease-in-out;
}

/* Dark theme adjustments */
[data-theme="dark"] .pronunciation-tooltip {
    background: #1a1a1a;
    border-color: #444;
}

[data-theme="dark"] .pronunciation-tooltip::before {
    background: #1a1a1a;
    border-color: #444;
}

[data-theme="dark"] .pronunciable-word:hover {
    background: rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .btn-play-audio {
    background: #2a2a2a;
}

[data-theme="dark"] .btn-play-audio:hover {
    background: var(--color-primary);
}

[data-theme="dark"] .pronunciation-breakdown {
    background: #2a2a2a;
}

[data-theme="dark"] .toggle-slider {
    background-color: #444;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
    .pronunciation-tooltip {
        max-width: 250px;
    }
    
    .pronunciation-content {
        padding: 0.75rem;
    }
    
    .pronunciation-phonetic {
        font-size: 1.125rem;
    }
}

/* Print styles */
@media print {
    .pronunciation-tooltip {
        display: none !important;
    }
    
    .pronunciable-word {
        background: none !important;
    }
}