/* ============================================
   KKI Multilang — Language Switcher Styles
   Palette: navy #131a24 · gold #b8a97d · cream #f0eee9
   ============================================ */

.kki-ml-switcher {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: center;
}

.kki-ml-switcher__item {
    margin: 0;
    padding: 0;
}

.kki-ml-switcher__item a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    text-decoration: none;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 500;
    color: #131a24;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
}

.kki-ml-switcher__item a:hover {
    color: #b8a97d;
    background: rgba(184, 169, 125, 0.08);
}

.kki-ml-switcher__item.is-active a {
    color: #b8a97d;
    font-weight: 600;
    background: rgba(184, 169, 125, 0.12);
}

.kki-ml-switcher__flag {
    display: inline-flex;
    align-items: center;
}

.kki-ml-switcher__flag img {
    width: 20px;
    height: auto;
    display: block;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.kki-ml-switcher__label {
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 600;
}

.kki-ml-switcher__native {
    font-size: 13px;
    font-weight: 500;
}

.kki-ml-switcher__code {
    font-size: 10px;
    letter-spacing: 0.12em;
    color: #999;
    margin-left: auto;
    padding-left: 12px;
    font-weight: 600;
}

.kki-ml-switcher__check {
    color: #b8a97d;
    font-weight: 600;
    margin-left: 8px;
}

/* ============================================
   DROPDOWN STYLE
   ============================================ */

.kki-ml-switcher--dropdown {
    position: relative;
    display: inline-block;
}

.kki-ml-switcher__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 500;
    color: #131a24;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 100px;
    transition: all 0.2s ease;
}

.kki-ml-switcher__trigger:hover {
    background: rgba(184, 169, 125, 0.12);
}

.kki-ml-switcher__trigger .kki-ml-switcher__flag img {
    width: 18px;
    border-radius: 50%;
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.8);
}

.kki-ml-switcher__caret {
    font-size: 11px;
    color: #8a7a4e;
    margin-left: 4px;
    transition: transform 0.2s ease;
}

.kki-ml-switcher--dropdown.is-open .kki-ml-switcher__caret {
    transform: rotate(180deg);
}

.kki-ml-switcher__menu {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid rgba(184, 169, 125, 0.3);
    border-radius: 4px;
    box-shadow:
        0 4px 16px rgba(19, 26, 36, 0.08),
        0 12px 40px rgba(19, 26, 36, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s ease;
    z-index: 10000;
    max-height: 420px;
    overflow-y: auto;
}

.kki-ml-switcher--dropdown.is-open .kki-ml-switcher__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Left-aligned menu when dropdown is on left side */
.kki-ml-float-top-left .kki-ml-switcher__menu,
.kki-ml-float-bottom-left .kki-ml-switcher__menu {
    right: auto;
    left: 0;
}

.kki-ml-switcher--dropdown .kki-ml-switcher__item {
    display: block;
}

.kki-ml-switcher--dropdown .kki-ml-switcher__item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #131a24;
    font-size: 13px;
}

.kki-ml-switcher--dropdown .kki-ml-switcher__item a:hover {
    background: rgba(184, 169, 125, 0.08);
    color: #131a24;
}

.kki-ml-switcher--dropdown .kki-ml-switcher__item.is-active a {
    background: rgba(184, 169, 125, 0.12);
    color: #b8a97d;
    font-weight: 600;
}

.kki-ml-switcher--dropdown .kki-ml-switcher__native {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
}

