/**
 * BlessTop 语言切换器样式
 * 支持多种显示模式和响应式设计
 */

/* 基础语言切换器样式 */
.bless-language-switcher {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 下拉菜单样式 */
.bless-language-switcher.dropdown {
    z-index: 1000;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: 500;
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.language-toggle:active {
    transform: translateY(0);
}

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

.language-name {
    font-size: 14px;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
    margin-left: 4px;
}

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

/* 下拉菜单内容 */
.language-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: rgba(26, 15, 20, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 192, 203, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    min-width: 180px;
    overflow: hidden;
}

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

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #ffe8f4;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 192, 203, 0.1);
    font-size: 14px;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: rgba(255, 154, 196, 0.1);
    color: #ff9ac4;
    transform: translateX(4px);
}

.language-option:active {
    background: rgba(255, 154, 196, 0.2);
}

/* 列表样式 */
.bless-language-switcher.list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bless-language-switcher.list .language-option {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.bless-language-switcher.list .language-option:hover {
    background: rgba(255, 154, 196, 0.2);
    border-color: rgba(255, 154, 196, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 154, 196, 0.2);
}

.bless-language-switcher.list .language-option.active {
    background: linear-gradient(135deg, #ff9ac4 0%, #ffb347 50%, #ffd700 100%);
    border-color: transparent;
    color: #2a1a1f;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 154, 196, 0.4);
}

/* RTL语言支持 */
.bless-language-switcher[dir="rtl"] {
    direction: rtl;
}

.bless-language-switcher[dir="rtl"] .language-toggle {
    flex-direction: row-reverse;
}

.bless-language-switcher[dir="rtl"] .language-dropdown-menu {
    left: auto;
    right: 0;
}

.bless-language-switcher[dir="rtl"] .language-option:hover {
    transform: translateX(-4px);
}

/* 紧凑模式 */
.bless-language-switcher.compact .language-toggle {
    padding: 6px 8px;
    font-size: 12px;
}

.bless-language-switcher.compact .language-name {
    display: none;
}

.bless-language-switcher.compact .language-flag {
    font-size: 14px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .bless-language-switcher.dropdown {
        position: static;
    }
    
    .language-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .language-option {
        padding: 16px 20px;
        font-size: 16px;
        border-bottom: 1px solid rgba(255, 192, 203, 0.1);
    }
    
    .language-option:hover {
        transform: none;
        background: rgba(255, 154, 196, 0.15);
    }
    
    /* 移动端列表模式 */
    .bless-language-switcher.list {
        justify-content: center;
        gap: 6px;
    }
    
    .bless-language-switcher.list .language-option {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    .language-toggle {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .language-name {
        font-size: 12px;
    }
    
    .bless-language-switcher.list .language-option {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 40px;
    }
    
    .language-dropdown-menu {
        border-radius: 16px 16px 0 0;
    }
}

/* 动画效果 */
@keyframes languageFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes languageSlideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.language-option {
    animation: languageSlideIn 0.3s ease forwards;
}

.language-option:nth-child(1) { animation-delay: 0.05s; }
.language-option:nth-child(2) { animation-delay: 0.1s; }
.language-option:nth-child(3) { animation-delay: 0.15s; }
.language-option:nth-child(4) { animation-delay: 0.2s; }
.language-option:nth-child(5) { animation-delay: 0.25s; }

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .language-toggle {
        border: 2px solid #fff;
        background: rgba(0, 0, 0, 0.8);
    }
    
    .language-dropdown-menu {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid #fff;
    }
    
    .language-option:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
    .language-toggle,
    .language-dropdown-menu,
    .language-option,
    .dropdown-arrow {
        transition: none;
        animation: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .bless-language-switcher.list .language-option {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: #f0f0f0;
    }
    
    .bless-language-switcher.list .language-option:hover {
        background: rgba(255, 154, 196, 0.15);
    }
}

/* 焦点样式 */
.language-toggle:focus,
.language-option:focus {
    outline: 2px solid #ff9ac4;
    outline-offset: 2px;
}

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

.bless-language-switcher.loading .language-toggle::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* 阿拉伯语字体和RTL优化 */
.bless-language-switcher[data-lang="ar"],
.bless-language-switcher[data-lang="ar"] * {
    font-family: 'Noto Sans Arabic', 'Arabic UI Text', 'Geeza Pro', 'Damascus', 'Al Bayan', 'Lucida Grande', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

.bless-language-switcher[data-lang="ar"] .language-toggle {
    flex-direction: row-reverse;
}

.bless-language-switcher[data-lang="ar"] .language-dropdown-menu {
    left: auto;
    right: 0;
    text-align: right;
}

.bless-language-switcher[data-lang="ar"] .language-option {
    text-align: right;
    padding: 12px 8px 12px 16px;
    flex-direction: row-reverse;
}

.bless-language-switcher[data-lang="ar"] .language-option:hover {
    transform: translateX(-4px);
}

.bless-language-switcher[data-lang="ar"] .language-flag {
    margin-left: 8px;
    margin-right: 0;
}

.bless-language-switcher[data-lang="ar"] .dropdown-arrow {
    margin-left: 0;
    margin-right: 4px;
}

/* 巴西葡萄牙语字体优化 */
.bless-language-switcher[data-lang="pt-BR"],
.bless-language-switcher[data-lang="pt-BR"] * {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    line-height: 1.5;
}

/* 全局RTL支持 */
body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

body[dir="rtl"] .bless-language-switcher {
    direction: rtl;
}

body[dir="rtl"] .language-switcher-container {
    left: 20px;
    right: auto;
}

@media (max-width: 768px) {
    body[dir="rtl"] .language-switcher-container {
        left: 10px;
        right: auto;
    }
}
