/**
 * Saola Farm Module — Language Switcher Dropdown Styles
 */

/* ── PC Wrapper ────────────────────────────────────────────── */
.sfm-language-switcher-wrapper {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    z-index: 9999;
}

.sfm-lang-active {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit; /* Cho phép lấy màu từ Top bar */
    font-size: 14px;
    font-weight: 500;
    padding: 5px 0;
    transition: opacity 0.3s ease;
}

.sfm-lang-active:hover {
    opacity: 0.8;
}

.sfm-lang-name {
    white-space: nowrap;
}

.sfm-lang-active img, .sfm-lang-dropdown img {
    width: 22px !important;
    height: 15.4px !important;
    display: inline-block;
    border-radius: 2px;
    object-fit: cover;
    margin: 0 !important;
}

/* ── Dropdown List ─────────────────────────────────────────── */
.sfm-lang-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: #ffffff;
    padding: 8px 0;
    margin: 0;
    list-style: none;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    border-radius: 8px;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show dropdown on Hover (Desktop) */
.sfm-language-switcher-wrapper:hover .sfm-lang-dropdown,
.sfm-language-switcher-wrapper.is-open .sfm-lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sfm-lang-item {
    margin: 0;
    padding: 0;
}

.sfm-lang-item a {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #333333 !important;
    text-decoration: none !important;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.sfm-lang-item a:hover {
    background: #f8f8f8;
    color: #117552 !important;
}

/* ── Mobile Logic ──────────────────────────────────────────── */
#sfm-mobile-dynamic-header {
    display: none !important;
}

@media (max-width: 1024px) {
    /* Hide the dropdown shortcode on mobile since we inject flags separately */
    .sfm-language-switcher-wrapper {
        display: none !important;
    }

    #sfm-mobile-dynamic-header {
        display: block !important;
        position: sticky; 
        top: 0; 
        z-index: 100;
        background: #ffffff; 
        padding: 15px 10px 10px;
        text-align: center; 
        border-bottom: 1px solid #f1f1f1;
        width: 100%;
    }

    .sfm-mobile-flags-row { 
        display: flex; 
        justify-content: center; 
        gap: 15px; 
        margin-bottom: 8px; 
    }

    .sfm-flag-item { 
        width: 38px; 
        height: 38px; 
        border-radius: 50%; 
        overflow: hidden; 
        border: 2px solid #eeeeee; 
        display: inline-flex; 
        align-items: center; 
        justify-content: center; 
        transition: 0.3s; 
    }

    .sfm-flag-item.active { 
        border-color: #117552; 
        box-shadow: 0 0 8px rgba(17, 117, 82, 0.3); 
    }

    .sfm-flag-item img { 
        width: 100%; 
        height: 100%; 
        object-fit: cover; 
    }

    .sfm-mobile-menu-label { 
        font-size: 14px; 
        font-weight: 600; 
        color: #333; 
        text-transform: uppercase;
        letter-spacing: 1px;
    }
}
