/* ================================================================
   AI Translate — 前台語言切換器樣式
   ================================================================ */

/* ── 浮動按鈕定位 ── */
.ait-floater {
    position: fixed;
    z-index: 9999;
}
.ait-pos-bottom-right { bottom: 24px; right: 24px; }
.ait-pos-bottom-left  { bottom: 24px; left: 24px; }
.ait-pos-top-right    { top: 90px;    right: 24px; }
.ait-pos-top-left     { top: 90px;    left: 24px; }

/* ── 切換器按鈕 ── */
.ait-switcher {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}
.ait-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #1d2327;
    color: #fff;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    transition: background .15s, box-shadow .15s;
    line-height: 1.4;
}
.ait-switcher-btn:hover {
    background: #2c3338;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.ait-switcher-btn:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}
.ait-switcher-btn::after {
    content: '▾';
    font-size: 11px;
    opacity: .7;
}

/* ── 下拉選單 ── */
.ait-dropdown {
    display: none;
    position: absolute;
    min-width: 150px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    z-index: 10000;
    animation: aitFadeIn .15s ease;
}
@keyframes aitFadeIn {
    from { opacity:0; transform: translateY(4px); }
    to   { opacity:1; transform: translateY(0); }
}

/* 浮動按鈕：底部定位 → 選單往上 / 頂部定位 → 選單往下 */
.ait-pos-bottom-right .ait-dropdown,
.ait-pos-bottom-left  .ait-dropdown {
    bottom: calc(100% + 6px);
    top: auto;
}
.ait-pos-top-right .ait-dropdown,
.ait-pos-top-left  .ait-dropdown {
    top: calc(100% + 6px);
    bottom: auto;
}
/* 左右對齊 */
.ait-pos-bottom-right .ait-dropdown,
.ait-pos-top-right    .ait-dropdown {
    right: 0;
    left: auto;
}
.ait-pos-bottom-left .ait-dropdown,
.ait-pos-top-left    .ait-dropdown {
    left: 0;
    right: auto;
}

/* Inline / Shortcode / Widget 預設往下展開 */
.ait-inline .ait-dropdown,
.ait-widget .ait-dropdown {
    top: calc(100% + 6px);
    bottom: auto;
    left: 0;
    right: auto;
}

.ait-dropdown.ait-open {
    display: block;
}
.ait-dropdown li {
    margin: 0;
    padding: 0;
    list-style: none;
}
.ait-dropdown li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: #1d2327;
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background .1s;
}
.ait-dropdown li a:hover {
    background: #f6f7f7;
    color: #2271b1;
}
.ait-dropdown li.ait-active a {
    background: #f0f6fc;
    color: #2271b1;
    font-weight: 600;
}

/* ── Inline 變體（Shortcode / Widget） ── */
.ait-inline .ait-switcher-btn,
.ait-widget .ait-switcher-btn {
    background: #2271b1;
    border-radius: 4px;
    box-shadow: none;
    font-size: 13px;
    padding: 6px 12px;
}
.ait-inline .ait-switcher-btn:hover,
.ait-widget .ait-switcher-btn:hover {
    background: #135e96;
}

/* ── Widget ── */
.widget .ait-switcher {
    margin: 4px 0;
}

/* ── 響應式 ── */
@media (max-width: 480px) {
    .ait-pos-bottom-right { bottom: 16px; right: 16px; }
    .ait-pos-bottom-left  { bottom: 16px; left: 16px; }
    .ait-pos-top-right    { top: 70px; right: 16px; }
    .ait-pos-top-left     { top: 70px; left: 16px; }
    .ait-switcher-btn {
        padding: 7px 12px;
        font-size: 13px;
    }
}
