/* Enhanced styles for the floating translation popup */
.__translator_bubble {
    position: absolute;
    z-index: 9999;
    max-width: 380px;
    min-width: 240px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    color: #1e293b;
    border: 1px solid rgba(20, 184, 166, 0.28);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 8px 16px -8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 14px 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    animation: bubble-entrance 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes bubble-entrance {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Enhanced focus states for accessibility */
.__translator_bubble *:focus {
    outline: 2px solid #14b8a6;
    outline-offset: 2px;
    border-radius: 4px;
}

.__translator_bubble .close-btn {
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(203, 213, 225, 0.6);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
    justify-self: flex-end;
}

.__translator_bubble .close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.15);
}

.__translator_bubble .language-indicator {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    gap: 12px;
    margin: 0 0 10px 0;
    padding: 6px 0;
}

.__translator_bubble .language-indicator.no-lang-info {
    grid-template-columns: 1fr 1fr 1fr;
}

.__translator_bubble .language-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
    min-width: 0;
}

.__translator_bubble .language-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    box-shadow: 0 4px 8px rgba(20, 184, 166, 0.2),
        0 1px 2px rgba(20, 184, 166, 0.1);
    position: relative;
    overflow: hidden;
    min-width: 30px;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 22px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.__translator_bubble .language-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(20, 184, 166, 0.3),
        0 4px 8px rgba(20, 184, 166, 0.2);
}

.__translator_bubble .language-badge.source-lang {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.2),
        0 1px 2px rgba(245, 158, 11, 0.1);
    color: white;
    cursor: pointer;
}

.__translator_bubble .language-badge.source-lang:hover {
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.3),
        0 4px 8px rgba(245, 158, 11, 0.2);
}

.__translator_bubble .language-badge.target-lang {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2),
        0 1px 2px rgba(16, 185, 129, 0.1);
    color: white;
    cursor: pointer;
}

.__translator_bubble .language-badge.target-lang:hover {
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3),
        0 4px 8px rgba(16, 185, 129, 0.2);
}

.__translator_bubble .language-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.3s;
}

.__translator_bubble .language-badge:hover::before {
    left: 100%;
}

.__translator_bubble .lang-label {
    position: relative;
    z-index: 1;
}

.__translator_bubble .language-arrow {
    color: #14b8a6;
    font-size: 14px;
    font-weight: bold;
    opacity: 0.8;
    animation: pulse-arrow 3s infinite;
    margin: 0 2px;
    text-shadow: 0 1px 2px rgba(20, 184, 166, 0.1);
}

@keyframes pulse-arrow {

    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.__translator_bubble .language-indicator.fallback .language-arrow {
    color: #f59e0b;
    animation: pulse-warning 1.5s infinite;
}

@keyframes pulse-warning {

    0%,
    100% {
        opacity: 0.8;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.__translator_bubble .language-indicator.fallback .language-badge {
    opacity: 0.8;
}

/* Text containers with speaker buttons */
.__translator_bubble .source-text-container,
.__translator_bubble .translated-text-container {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.__translator_bubble .source-text-container .source-text,
.__translator_bubble .translated-text-container .translated-text {
    flex: 1;
    min-width: 0;
}

/* Speaker/TTS button styles */
.__translator_bubble .__veris_speak_btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%);
    border: 1px solid rgba(203, 213, 225, 0.6);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}

.__translator_bubble .__veris_speak_btn:hover {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-color: rgba(20, 184, 166, 0.6);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(20, 184, 166, 0.25);
}

.__translator_bubble .__veris_speak_btn:active {
    transform: translateY(0) scale(0.95);
}

.__translator_bubble .__veris_speak_btn.speaking {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-color: rgba(20, 184, 166, 0.6);
    color: #fff;
    animation: speak-pulse 1s ease-in-out infinite;
}

@keyframes speak-pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.4);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 6px rgba(20, 184, 166, 0);
    }
}

.__translator_bubble .__veris_speak_btn .speak-icon {
    width: 14px;
    height: 14px;
    display: block;
}

.__translator_bubble .source-text {
    color: #475569;
    font-size: 13px;
    margin-bottom: 8px;
    max-height: 6em;
    overflow: auto;
    line-height: 1.4;
    padding: 8px 10px;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);
    border-radius: 8px;
    border: 1px solid rgba(226, 232, 240, 0.7);
    font-weight: 500;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.__translator_bubble .source-text:hover {
    border-color: rgba(20, 184, 166, 0.4);
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.95) 100%);
}

.__translator_bubble .source-text.editing {
    border-color: #14b8a6;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.05);
    outline: none;
}

.__translator_bubble .source-text.editing:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

