/* Language flags for MkDocs Material theme */

/* Base styles for language selector links */
.md-select__link {
    position: relative;
}

/* Add flags to language codes using hreflang attribute */
.md-select__link[hreflang="en"]::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 15px;
    margin-right: 8px;
    vertical-align: middle;
    background-image: url("https://flagcdn.com/w20/us.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.md-select__link[hreflang="ru"]::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 15px;
    margin-right: 8px;
    vertical-align: middle;
    background-image: url("https://flagcdn.com/w20/ru.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.md-select__link[hreflang="es"]::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 15px;
    margin-right: 8px;
    vertical-align: middle;
    background-image: url("https://flagcdn.com/w20/es.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.md-select__link[hreflang="de"]::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 15px;
    margin-right: 8px;
    vertical-align: middle;
    background-image: url("https://flagcdn.com/w20/de.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.md-select__link[hreflang="fr"]::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 15px;
    margin-right: 8px;
    vertical-align: middle;
    background-image: url("https://flagcdn.com/w20/fr.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Styles for the language flag button */
.language-flag-button {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 3/2;
    width: 32px;
    height: 21px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.language-flag-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
    pointer-events: none;
    border-radius: 4px;
}

.language-flag-button:hover::after {
    transform: translateX(100%);
}

.language-flag-button:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Ensure the flag button is properly sized */
.md-header__option .md-select .language-flag-button {
    min-width: 32px;
    min-height: 21px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    outline: none;
}

/* Mobile responsiveness */
@media screen and (max-width: 30em) {
    /* Adapt flags for small screens */
    .md-select__link[hreflang]::before {
        width: 16px;
        height: 12px;
        margin-right: 6px;
    }
    
    /* Smaller flag button on mobile */
    .language-flag-button {
        width: 28px;
        height: 19px;
        min-width: 28px;
        min-height: 19px;
    }
}

/* Dark theme adjustments */
[data-md-color-scheme="slate"] .language-flag-button {
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-md-color-scheme="slate"] .language-flag-button:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
