/* === Language Switcher Component Styles === */

/* Base container for all modes */
.language-switcher {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.language-switcher .language-form {
    margin: 0;
    padding: 0;
    display: inline-block;
}

/* --- Dropdown Mode --- */
.language-switcher .language-dropdown {
    position: relative;
}

.language-switcher .language-icon {
    display: block;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
    /* Base size, will be overridden by specific classes */
    width: 24px;
    height: 24px;
}

.language-switcher .language-icon:hover {
    opacity: 0.8;
}

.language-switcher .language-menu {
    position: absolute;
    display: none; /* Controlled by JS */
    top: calc(100% + 8px); /* Position below the icon with a small gap */
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 100px;
    z-index: 9999;
}

.language-switcher .language-menu button {
    /* Reset all button styles to be safe */
    all: unset;
    box-sizing: border-box; /* Re-apply box-sizing */
    display: block;
    width: 100%;
    padding: 8px 15px;
    text-align: left;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.language-switcher .language-menu button:hover {
    background-color: #f5f5f5;
}

.language-switcher .language-menu button.active {
    background-color: #007bff;
    color: white;
}

/* === MODIFIERS FOR DIFFERENT PLACEMENTS === */

/* Top-Right corner of the viewport */
.language-switcher.top-right {
    position: fixed; /* Fixed to the viewport */
    top: 20px;
    right: 25px;
    z-index: 10000; /* Highest z-index */
}

.language-switcher.top-right .language-icon {
    width: 35px; 
    height: 35px;
}

/* Special rule for login page's dark background */
.language-switcher.top-right.login-dark-bg .language-icon {
    filter: brightness(0) invert(1); /* Make icon white */
}


/* Inside the left bar (base_generic.html) */
/* This rule is intentionally very specific to win against '#lefttop img' */
div#lefttop .leftbar-language-switcher .language-switcher.leftbar .language-icon {
    width: 22px !important; /* Use !important as a last resort to win the specificity war */
    height: 22px !important;
    opacity: 0.7;
    filter: none; /* Ensure it's not white */
    border-radius: 0; /* Override the profile pic's border-radius */
    border: none;
    box-shadow: none;
    margin-top: 5px;
}