.__translator_bubble .translated-text {
    font-size: 14px;
    margin-top: 6px;
    white-space: pre-wrap;
    font-weight: 600;
    color: #0d9488;
    line-height: 1.4;
    padding: 8px 10px;
    background: linear-gradient(135deg, rgba(204, 251, 241, 0.6) 0%, rgba(240, 253, 250, 0.8) 100%);
    border-radius: 8px;
    border: 1px solid rgba(20, 184, 166, 0.2);
    box-shadow: 0 2px 4px rgba(13, 148, 136, 0.05);
}

.__translator_bubble .word-breakdown {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(203, 213, 225, 0.6);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(248, 250, 252, 0.6) 100%);
    border-radius: 8px;
    padding: 10px;
    margin-left: -1px;
    margin-right: -1px;
}

.__translator_bubble .word-breakdown-title {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

.__translator_bubble .word-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.__translator_bubble .word-pill {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #475569;
    display: inline-block;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin: 1px;
}

.__translator_bubble .word-pill:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    color: #334155;
}

.__translator_bubble .word-pill:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.__translator_bubble .word-pill.active {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-color: #0a7c73;
    color: white;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.__translator_bubble .word-pill.selected {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #047857;
    color: white;
    position: relative;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.__translator_bubble .word-pill.selected::after {
    content: '✓';
    position: absolute;
    top: -2px;
    right: -2px;
    background: #059669;
    color: white;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.__translator_bubble .save-button-translate {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    padding: 4px 8px;
    color: rgba(100, 116, 139, 0.5);
    font-size: 16px;
    font-weight: 600;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: none;
    text-shadow: none;
    opacity: 0.4;
    pointer-events: none;
    height: 28px;
    flex-shrink: 0;
    justify-self: flex-start;
    min-width: fit-content;
    justify-content: center;
}

.__translator_bubble .save-button-translate .save-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.__translator_bubble .save-button-translate.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25),
        0 2px 4px rgba(16, 185, 129, 0.1);
    opacity: 1;
    pointer-events: auto;
    animation: save-pulse 2s infinite;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

@keyframes save-pulse {

    0%,
    100% {
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25),
            0 2px 4px rgba(16, 185, 129, 0.1);
    }

    50% {
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4),
            0 2px 4px rgba(16, 185, 129, 0.2),
            0 0 0 4px rgba(16, 185, 129, 0.1);
    }
}

.__translator_bubble .save-button-translate.active:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35),
        0 4px 8px rgba(16, 185, 129, 0.2);
}

.__translator_bubble .save-button-translate.active:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25),
        0 2px 4px rgba(16, 185, 129, 0.1);
}

.__translator_bubble .save-button-translate .save-count {
    background: rgba(100, 116, 139, 0.15);
    border-radius: 12px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    line-height: 1;
    display: none;
}

