/**
 * CCP Language Switcher Styles
 *
 * @package Cluster_Connect_Pro
 */

/* ========================================
   基础样式
   ======================================== */

.ccp-lang-switcher {
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ccp-lang-switcher * {
    box-sizing: border-box;
}

.ccp-lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 16px;
    vertical-align: middle;
    margin-right: 6px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ccp-lang-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ccp-lang-flag-emoji {
    font-size: 18px;
    line-height: 1;
    width: auto;
    height: auto;
    box-shadow: none;
}

.ccp-lang-name {
    vertical-align: middle;
    font-weight: 500;
    color: #333;
}

.ccp-lang-code {
    vertical-align: middle;
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ccp-lang-active a {
    font-weight: 600;
}

/* ========================================
   下拉菜单样式
   ======================================== */

.ccp-lang-dropdown {
    display: inline-block;
    position: relative;
}

.ccp-lang-dropdown .ccp-lang-current {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ccp-lang-dropdown .ccp-lang-current:hover {
    border-color: #bbb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.ccp-lang-arrow {
    font-size: 8px;
    margin-left: 4px;
    color: #999;
    transition: transform 0.25s ease;
}

.ccp-lang-dropdown:hover .ccp-lang-arrow,
.ccp-lang-dropdown:focus-within .ccp-lang-arrow {
    transform: rotate(180deg);
}

.ccp-lang-dropdown .ccp-lang-list {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 9999;
    min-width: 160px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ccp-lang-dropdown:hover .ccp-lang-list,
.ccp-lang-dropdown:focus-within .ccp-lang-list {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.ccp-lang-dropdown .ccp-lang-list .ccp-lang-item {
    margin: 0;
    padding: 0;
}

.ccp-lang-dropdown .ccp-lang-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ccp-lang-dropdown .ccp-lang-list a:hover {
    background: #f8f9fa;
}

.ccp-lang-dropdown .ccp-lang-active a {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    color: #0066cc;
}

/* ========================================
   列表样式
   ======================================== */

.ccp-lang-list-style {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
}

.ccp-lang-list-style .ccp-lang-item {
    margin: 0;
    padding: 0;
}

.ccp-lang-list-style a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: #555;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.2s ease;
    background: transparent;
}

.ccp-lang-list-style a:hover {
    background: #f0f0f0;
    color: #333;
}

.ccp-lang-list-style .ccp-lang-active a {
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

/* ========================================
   行内样式
   ======================================== */

.ccp-lang-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.ccp-lang-inline .ccp-lang-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 13px;
}

.ccp-lang-inline .ccp-lang-item:hover {
    background: #f0f0f0;
    color: #333;
}

.ccp-lang-inline .ccp-lang-active {
    font-weight: 600;
    color: #0066cc;
    background: #e8f4fd;
}

.ccp-lang-sep {
    color: #ddd;
    margin: 0 2px;
    user-select: none;
}

/* ========================================
   导航菜单集成样式
   ======================================== */

.ccp-menu-lang-switcher {
    position: relative;
}

.ccp-menu-lang-switcher > .menu-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.ccp-menu-lang-switcher > .menu-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ccp-menu-lang-switcher:hover > .sub-menu,
.ccp-menu-lang-switcher:focus-within > .sub-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.ccp-menu-lang-switcher > .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 9999;
    min-width: 160px;
    padding: 8px 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    list-style: none;
    margin: 8px 0 0 0;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ccp-menu-lang-switcher > .sub-menu > .menu-item {
    margin: 0;
    padding: 0;
}

.ccp-menu-lang-switcher > .sub-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ccp-menu-lang-switcher > .sub-menu a:hover {
    background: #f8f9fa;
}

.ccp-menu-lang-switcher > .sub-menu .current-lang-item a {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    color: #0066cc;
    font-weight: 500;
}

/* 下拉菜单样式的菜单项 */
.ccp-menu-lang-switcher.menu-item-dropdown > .sub-menu {
    border: none;
}

/* ========================================
   浮动按钮样式
   ======================================== */

.ccp-floating-lang-switcher {
    position: fixed;
    z-index: 99999;
}

/* 位置变体 */
.ccp-floating-top-left {
    top: 20px;
    left: 20px;
}

.ccp-floating-top-right {
    top: 20px;
    right: 20px;
}

.ccp-floating-bottom-left {
    bottom: 20px;
    left: 20px;
}

.ccp-floating-bottom-right {
    bottom: 20px;
    right: 20px;
}

/* 触发按钮 */
.ccp-floating-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ccp-floating-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.12);
}

.ccp-floating-trigger:active {
    transform: scale(1.02);
}

.ccp-floating-trigger img {
    width: 26px;
    height: auto;
}

.ccp-floating-globe {
    font-size: 26px;
}

/* 浮动语言列表 */
.ccp-floating-list {
    display: none;
    position: absolute;
    min-width: 160px;
    padding: 8px 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ccp-floating-lang-switcher:hover .ccp-floating-list,
.ccp-floating-lang-switcher:focus-within .ccp-floating-list {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.ccp-floating-bottom-left .ccp-floating-list,
.ccp-floating-bottom-right .ccp-floating-list {
    bottom: 100%;
    top: auto;
    margin-bottom: 10px;
    margin-top: 0;
}

.ccp-floating-top-left .ccp-floating-list,
.ccp-floating-top-right .ccp-floating-list {
    top: 100%;
    bottom: auto;
    margin-top: 10px;
    margin-bottom: 0;
}

.ccp-floating-bottom-left .ccp-floating-list,
.ccp-floating-top-left .ccp-floating-list {
    left: 0;
}

.ccp-floating-bottom-right .ccp-floating-list,
.ccp-floating-top-right .ccp-floating-list {
    right: 0;
}

.ccp-floating-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ccp-floating-item:hover {
    background: #f8f9fa;
}

.ccp-floating-item.ccp-lang-active {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
    color: #0066cc;
}

.ccp-floating-item img {
    width: 22px;
    height: auto;
}

/* ========================================
   RTL 支持
   ======================================== */

[dir="rtl"] .ccp-lang-flag {
    margin-right: 0;
    margin-left: 6px;
}

[dir="rtl"] .ccp-lang-dropdown .ccp-lang-list {
    left: auto;
    right: 0;
}

[dir="rtl"] .ccp-lang-arrow {
    margin-left: 0;
    margin-right: 4px;
}

[dir="rtl"] .ccp-menu-lang-switcher > .sub-menu {
    left: auto;
    right: 50%;
    transform: translateX(50%) translateY(-10px);
}

[dir="rtl"] .ccp-menu-lang-switcher:hover > .sub-menu,
[dir="rtl"] .ccp-menu-lang-switcher:focus-within > .sub-menu {
    transform: translateX(50%) translateY(0);
}

[dir="rtl"] .ccp-floating-bottom-left,
[dir="rtl"] .ccp-floating-bottom-right {
    left: auto;
    right: 20px;
}

[dir="rtl"] .ccp-floating-bottom-right {
    left: 20px;
    right: auto;
}

[dir="rtl"] .ccp-floating-bottom-left .ccp-floating-list,
[dir="rtl"] .ccp-floating-top-left .ccp-floating-list {
    left: auto;
    right: 0;
}

[dir="rtl"] .ccp-floating-bottom-right .ccp-floating-list,
[dir="rtl"] .ccp-floating-top-right .ccp-floating-list {
    right: auto;
    left: 0;
}

/* ========================================
   响应式调整 - 手机端
   ======================================== */

@media (max-width: 768px) {
    /* 浮动按钮调整 */
    .ccp-floating-lang-switcher {
        bottom: 15px;
        right: 15px;
    }

    .ccp-floating-trigger {
        width: 44px;
        height: 44px;
    }

    .ccp-floating-globe {
        font-size: 22px;
    }

    .ccp-floating-list {
        min-width: 140px;
    }

    .ccp-floating-item {
        padding: 10px 14px;
    }

    /* 导航菜单调整 */
    .ccp-menu-lang-switcher > .sub-menu {
        position: static;
        box-shadow: none;
        padding-left: 15px;
        background: transparent;
        transform: none;
        opacity: 1;
        border-radius: 0;
        min-width: auto;
    }

    .ccp-menu-lang-switcher > .menu-link {
        padding: 10px 0;
    }

    /* ========================================
       手机端：只显示国旗，隐藏其他内容
       ======================================== */

    /* 下拉菜单：只显示国旗 */
    .ccp-lang-dropdown .ccp-lang-current {
        padding: 8px;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        justify-content: center;
    }

    .ccp-lang-dropdown .ccp-lang-current .ccp-lang-name,
    .ccp-lang-dropdown .ccp-lang-current .ccp-lang-code,
    .ccp-lang-dropdown .ccp-lang-current .ccp-lang-arrow {
        display: none;
    }

    .ccp-lang-dropdown .ccp-lang-current .ccp-lang-flag {
        margin-right: 0;
    }

    /* 下拉列表中显示完整信息 */
    .ccp-lang-dropdown .ccp-lang-list .ccp-lang-name,
    .ccp-lang-dropdown .ccp-lang-list .ccp-lang-code {
        display: inline;
    }

    /* 导航菜单：只显示国旗 */
    .ccp-menu-lang-switcher > .menu-link .ccp-lang-name,
    .ccp-menu-lang-switcher > .menu-link .ccp-lang-code {
        display: none;
    }

    .ccp-menu-lang-switcher > .menu-link .ccp-lang-flag {
        margin-right: 0;
    }

    .ccp-menu-lang-switcher > .menu-link {
        padding: 8px;
    }

    /* 导航子菜单中显示完整信息 */
    .ccp-menu-lang-switcher > .sub-menu .ccp-lang-name,
    .ccp-menu-lang-switcher > .sub-menu .ccp-lang-code {
        display: inline;
    }

    /* 列表样式：只显示国旗 */
    .ccp-lang-list-style a {
        padding: 6px;
        border-radius: 50%;
    }

    .ccp-lang-list-style .ccp-lang-name,
    .ccp-lang-list-style .ccp-lang-code {
        display: none;
    }

    .ccp-lang-list-style .ccp-lang-flag {
        margin-right: 0;
    }

    /* 行内样式：只显示国旗 */
    .ccp-lang-inline .ccp-lang-item {
        padding: 6px;
        border-radius: 50%;
    }

    .ccp-lang-inline .ccp-lang-name,
    .ccp-lang-inline .ccp-lang-code {
        display: none;
    }

    .ccp-lang-inline .ccp-lang-flag {
        margin-right: 0;
    }

    .ccp-lang-sep {
        display: none;
    }

    /* 浮动列表中显示完整信息 */
    .ccp-floating-item .ccp-lang-name,
    .ccp-floating-item .ccp-lang-code {
        display: inline;
    }

    /* 国旗在手机端稍大 */
    .ccp-lang-flag {
        width: 24px;
        height: 18px;
    }

    .ccp-lang-flag-emoji {
        font-size: 20px;
    }
}

/* ========================================
   超小屏幕调整 (< 480px)
   ======================================== */

@media (max-width: 480px) {
    .ccp-floating-trigger {
        width: 40px;
        height: 40px;
    }

    .ccp-floating-globe {
        font-size: 20px;
    }

    .ccp-lang-dropdown .ccp-lang-current {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .ccp-lang-flag {
        width: 22px;
        height: 16px;
    }

    .ccp-lang-flag-emoji {
        font-size: 18px;
    }
}
