/**
 * Webtron Docs Translations - Frontend Styles
 * 
 * Language switcher and translated content indicator styles
 */

/* Language Switcher Container */
#webtron-docs-language-switcher {
    margin: 1rem 0;
}

/* Dropdown Style Switcher */
.webtron-lang-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.webtron-lang-switcher__current {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--docs-surface-color, #f8f9fa);
    border: 1px solid var(--docs-border-color, #dee2e6);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--docs-text-color, #212529);
    transition: all 0.2s ease;
}

.webtron-lang-switcher__current:hover {
    background: var(--docs-hover-color, #e9ecef);
    border-color: var(--docs-primary-color, #007bff);
}

.webtron-lang-switcher__flag {
    font-size: 1.25rem;
    line-height: 1;
}

.webtron-lang-switcher__name {
    flex: 1;
}

.webtron-lang-switcher__arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s ease;
}

.webtron-lang-switcher.open .webtron-lang-switcher__arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.webtron-lang-switcher__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 180px;
    margin-top: 4px;
    padding: 0.5rem 0;
    background: var(--docs-bg-color, #ffffff);
    border: 1px solid var(--docs-border-color, #dee2e6);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.webtron-lang-switcher.open .webtron-lang-switcher__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.webtron-lang-switcher__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--docs-text-color, #212529);
    text-align: left;
    transition: background 0.15s ease;
}

.webtron-lang-switcher__option:hover {
    background: var(--docs-hover-color, #f1f3f4);
}

.webtron-lang-switcher__option.active {
    background: var(--docs-primary-light, #e7f3ff);
    color: var(--docs-primary-color, #007bff);
    font-weight: 500;
}

.webtron-lang-switcher__option.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

.webtron-lang-switcher__option-status {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--docs-muted-color, #6c757d);
}

/* Inline/Button Style Switcher */
.webtron-lang-switcher--inline {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.webtron-lang-switcher--inline .webtron-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--docs-surface-color, #f8f9fa);
    border: 1px solid var(--docs-border-color, #dee2e6);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--docs-text-color, #212529);
    transition: all 0.2s ease;
}

.webtron-lang-switcher--inline .webtron-lang-btn:hover {
    background: var(--docs-hover-color, #e9ecef);
    border-color: var(--docs-primary-color, #007bff);
}

.webtron-lang-switcher--inline .webtron-lang-btn.active {
    background: var(--docs-primary-color, #007bff);
    border-color: var(--docs-primary-color, #007bff);
    color: #fff;
}

.webtron-lang-switcher--inline .webtron-lang-btn.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading State */
.webtron-lang-switcher.loading .webtron-lang-switcher__current,
.webtron-lang-switcher--inline.loading .webtron-lang-btn.active {
    position: relative;
    color: transparent;
}

.webtron-lang-switcher.loading .webtron-lang-switcher__current::after,
.webtron-lang-switcher--inline.loading .webtron-lang-btn.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: webtron-spin 0.6s linear infinite;
}

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

/* Translation Notice Banner */
.webtron-translation-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0 0 1.5rem 0;
    background: var(--docs-info-bg, #e7f3ff);
    border-left: 4px solid var(--docs-primary-color, #007bff);
    border-radius: 0 6px 6px 0;
    font-size: 0.875rem;
    color: var(--docs-text-color, #212529);
}

.webtron-translation-notice__icon {
    font-size: 1.25rem;
}

.webtron-translation-notice--machine {
    background: var(--docs-warning-bg, #fff8e6);
    border-color: var(--docs-warning-color, #f0ad4e);
}

.webtron-translation-notice--draft {
    background: #e7f3ff;
    border-color: #2196f3;
}

.webtron-translation-notice__link {
    margin-left: auto;
    color: var(--docs-primary-color, #007bff);
    text-decoration: none;
    font-weight: 500;
}

.webtron-translation-notice__link:hover {
    text-decoration: underline;
}

/* Content Transition */
.webtron-doc-content.translating {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.webtron-doc-content.translated {
    animation: webtron-fade-in 0.3s ease;
}

@keyframes webtron-fade-in {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* RTL Support */
[dir="rtl"] .webtron-lang-switcher__dropdown {
    left: auto;
    right: 0;
}

[dir="rtl"] .webtron-lang-switcher__option {
    text-align: right;
}

[dir="rtl"] .webtron-lang-switcher__option-status {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .webtron-translation-notice {
    border-left: none;
    border-right: 4px solid var(--docs-primary-color, #007bff);
    border-radius: 6px 0 0 6px;
}

[dir="rtl"] .webtron-translation-notice__link {
    margin-left: 0;
    margin-right: auto;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .webtron-lang-switcher__current,
    :root:not([data-theme="light"]) .webtron-lang-switcher--inline .webtron-lang-btn {
        background: var(--docs-surface-dark, #2d2d2d);
        border-color: var(--docs-border-dark, #404040);
        color: var(--docs-text-light, #e0e0e0);
    }
    
    :root:not([data-theme="light"]) .webtron-lang-switcher__dropdown {
        background: var(--docs-bg-dark, #1a1a1a);
        border-color: var(--docs-border-dark, #404040);
    }
    
    :root:not([data-theme="light"]) .webtron-translation-notice {
        background: var(--docs-info-bg-dark, #1a365d);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .webtron-lang-switcher__dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        margin: 0;
        border-radius: 16px 16px 0 0;
        overflow-y: auto;
    }
    
    .webtron-lang-switcher.open .webtron-lang-switcher__dropdown {
        transform: translateY(0);
    }
    
    .webtron-lang-switcher__option {
        padding: 1rem;
        font-size: 1rem;
    }
    
    /* Mobile overlay */
    .webtron-lang-switcher.open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }
}

/* Translation Loading Overlay */
.webtron-translation-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 100;
    border-radius: 8px;
}

.webtron-doc-content {
    position: relative;
}

.webtron-translation-loader__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--docs-primary-color, #007bff);
    border-radius: 50%;
    animation: webtron-spin 0.8s linear infinite;
}

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

.webtron-translation-loader__text {
    font-size: 0.875rem;
    color: var(--docs-muted-color, #6c757d);
    font-weight: 500;
}

/* Dark mode support */
[data-theme="dark"] .webtron-translation-loader {
    background: rgba(30, 30, 30, 0.9);
}

[data-theme="dark"] .webtron-translation-loader__spinner {
    border-color: #444;
    border-top-color: var(--docs-primary-color, #007bff);
}

[data-theme="dark"] .webtron-translation-loader__text {
    color: #aaa;
}
