/* ============================================================================
   SIMPLE MULTILANG - FRONTEND STYLES
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. BASE STYLES
   ------------------------------------------------------------------------- */
.sm-language-switcher {
    display: inline-block;
    vertical-align: middle;
    line-height: normal;
    /* Reset line-height */
}

.sm-check-icon {
    width: 1.25em;
    height: 1.25em;
    margin-right: 0.25em;
    vertical-align: -0.25em;
    display: inline-block;
}

.sm-language-switcher * {
    box-sizing: border-box;
}

/* ISOLATION: Reset theme styles for our interactive elements */
.sm-language-switcher button,
.sm-language-switcher select,
.sm-language-switcher .sm-lang-btn,
.sm-language-switcher .sm-lang-text {
    all: unset !important;

    /* Strict Reset of Potential Theme Properties */
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    text-shadow: none !important;
    letter-spacing: normal !important;

    /* Re-apply Essentials */
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    color: inherit;
    /* Allow color to be set by modifiers */
}

/* Specific Re-application for Select */
.sm-language-switcher select,
.sm-language-switcher .sm-lang-select {
    display: block;
    /* Selects usually block or inline-block */
    appearance: none;
    /* We allow custom styling */
    -webkit-appearance: none;
}

/* Loading Animation */
@keyframes sm-spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: wait;
}

/* ----------------------------------------------------------------------------
   2. FLOATING WIDGET POSTIONING
   ------------------------------------------------------------------------- */
.sm-floating-widget {
    position: fixed;
    z-index: 99999;
    padding: 10px;
    background: transparent;
}

.sm-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.sm-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.sm-position-top-right {
    top: 20px;
    right: 20px;
}

.sm-position-top-left {
    top: 20px;
    left: 20px;
}

/* ----------------------------------------------------------------------------
   3. STYLE: DEFAULT (Original Buttons)
   ------------------------------------------------------------------------- */
/* Switcher Buttons Container */
.sm-switcher-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Language Button */
.sm-lang-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 16px !important;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #333 !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    margin: 0 !important;
}

.sm-lang-btn:hover {
    border-color: #0073aa !important;
    background: #f0f6fc !important;
    color: #333 !important;
}

.sm-lang-btn.active {
    background: #0073aa !important;
    border-color: #0073aa !important;
    color: #ffffff !important;
    box-shadow: 0 2px 5px rgba(0, 115, 170, 0.2) !important;
}

.sm-lang-btn.active:hover {
    background: #005a87 !important;
    border-color: #005a87 !important;
}

/* Flag Icon */
.sm-lang-btn .sm-flag {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
}

.sm-lang-btn .sm-lang-name,
.sm-lang-btn .sm-lang-code {
    font-family: inherit;
}

/* Loading spinner for buttons */
.sm-lang-btn.loading::after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: sm-spin 0.6s linear infinite;
}


/* ----------------------------------------------------------------------------
   4. STYLE: COMPACT (Small Buttons)
   ------------------------------------------------------------------------- */
.sm-style-compact .sm-switcher-buttons {
    gap: 4px !important;
    background: #fff !important;
    padding: 4px !important;
    border: 1px solid #ddd !important;
    border-radius: 30px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}

.sm-style-compact .sm-lang-btn {
    padding: 6px 12px !important;
    font-size: 13px !important;
    border: none !important;
    border-radius: 20px !important;
    background: transparent !important;
    color: #333 !important;
}

.sm-style-compact .sm-lang-btn:hover {
    background: #f5f5f5;
}

.sm-style-compact .sm-lang-btn.active {
    background: #0073aa;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sm-style-compact .sm-flag {
    font-size: 16px;
    margin: 0;
}

/* ----------------------------------------------------------------------------
   5. STYLE: SHORT TEXT (EN | VI)
   ------------------------------------------------------------------------- */
.sm-style-short {
    font-family: sans-serif;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #eee;
}

.sm-lang-text {
    background: none;
    border: none;
    padding: 0 4px;
    cursor: pointer;
    color: #888;
    font-weight: inherit;
    transition: color 0.2s;
    font-size: inherit;
}

.sm-lang-text:hover {
    color: #333;
}

.sm-lang-text.active {
    color: #0073aa;
    border-bottom: 2px solid #0073aa;
}

.sm-separator {
    color: #ccc;
    margin: 0 2px;
    font-weight: 300;
}

/* ----------------------------------------------------------------------------
   6. STYLE: DROPDOWN (Select)
   ------------------------------------------------------------------------- */
.sm-style-dropdown select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
    min-width: 120px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sm-style-dropdown select:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

/* ----------------------------------------------------------------------------
   7. RESPONSIVE & UTILS
   ------------------------------------------------------------------------- */
/* No Flags Variant */
.sm-no-flags .sm-lang-btn {
    padding: 8px 14px;
}

@media (max-width: 480px) {

    /* On very small screens, make default buttons stack if needed in future */
    /* .sm-switcher-buttons { flex-direction: column; } */

    .sm-floating-widget {
        bottom: 10px;
        right: 10px;
        /* Force bottom right on mobile usually better? Or respect setting */
    }
}