/* Lingoz Public Styles */

/* Language Switcher Base Styles */
.lingoz-language-switcher {
    font-family: inherit;
    position: relative;
    display: inline-block;
}

.lingoz-language-switcher * {
    box-sizing: border-box;
}

/* Dropdown Style */
.lingoz-dropdown .lingoz-current-language {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    min-width: 120px;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.lingoz-dropdown .lingoz-current-language:hover {
    border-color: #999;
    background: #f9f9f9;
}

.lingoz-dropdown .lingoz-current-language:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.lingoz-dropdown .lingoz-language-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.lingoz-dropdown.active .lingoz-language-list {
    display: block;
}

.lingoz-dropdown .lingoz-language-list li {
    margin: 0;
    padding: 0;
}

.lingoz-dropdown .lingoz-language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.lingoz-dropdown .lingoz-language-option:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.lingoz-dropdown .lingoz-language-option.active {
    background: #007cba;
    color: #fff;
}

.lingoz-dropdown .lingoz-language-list li:last-child .lingoz-language-option {
    border-bottom: none;
}

/* Inline Style */
.lingoz-inline .lingoz-language-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.lingoz-inline .lingoz-language-item {
    margin: 0;
    padding: 0;
}

.lingoz-inline .lingoz-language-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.lingoz-inline .lingoz-language-option:hover {
    background: #e0e0e0;
    text-decoration: none;
    transform: translateY(-1px);
}

.lingoz-inline .lingoz-language-option.active {
    background: #007cba;
    color: #fff;
    border-color: #005a87;
}

/* Modal Style */
.lingoz-modal .lingoz-modal-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    transition: background-color 0.2s ease;
}

.lingoz-modal .lingoz-modal-trigger:hover {
    background: #005a87;
}

.lingoz-modal .lingoz-modal-trigger:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.lingoz-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lingoz-modal-content {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.lingoz-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.lingoz-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.lingoz-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lingoz-modal-close:hover {
    color: #333;
}

.lingoz-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.lingoz-modal .lingoz-language-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lingoz-modal .lingoz-language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.lingoz-modal .lingoz-language-option:hover {
    background: #f9f9f9;
    text-decoration: none;
}

.lingoz-modal .lingoz-language-option.active {
    background: #f0f8ff;
    border-left: 4px solid #007cba;
}

.lingoz-modal .lingoz-language-info {
    flex: 1;
}

.lingoz-modal .lingoz-native-name {
    display: block;
    font-weight: 500;
    font-size: 14px;
}

.lingoz-modal .lingoz-english-name {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.lingoz-modal .lingoz-current-indicator {
    color: #007cba;
    font-weight: bold;
}

/* Flag Styles */
.lingoz-flag {
    font-size: 16px;
    line-height: 1;
    display: inline-block;
    width: 20px;
    text-align: center;
}

/* Name Styles */
.lingoz-name {
    white-space: nowrap;
}

/* Arrow */
.lingoz-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.lingoz-dropdown.active .lingoz-arrow {
    transform: rotate(180deg);
}

/* RTL Support */
.lingoz-language-switcher[dir="rtl"],
.rtl .lingoz-language-switcher {
    direction: rtl;
}

.lingoz-language-switcher[dir="rtl"] .lingoz-dropdown .lingoz-language-list,
.rtl .lingoz-language-switcher .lingoz-dropdown .lingoz-language-list {
    left: auto;
    right: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lingoz-inline .lingoz-language-list {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .lingoz-inline .lingoz-language-option {
        width: 100%;
        justify-content: flex-start;
    }
    
    .lingoz-modal-content {
        margin: 20px;
        max-width: none;
    }
    
    .lingoz-dropdown .lingoz-current-language {
        min-width: 100px;
        font-size: 13px;
    }
}

/* Animation Classes */
.lingoz-fade-in {
    animation: lingozFadeIn 0.2s ease-out;
}

.lingoz-fade-out {
    animation: lingozFadeOut 0.2s ease-out;
}

@keyframes lingozFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes lingozFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Loading State */
.lingoz-language-switcher.loading {
    opacity: 0.6;
    pointer-events: none;
}

.lingoz-language-switcher.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 12px;
    height: 12px;
    border: 2px solid #ccc;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Accessibility */
.lingoz-language-switcher:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.lingoz-language-option:focus {
    outline: 2px solid #007cba;
    outline-offset: -2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .lingoz-language-switcher {
        border: 2px solid;
    }
    
    .lingoz-language-option {
        border: 1px solid;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .lingoz-language-switcher *,
    .lingoz-language-switcher *::before,
    .lingoz-language-switcher *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}