/* ========================================
   Language Switcher 触发按钮
   ======================================== */

.lang-switcher-btn {
    display: flex;
    gap: 3px;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity 0.15s;
    user-select: none;
    align-items: center;
    justify-content: center;
    height: 50px;
}

.lang-switcher-btn:hover {
    opacity: 0.8;
}

.lang-switcher-flag {
    width: 28px;
    height: 21px !important;
    object-fit: cover;
}

.lang-r {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}


.lang-switcher-code {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: inherit;
}

.lang-switcher-arrow {
    margin-left: 0;
    transition: transform 0.2s;
}

.lang-mega-dropdown.visible ~ * .lang-switcher-arrow,
.lang-switcher-btn.open .lang-switcher-arrow {
    transform: rotate(180deg);
}

/* ========================================
   Language Mega Menu
   ======================================== */

.lang-mega-dropdown {
    position: fixed;
    z-index: 999999;
    width: 100%;
    max-width: 100%;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
    pointer-events: none;
    left: 0 !important;
    right: 0;
}

.lang-mega-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.lang-mega-inner {
    display: flex;
    min-height: 400px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 0;
}

/* --- 左栏：地区列表 --- */
.lang-mega-regions {
    width: 220px;
    flex-shrink: 0;
    padding: 20px 0;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

#langMegaDropdown .lang-region-item {
    display: flex;
    align-items: center;
    padding: 12px 22px;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

#langMegaDropdown .lang-region-item:hover,
#langMegaDropdown .lang-region-item.active {
    color: #ff6a00;
}

/* --- 右栏：国家列表 --- */
.lang-mega-countries {
    flex: 1;
    padding: 24px 28px;
    position: relative;
    overflow: hidden;
}

.lang-country-group {
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 32px;
    align-content: start;
}

.lang-country-group.active {
    display: grid;
}

#langMegaDropdown .lang-country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    text-decoration: none;
    color: #333;
    font-size: 13.5px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

#langMegaDropdown .lang-country-item:hover {
    background: #f5f5f5;
    color: #ff6a00;
}

.lang-country-flag {
    width: 22px;
    height: 16px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.lang-country-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 右栏：货币列表 --- */
.lang-mega-currencies {
    width: 180px;
    flex-shrink: 0;
    padding: 20px 0;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.lang-mega-currencies-title {
    padding: 0 22px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
}

#langMegaDropdown .lang-currency-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

#langMegaDropdown .lang-currency-item:hover {
    background: #f5f5f5;
    color: #ff6a00;
}

#langMegaDropdown .lang-currency-item.active {
    color: #ff6a00;
    font-weight: 600;
    background: #fff7f2;
}

.lang-currency-code {
    font-weight: inherit;
}

.lang-currency-sym {
    font-size: 15px;
    opacity: 0.6;
}

#langMegaDropdown .lang-currency-item.active .lang-currency-sym {
    opacity: 1;
}

/* 隐藏原始 GTranslate 下拉 */
.lang-mega-active-trigger .gt_selector,
.lang-mega-active-trigger select.gt_selector,
.lang-mega-active-trigger .gt-current-wrapper + ul,
.lang-mega-active-trigger > .sub-menu {
    display: none !important;
}

/* ========================================
   Currency Switch Toast
   ======================================== */

.lc-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.lc-toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.lc-toast-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
    padding: 16px 20px;
    max-width: 560px;
    min-width: 380px;
    position: relative;
    border: 1px solid rgba(0,0,0,0.06);
}

.lc-toast-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFF4EB;
    border-radius: 10px;
}

.lc-toast-body {
    flex: 1;
    min-width: 0;
}

.lc-toast-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 2px;
    line-height: 1.4;
}

.lc-toast-sub {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.4;
}

.lc-toast-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.lc-toast-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}

.lc-toast-btn:active {
    transform: scale(0.97);
}

.lc-toast-accept {
    background: #ff6a00;
    color: #fff;
}

.lc-toast-accept:hover {
    background: #e55e00;
}

.lc-toast-dismiss {
    background: #f0f0f0;
    color: #555;
}

.lc-toast-dismiss:hover {
    background: #e4e4e4;
}

.lc-toast-close {
    position: fixed;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    color: #999;
    transition: color 0.15s, border-color 0.15s;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.lc-toast-close:hover {
    color: #333;
    border-color: #bbb;
}

/* ========================================
   Mobile close button (hidden on desktop)
   ======================================== */

.lang-mega-close {
    display: none;
}

/* ========================================
   Mobile: full-screen panel
   ======================================== */

@media (max-width: 1024px) {
    .lang-mega-dropdown {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.45);
        box-shadow: none;
        transform: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    .lang-mega-dropdown.visible.mobile-mode {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .lang-mega-close {
        display: flex;
        position: absolute;
        top: auto;
        bottom: calc(80vh + 8px);
        right: 16px;
        z-index: 10;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #fff;
        border: none;
        font-size: 22px;
        line-height: 1;
        color: #666;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .lang-mega-close:hover {
        color: #333;
    }

    .lang-mega-inner {
        flex-direction: column;
        min-height: 0;
        max-height: 80vh;
        background: #fff;
        border-radius: 16px 16px 0 0;
        padding: 0;
        overflow: hidden;
        width: 100%;
    }

    .lang-mega-regions {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 0 12px 0;
        gap: 0;
        flex-shrink: 0;
        -webkit-overflow-scrolling: touch;
    }

    #langMegaDropdown .lang-region-item {
        white-space: nowrap;
        padding: 10px 16px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .lang-mega-countries {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        -webkit-overflow-scrolling: touch;
    }

    .lang-country-group {
        grid-template-columns: 1fr 1fr;
        gap: 2px 12px;
    }

    #langMegaDropdown .lang-country-item {
        padding: 10px 8px;
        font-size: 13px;
        gap: 8px;
    }

    .lang-mega-currencies {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-left: none;
        border-top: 1px solid #eee;
        padding: 12px 16px;
        gap: 8px;
        flex-shrink: 0;
    }

    .lang-mega-currencies-title {
        width: 100%;
        padding: 0 0 6px;
    }

    #langMegaDropdown .lang-currency-item {
        padding: 8px 14px;
        font-size: 13px;
        border: 1px solid #eee;
        border-radius: 8px;
        gap: 6px;
    }

    #langMegaDropdown .lang-currency-item.active {
        border-color: #ff6a00;
    }
}

@media (max-width: 600px) {
    .lang-country-group {
        grid-template-columns: 1fr;
    }

    .lc-toast-inner {
        flex-wrap: wrap;
        min-width: 0;
        max-width: calc(100vw - 32px);
        gap: 10px;
        padding: 14px 16px;
    }
    .lc-toast-actions {
        width: 100%;
    }
    .lc-toast-btn {
        flex: 1;
        text-align: center;
    }
}
