/**
 * Chat Translation Styles
 * Modern language selector with responsive design
 * Version 1.0.0
 */

/* Language Selector Container */
.chat-language-selector {
    position: relative;
    margin-left: auto;
    z-index: 1000;
}

.language-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.language-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.language-icon {
    font-size: 16px;
    line-height: 1;
}

.current-language {
    font-size: 13px;
}

.dropdown-arrow {
    font-size: 10px;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.language-toggle-btn:hover .dropdown-arrow {
    transform: translateY(1px);
}

/* Language Dropdown */
.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideDown 0.2s ease;
    border: 1px solid #e5e7eb;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Wrapper */
.language-search-wrapper {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.language-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.language-search:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.language-search::placeholder {
    color: #9ca3af;
}

/* Language List */
.language-list {
    max-height: 350px;
    overflow-y: auto;
    padding: 4px;
}

.language-list::-webkit-scrollbar {
    width: 6px;
}

.language-list::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.language-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.language-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Language Option */
.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
    position: relative;
}

.language-option:hover {
    background: #f3f4f6;
}

.language-option.active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
}

.language-option.active::after {
    content: '✓';
    position: absolute;
    right: 12px;
    font-size: 16px;
    font-weight: bold;
}

.lang-flag {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.lang-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.language-option.active .lang-name {
    color: white;
}

.lang-code {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    padding: 2px 6px;
    background: #f3f4f6;
    border-radius: 4px;
}

.language-option.active .lang-code {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Translation Notification */
.chat-translation-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #10b981;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.chat-translation-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Translation Indicator in Messages */
.message-translation-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

.message-translation-badge::before {
    content: '🌐';
    font-size: 12px;
}

/* Vendor Dashboard Integration */
.vendor-chat-dashboard .chat-language-selector {
    margin-left: 16px;
}

.vendor-chat-dashboard .language-toggle-btn {
    background: white;
    color: #1f2937;
    border-color: #d1d5db;
}

.vendor-chat-dashboard .language-toggle-btn:hover {
    background: #f9fafb;
    border-color: #4f46e5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-dropdown {
        width: 280px;
        max-height: 400px;
    }
    
    .language-list {
        max-height: 300px;
    }
    
    .language-toggle-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .current-language {
        display: none;
    }
    
    .language-icon {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .language-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .language-search-wrapper {
        padding: 16px;
    }
    
    .language-list {
        padding: 8px;
    }
    
    .language-option {
        padding: 14px 16px;
    }
    
    .lang-flag {
        font-size: 28px;
    }
    
    .lang-name {
        font-size: 15px;
    }
    
    .chat-translation-notification {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        text-align: center;
    }
}

/* Loading State */
.language-option.loading {
    opacity: 0.6;
    pointer-events: none;
}

.language-option.loading::after {
    content: '⏳';
}

/* Error State */
.translation-error {
    padding: 8px 12px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 12px;
    margin: 8px 12px;
    text-align: center;
}

/* Success State */
.translation-success {
    padding: 8px 12px;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 12px;
    margin: 8px 12px;
    text-align: center;
}

/* RTL Language Support */
.chat-language-selector[dir="rtl"] .language-dropdown {
    left: 0;
    right: auto;
}

.language-option[dir="rtl"] {
    direction: rtl;
}

.language-option[dir="rtl"] .lang-code {
    margin-left: 0;
    margin-right: auto;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .language-toggle-btn {
        border-width: 2px;
    }
    
    .language-option.active {
        background: #1e40af;
    }
    
    .language-dropdown {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .language-dropdown,
    .chat-translation-notification,
    .language-toggle-btn,
    .language-option {
        animation: none;
        transition: none;
    }
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    .language-dropdown {
        background: #1f2937;
        border-color: #374151;
    }
    
    .language-search-wrapper {
        background: #111827;
        border-color: #374151;
    }
    
    .language-search {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .language-option:hover {
        background: #374151;
    }
    
    .lang-name {
        color: #f3f4f6;
    }
    
    .lang-code {
        background: #374151;
        color: #9ca3af;
    }
}

/* Accessibility Improvements */
.language-toggle-btn:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.language-option:focus {
    outline: 2px solid #4f46e5;
    outline-offset: -2px;
}

/* Print Styles */
@media print {
    .chat-language-selector,
    .language-dropdown,
    .chat-translation-notification {
        display: none !important;
    }
}