.__translator_bubble .save-button-translate.active .save-count {
    display: inline-block;
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.__translator_bubble .save-button-translate .save-text {
    display: none;
}

.__translator_bubble .save-status {
    margin-bottom: 8px;
    margin-top: 0;
    text-align: center;
    font-size: 11px;
    color: #059669;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 6px 8px;
    background: linear-gradient(135deg, rgba(209, 250, 229, 0.8) 0%, rgba(167, 243, 208, 0.6) 100%);
    border-radius: 6px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: none;
}

.__translator_bubble .save-status.show {
    opacity: 1;
    display: block;
    animation: slide-down 0.3s ease;
}

@keyframes slide-down {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.__translator_bubble .word-translation {
    margin-top: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.__translator_bubble .word-translation.show {
    display: block;
}

.__translator_bubble .word-translation-item {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.__translator_bubble .word-translation-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.__translator_bubble .word-translation-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.__translator_bubble .word-translation-content.loading {
    opacity: 0.6;
}

.__translator_bubble .word-translation .word-original {
    font-weight: 600;
    color: #1e293b;
}

.__translator_bubble .word-translation .word-translated {
    color: #0d9488;
    margin-left: 0;
}

/* Word-level TTS/Speaker buttons */
.__translator_bubble .word-speak-btn {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%);
    border: 1px solid rgba(203, 213, 225, 0.6);
    border-radius: 4px;
    padding: 3px 5px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.__translator_bubble .word-speak-btn:hover {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-color: rgba(20, 184, 166, 0.6);
    color: #fff;
    transform: scale(1.1);
}

.__translator_bubble .word-speak-btn:active {
    transform: scale(0.95);
}

.__translator_bubble .word-speak-btn.speaking {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-color: rgba(20, 184, 166, 0.6);
    color: #fff;
    animation: word-speak-pulse 1s ease-in-out infinite;
}

@keyframes word-speak-pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.4);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 0 4px rgba(20, 184, 166, 0);
    }
}

.__translator_bubble .word-speak-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Multi-word pair layout with TTS buttons */
/* .__translator_bubble .multi-word-pair {
    display: flex;
    flex: 0 0 100%;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
} */

.__translator_bubble .add-word-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: auto;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.__translator_bubble .add-word-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.__translator_bubble .meta {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.__translator_loading {
    opacity: 0.7;
    position: relative;
}

.__translator_loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: loading-shimmer 1.5s infinite;
    border-radius: 16px;
    z-index: 1;
    pointer-events: none;
}

@keyframes loading-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Responsive improvements */
@media (max-width: 480px) {
    .__translator_bubble {
        max-width: calc(100vw - 30px);
        min-width: 200px;
        font-size: 12px;
        padding: 10px 12px 8px;
    }

    .__translator_bubble .language-badge {
        padding: 3px 6px;
        font-size: 9px;
        height: 18px;
    }

    .__translator_bubble .source-text,
    .__translator_bubble .translated-text {
        font-size: 12px;
        padding: 6px 8px;
    }

    .__translator_bubble .save-button-translate {
        padding: 3px 6px;
        height: 26px;
        gap: 3px;
    }

    .__translator_bubble .save-button-translate .save-icon {
        width: 14px;
        height: 14px;
    }

    .__translator_bubble .multi-word-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .__translator_bubble .multi-word-controls {
        gap: 8px;
    }

    .__translator_bubble .control-buttons {
        gap: 6px;
    }

    .__translator_bubble .multi-word-status {
        min-width: 150px;
    }

    .__translator_bubble .multi-word-info {
        font-size: 10px;
    }

    .__translator_bubble .close-btn {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }

    .__translator_bubble .language-indicator {
        gap: 8px;
    }

    .__translator_bubble .word-pill {
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* Multi-word selection mode styles */
.__translator_bubble .multi-word-controls {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.__translator_bubble .control-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.__translator_bubble .multi-word-btn {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 30px;
    height: 30px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25),
        0 2px 4px rgba(99, 102, 241, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.__translator_bubble .multi-word-btn:hover {
    background: linear-gradient(135deg, #5046e5 0%, #7c3aed 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35),
        0 4px 8px rgba(99, 102, 241, 0.2);
}

.__translator_bubble .multi-word-btn.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse-active 2s infinite;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25),
        0 2px 4px rgba(239, 68, 68, 0.1);
}

.__translator_bubble .multi-word-btn.active:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35),
        0 4px 8px rgba(239, 68, 68, 0.2);
}

@keyframes pulse-active {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.__translator_bubble .multi-word-status {
    display: none;
    flex: 1;
    min-width: 200px;
}

.__translator_bubble .multi-word-status.show {
    display: block;
}

.__translator_bubble .multi-word-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #6b7280;
}

.__translator_bubble .word-pill.multi-word-selected {
    background: #f59e0b;
    border-color: #d97706;
    color: white;
    position: relative;
}

.__translator_bubble .word-pill.multi-word-selected::after {
    content: '🔗';
    position: absolute;
    top: -2px;
    right: -2px;
    background: #d97706;
    color: white;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.__translator_bubble .multi-word-translation {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
}

.__translator_bubble .multi-word-header {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
}

.__translator_bubble .multi-word-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.__translator_bubble .multi-word-original {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 4px;
}

.__translator_bubble .multi-word-translated {
    font-size: 14px;
    font-weight: 500;
    color: #0d9488;
    padding: 4px 8px;
    background: #f0fdfa;
    border-radius: 4px;
}

.__translator_bubble .save-multi-word-btn {
    background: #14b8a6;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
    margin-top: 4px;
}

.__translator_bubble .save-multi-word-btn:hover {
    background: #0d9488;
    transform: translateY(-1px);
}

.__translator_bubble .save-multi-word-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.__translator_bubble .multi-word-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.__translator_bubble .multi-word-error .multi-word-header {
    color: #dc2626;
}

.__translator_bubble .multi-word-error .error-message {
    font-size: 12px;
    color: #7f1d1d;
    margin-top: 4px;
}

/* Instant multi-word translation styles */
.__translator_bubble .instant-multi-word-translation {
    border-bottom: 2px solid #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.__translator_bubble .multi-word-instant {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.__translator_bubble .multi-word-instant.loading {
    opacity: 0.7;
}

.__translator_bubble .multi-word-instant.error .word-translated.error {
    color: #dc2626;
    font-style: italic;
}

.__translator_bubble .multi-word-label-wrapper .multi-word-label {
    font-weight: 700;
    color: #92400e;
    font-size: 14px;
    flex-shrink: 0;
    align-self: flex-start;
}

.__translator_bubble .multi-word-label-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

.__translator_bubble .multi-word-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.__translator_bubble .multi-word-instant .word-original {
    font-weight: 600;
    color: #92400e;
    background: #fed7aa;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-align: left;
}

.__translator_bubble .multi-word-instant .word-translated {
    color: #0d9488;
    font-weight: 500;
    background: #ccfbf1;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-align: left;
}

.__translator_bubble .multi-word-add {
    background: #f59e0b;
    border: none;
    border-radius: 4px;
    color: white;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: center;
    font-weight: 600;
}

.__translator_bubble .multi-word-add:hover {
    background: #d97706;
    transform: translateY(-1px);
}
