/**
 * ML Translator - Language Switcher Styles
 */

.ml-language-switcher {
    position: relative;
    display: inline-block;
    font-family: inherit;
}

/* Common elements */
.ml-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

.ml-flag-img {
    display: inline-block;
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
}

.ml-flag-text {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    background: #f0f0f0;
    border-radius: 3px;
    color: #333;
}

.ml-name {
    vertical-align: middle;
}

.ml-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ml-unavailable {
    opacity: 0.6;
}

/* Dropdown Style */
.ml-dropdown {
    position: relative;
}

.ml-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1em;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    transition: all 0.2s ease;
}

.ml-dropdown-toggle:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.ml-dropdown-toggle:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.ml-arrow {
    font-size: 0.7em;
    transition: transform 0.2s ease;
}

.ml-dropdown.open .ml-arrow {
    transform: rotate(180deg);
}

.ml-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 100%;
    margin: 0;
    padding: 0.5em 0;
    list-style: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.ml-dropdown.open .ml-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ml-dropdown-menu li {
    margin: 0;
    padding: 0;
}

.ml-dropdown-menu a,
.ml-dropdown-menu .ml-disabled {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1em;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.ml-dropdown-menu a:hover {
    background: #f5f5f5;
}

.ml-dropdown-menu .ml-active a {
    background: #f0f7ff;
    font-weight: 600;
}

/* Flags Style */
.ml-flags-list {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ml-flags-list li {
    margin: 0;
    padding: 0;
}

.ml-flags-list a {
    display: inline-block;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.ml-flags-list .ml-flag-img {
    width: 28px;
    height: 19px;
}

.ml-flags-list a:hover {
    transform: scale(1.15);
}

.ml-flags-list .ml-active .ml-flag-img {
    box-shadow: 0 0 0 2px #0073aa;
}

/* Buttons Style */
.ml-buttons {
    display: inline-flex;
    gap: 0.25em;
}

.ml-button {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    padding: 0.4em 0.8em;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: inherit;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ml-button:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.ml-button.ml-active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.ml-button.ml-disabled {
    background: #f9f9f9;
    color: #999;
}

/* Links Style */
.ml-links-list {
    display: inline-flex;
    align-items: center;
    gap: 0.75em;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ml-links-list li {
    margin: 0;
    padding: 0;
}

.ml-links-list li:not(:last-child)::after {
    content: '|';
    margin-left: 0.75em;
    color: #ccc;
}

.ml-links-list a {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    color: inherit;
    text-decoration: none;
}

.ml-links-list a:hover {
    text-decoration: underline;
}

.ml-links-list .ml-active a {
    font-weight: 600;
}

/* Menu integration */
.ml-menu-language-switcher {
    display: flex;
    align-items: center;
}

.ml-menu-language-switcher .ml-language-switcher {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .ml-dropdown-menu {
        min-width: 150px;
    }

    .ml-flags-list .ml-flag {
        font-size: 1.3em;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ml-dropdown-toggle {
        background: #333;
        border-color: #555;
        color: #fff;
    }

    .ml-dropdown-toggle:hover {
        background: #444;
        border-color: #666;
    }

    .ml-dropdown-menu {
        background: #333;
        border-color: #555;
    }

    .ml-dropdown-menu a:hover {
        background: #444;
    }

    .ml-dropdown-menu .ml-active a {
        background: #2a4a6a;
    }

    .ml-button {
        background: #444;
        border-color: #555;
        color: #fff;
    }

    .ml-button:hover {
        background: #555;
        border-color: #666;
    }

    .ml-links-list li:not(:last-child)::after {
        color: #666;
    }
}