.kki-ml-switcher--dropdown .kki-ml-switcher__flag img {
    width: 18px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

/* ============================================
   FLOATING CONTAINER
   ============================================ */

.kki-ml-float {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid rgba(184, 169, 125, 0.4);
    border-radius: 100px;
    padding: 2px;
    box-shadow:
        0 2px 8px rgba(19, 26, 36, 0.08),
        0 8px 24px rgba(19, 26, 36, 0.06);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s ease;
    animation: kki-ml-fadein 0.4s ease-out;
}

.kki-ml-float--dropdown {
    border-radius: 100px;
    padding: 0;
    overflow: visible;
}

@keyframes kki-ml-fadein {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.kki-ml-float:hover {
    box-shadow:
        0 4px 12px rgba(19, 26, 36, 0.12),
        0 12px 32px rgba(19, 26, 36, 0.1);
    border-color: rgba(184, 169, 125, 0.7);
}

.kki-ml-float-top-right    { top: 24px;    right: 24px; }
.kki-ml-float-top-left     { top: 24px;    left: 24px; }
.kki-ml-float-bottom-right { bottom: 24px; right: 24px; }
.kki-ml-float-bottom-left  { bottom: 24px; left: 24px; }

.kki-ml-float .kki-ml-switcher {
    gap: 0;
    padding: 0;
    background: transparent;
}

.kki-ml-float .kki-ml-switcher--inline .kki-ml-switcher__item a {
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 12px;
    color: #131a24;
}

.kki-ml-float .kki-ml-switcher--inline .kki-ml-switcher__item.is-active a {
    background: #131a24;
    color: #f0eee9;
    box-shadow: 0 2px 4px rgba(19, 26, 36, 0.15);
}

/* Mobile */
@media (max-width: 768px) {
    .kki-ml-float {
        top: auto;
        left: auto;
        right: 16px;
        bottom: 16px;
    }
    .kki-ml-float-top-right,
    .kki-ml-float-top-left,
    .kki-ml-float-bottom-right,
    .kki-ml-float-bottom-left {
        top: auto;
        left: auto;
        right: 16px;
        bottom: 16px;
    }
    .kki-ml-switcher__trigger {
        padding: 8px 14px;
        font-size: 12px;
    }
    .kki-ml-switcher__menu {
        min-width: 200px;
        right: 0;
        left: auto;
    }
    /* On mobile: open upward to avoid being cut off */
    .kki-ml-float .kki-ml-switcher__menu {
        top: auto;
        bottom: calc(100% + 6px);
    }
}

/* ============================================
   NAVBAR INJECTION — In-theme menu style
   ============================================ */

/* Container li */
.kki-ml-menu-item {
    position: relative;
}

/* Trigger button (current language) — styled to match theme menu links */
.kki-ml-nav-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    cursor: pointer !important;
    background: transparent !important;
    border: none !important;
    padding: inherit !important;
    margin: 0 !important;
    font: inherit !important;
    color: inherit !important;
    letter-spacing: inherit !important;
    text-transform: inherit !important;
    line-height: inherit !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    outline: none !important;
}

.kki-ml-nav-trigger:focus-visible {
    outline: 2px solid #b8a97d !important;
    outline-offset: 2px !important;
}

.kki-ml-nav-trigger::after {
    content: "▾";
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.kki-ml-menu-item:hover .kki-ml-nav-trigger::after,
.kki-ml-menu-item.is-hover .kki-ml-nav-trigger::after {
    transform: rotate(180deg);
}

/* Flag in navbar */
.kki-ml-nav-flag {
    width: 18px !important;
    height: auto !important;
    border-radius: 50% !important;
    vertical-align: middle !important;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.2) !important;
    display: inline-block !important;
}

.kki-ml-nav-native,
.kki-ml-nav-code {
    font-weight: inherit;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 12px;
}

/* Sub-menu dropdown */
.kki-ml-nav-submenu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    min-width: 220px !important;
    background: #ffffff !important;
    border: 1px solid rgba(184, 169, 125, 0.3) !important;
    box-shadow: 0 8px 24px rgba(19, 26, 36, 0.12) !important;
    list-style: none !important;
    margin: 8px 0 0 0 !important;
    padding: 6px 0 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 99999 !important;
    max-height: 420px;
    overflow-y: auto;
}

.kki-ml-menu-item:hover > .kki-ml-nav-submenu,
.kki-ml-menu-item:focus-within > .kki-ml-nav-submenu,
.kki-ml-menu-item.is-hover > .kki-ml-nav-submenu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Sub-menu items */
.kki-ml-nav-submenu > li {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
    transform: none !important;
    position: static !important;
}

.kki-ml-nav-submenu .kki-ml-nav-link {
    display: flex !important;
    align-items: center;
    gap: 10px !important;
    padding: 10px 16px !important;
    color: #131a24 !important;
    text-decoration: none !important;
    background: transparent !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    line-height: 1.3 !important;
    transition: background 0.15s ease !important;
}

.kki-ml-nav-submenu .kki-ml-nav-link:hover {
    background: rgba(184, 169, 125, 0.1) !important;
    color: #131a24 !important;
}

.kki-ml-nav-submenu .kki-ml-active-item .kki-ml-nav-link {
    background: rgba(184, 169, 125, 0.15) !important;
    color: #b8a97d !important;
    font-weight: 600 !important;
}

.kki-ml-nav-submenu .kki-ml-nav-link .kki-ml-nav-flag {
    width: 16px !important;
}

.kki-ml-nav-submenu .kki-ml-nav-native {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 13px !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .kki-ml-nav-submenu {
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        max-height: none !important;
    }
}

/* Body class hooks */
body.kki-ml-lang-th { /* Thai-specific adjustments */ }
body.kki-ml-lang-en { /* English-specific */ }

/* RTL support for Arabic */
body.kki-ml-lang-ar .kki-ml-switcher__menu {
    right: auto;
    left: 0;
}
