/* Nexus AI WP Translator Frontend Styles */

/* Language Switcher */
.nexus-ai-wp-language-switcher {
    display: inline-block;
    font-family: inherit;
}

.nexus-ai-wp-language-switcher.nexus-ai-wp-dropdown {
    position: relative;
}

.nexus-ai-wp-language-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
}

.nexus-ai-wp-language-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.nexus-ai-wp-language-switcher.nexus-ai-wp-list {
    display: block;
}

.nexus-ai-wp-language-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nexus-ai-wp-language-list li {
    margin: 0;
}

.nexus-ai-wp-language-list a {
    display: inline-block;
    padding: 6px 12px;
    background-color: #f8f9fa;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.nexus-ai-wp-language-list a:hover {
    background-color: #e9ecef;
    color: #495057;
    text-decoration: none;
}

.nexus-ai-wp-language-list li.current a {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.nexus-ai-wp-language-list li.unavailable span {
    background-color: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.nexus-ai-wp-language-list li.unavailable {
    opacity: 0.6;
}

/* Navigation Integration */
.menu-item-language-switcher {
    position: relative;
}

.menu-item-language-switcher .nexus-ai-wp-language-switcher {
    display: inline-block;
}

.menu-item-language-switcher .nexus-ai-wp-language-select {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: inherit;
    padding: 5px 8px;
    font-size: 14px;
}

.menu-item-language-switcher .nexus-ai-wp-language-list {
    display: flex;
    gap: 5px;
    margin: 0;
    padding: 0;
}

.menu-item-language-switcher .nexus-ai-wp-language-list li {
    margin: 0;
}

.menu-item-language-switcher .nexus-ai-wp-language-list a {
    padding: 4px 8px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    border-radius: 2px;
}

/* Widget Styles */
.widget_nexus_ai_wp_language_switcher {
    margin-bottom: 20px;
}

.widget_nexus_ai_wp_language_switcher .widget-title {
    margin-bottom: 15px;
}

/* Language Flags (if enabled) */
.nexus-ai-wp-language-flag {
    display: inline-block;
    width: 16px;
    height: 12px;
    margin-right: 5px;
    background-size: cover;
    background-position: center;
    vertical-align: middle;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nexus-ai-wp-language-list {
        flex-direction: column;
        gap: 5px;
    }
    
    .nexus-ai-wp-language-list a {
        text-align: center;
        padding: 10px;
    }
    
    .nexus-ai-wp-language-select {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* RTL Support */
[dir="rtl"] .nexus-ai-wp-language-flag {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .nexus-ai-wp-language-list {
    direction: rtl;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .nexus-ai-wp-language-select {
        background-color: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .nexus-ai-wp-language-list a {
        background-color: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .nexus-ai-wp-language-list a:hover {
        background-color: #4a5568;
        color: #e2e8f0;
    }
    
    .nexus-ai-wp-language-list li.current a {
        background-color: #0073aa;
        color: #fff;
    }
}

/* Loading States */
.nexus-ai-wp-language-switcher.loading {
    opacity: 0.6;
    pointer-events: none;
}

.nexus-ai-wp-language-switcher .loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: nexus-ai-wp-spin 1s linear infinite;
    margin-left: 5px;
}

@keyframes nexus-ai-wp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.nexus-ai-wp-language-switcher:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.nexus-ai-wp-language-list a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Screen reader only text */
.nexus-ai-wp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Translation Notice */
.nexus-ai-wp-translation-notice {
    background-color: #e7f3ff;
    border: 1px solid #b6d7ff;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 20px 0;
    color: #0066cc;
}

.nexus-ai-wp-translation-notice p {
    margin: 0;
}

.nexus-ai-wp-translation-notice a {
    color: #0066cc;
    text-decoration: underline;
}

.nexus-ai-wp-translation-notice a:hover {
    color: #0052a3;
}

/* Language Badge */
.nexus-ai-wp-language-badge {
    display: inline-block;
    background-color: #f1f3f4;
    color: #5f6368;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hover Effects */
.nexus-ai-wp-language-switcher .nexus-ai-wp-language-select:hover {
    border-color: #999;
}

.nexus-ai-wp-language-list a {
    position: relative;
    overflow: hidden;
}

.nexus-ai-wp-language-list a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.nexus-ai-wp-language-list a:hover::before {
    left: 100%;
}

/* Animation for language switching */
.nexus-ai-wp-content-fade {
    transition: opacity 0.3s ease-in-out;
}

.nexus-ai-wp-content-fade.switching {
    opacity: 0.5;
}

/* Print Styles */
@media print {
    .nexus-ai-wp-language-switcher {
        display: none;
    }
}