/**
 * APYDA多语言切换器样式
 * 
 * @package APYDA_Multilang
 * @version 1.0.0
 */

/* 语言切换器基础样式 */
.apyda-language-switcher {
    position: relative;
    display: inline-block;
    font-family: inherit;
}

/* 链接样式的语言切换器 */
.apyda-language-switcher.style-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.apyda-language-switcher.style-links .language-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.apyda-language-switcher.style-links .language-link:hover {
    color: #0A3D62;
    background-color: #f3f4f6;
}

.apyda-language-switcher.style-links .language-link.current {
    color: #0A3D62;
    font-weight: 600;
    background-color: #e5f3ff;
}

.apyda-language-switcher.style-links .separator {
    color: #d1d5db;
    font-weight: 300;
}

/* 下拉菜单样式的语言切换器 */
.apyda-language-switcher.style-dropdown .dropdown-toggle {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    min-width: 120px;
}

.apyda-language-switcher.style-dropdown .dropdown-toggle:hover {
    border-color: #0A3D62;
    box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.1);
}

.apyda-language-switcher.style-dropdown .dropdown-toggle:focus {
    outline: none;
    border-color: #0A3D62;
    box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.1);
}

.apyda-language-switcher.style-dropdown .dropdown-arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.apyda-language-switcher.style-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.apyda-language-switcher.style-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    margin-top: 0.25rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.apyda-language-switcher.style-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.apyda-language-switcher.style-dropdown .dropdown-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.apyda-language-switcher.style-dropdown .dropdown-item:hover {
    background-color: #f3f4f6;
}

.apyda-language-switcher.style-dropdown .dropdown-item.current {
    background-color: #e5f3ff;
    color: #0A3D62;
    font-weight: 600;
}

.apyda-language-switcher.style-dropdown .dropdown-item:first-child {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

.apyda-language-switcher.style-dropdown .dropdown-item:last-child {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* 按钮样式的语言切换器 */
.apyda-language-switcher.style-buttons {
    display: flex;
    gap: 0.25rem;
}

.apyda-language-switcher.style-buttons .language-button {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.apyda-language-switcher.style-buttons .language-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.apyda-language-switcher.style-buttons .language-button.current {
    background: #0A3D62;
    border-color: #0A3D62;
    color: #ffffff;
}

/* 列表样式的语言切换器 */
.apyda-language-switcher.style-list {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.apyda-language-switcher.style-list .language-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
    margin-bottom: 0.25rem;
}

.apyda-language-switcher.style-list .language-item:last-child {
    margin-bottom: 0;
}

.apyda-language-switcher.style-list .language-item:hover {
    background-color: #f3f4f6;
}

.apyda-language-switcher.style-list .language-item.current {
    background-color: #e5f3ff;
    color: #0A3D62;
    font-weight: 600;
}

/* 国旗样式 */
.apyda-language-switcher .flag {
    display: inline-block;
    width: 1.25rem;
    height: 1rem;
    margin-right: 0.5rem;
    border-radius: 0.125rem;
    background-size: cover;
    background-position: center;
    vertical-align: middle;
}

.apyda-language-switcher .flag.flag-zh {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjIwIiBoZWlnaHQ9IjE2IiBmaWxsPSIjREUyOTEwIi8+CjxwYXRoIGQ9Ik0yIDJINlY2SDJWMloiIGZpbGw9IiNGRkRFMDAiLz4KPC9zdmc+');
}

.apyda-language-switcher .flag.flag-en {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjIwIiBoZWlnaHQ9IjE2IiBmaWxsPSIjMDEyMTY5Ii8+CjxyZWN0IHk9IjYiIHdpZHRoPSIyMCIgaGVpZ2h0PSI0IiBmaWxsPSIjRkZGRkZGIi8+CjxyZWN0IHk9IjEwIiB3aWR0aD0iMjAiIGhlaWdodD0iMiIgZmlsbD0iI0RFMjkxMCIvPgo8L3N2Zz4=');
}

/* 响应式设计 */
@media (max-width: 768px) {
    .apyda-language-switcher.style-links {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .apyda-language-switcher.style-buttons {
        flex-direction: column;
    }
    
    .apyda-language-switcher.style-dropdown .dropdown-toggle {
        min-width: 100px;
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }
}

/* 加载状态 */
.apyda-language-switcher.loading {
    opacity: 0.6;
    pointer-events: none;
}

.apyda-language-switcher.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #0A3D62;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 错误状态 */
.apyda-language-switcher.error {
    border-color: #ef4444;
}

.apyda-language-switcher.error .dropdown-toggle {
    border-color: #ef4444;
    color: #ef4444;
}

/* 成功状态 */
.apyda-language-switcher.success {
    border-color: #10b981;
}

.apyda-language-switcher.success .dropdown-toggle {
    border-color: #10b981;
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .apyda-language-switcher.style-dropdown .dropdown-toggle {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .apyda-language-switcher.style-dropdown .dropdown-menu {
        background: #374151;
        border-color: #4b5563;
    }
    
    .apyda-language-switcher.style-dropdown .dropdown-item {
        color: #f9fafb;
    }
    
    .apyda-language-switcher.style-dropdown .dropdown-item:hover {
        background-color: #4b5563;
    }
    
    .apyda-language-switcher.style-links .language-link {
        color: #d1d5db;
    }
    
    .apyda-language-switcher.style-links .language-link:hover {
        color: #f9fafb;
        background-color: #374151;
    }
}