/* Floating Translation Button */
#translation-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
    user-select: none;
}

#translation-btn:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#translation-btn.active {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Translation Panel */
#translation-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#translation-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.translation-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.translation-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.translation-content {
    padding: 20px;
}

.translation-section {
    margin-bottom: 15px;
}

.translation-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

#source-text {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

#source-text:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.translation-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#target-language {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: white;
    transition: all 0.3s ease;
}

#target-language:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.translate-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.translate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.translated-output {
    min-height: 100px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.placeholder-text {
    color: #999;
    font-style: italic;
}

.translation-result {
    position: relative;
}

.translation-result p {
    margin: 0 0 10px 0;
    line-height: 1.6;
    color: #333;
}

.copy-translation {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-translation:hover {
    background: #5568d3;
}

.error-message {
    color: #dc3545;
    padding: 10px;
    background: #f8d7da;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
}

.loading-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 15px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator span {
    color: #667eea;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    #translation-panel {
        bottom: 100px;
        right: 15px;
        left: 15px;
        width: auto;
    }
    
    #translation-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .translation-controls {
        flex-direction: column;
    }
}

/* Hint animation for first-time users */
@keyframes pulse-hint {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

#translation-btn.hint {
    animation: pulse-hint 2s ease-in-out 3;
}
