/**
 * Stili per il Language Selector
 */

/* Container del selector */
.lang-selector {
    position: relative;
    display: inline-block;
    margin-left: 15px;
}

/* Bottone principale */
.lang-selector-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.lang-selector-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Bandiera emoji */
.lang-flag {
    font-size: 18px;
    line-height: 1;
}

/* Codice lingua */
.lang-code {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

/* Freccia dropdown */
.lang-arrow {
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.lang-selector.open .lang-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    min-width: 180px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.lang-selector.open .lang-dropdown,
.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Singola opzione lingua */
.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333 !important;
    text-decoration: none;
    transition: background 0.15s ease;
    background: white;
}

.lang-option:hover {
    background: #f5f5f5;
    color: #333 !important;
}

.lang-option.active {
    background: #e8f4fc;
    color: #3498db !important;
    font-weight: 600;
}

.lang-option .lang-flag {
    font-size: 20px;
}

.lang-option .lang-name {
    font-size: 14px;
}

/* ==================== VARIANTE HEADER SCURO ==================== */
/* Per header con sfondo scuro */
header .lang-selector-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

header .lang-selector-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== VARIANTE HEADER CHIARO ==================== */
/* Per header con sfondo chiaro */
.header-light .lang-selector-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.header-light .lang-selector-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* ==================== RESPONSIVE ==================== */

/* Tablet */
@media (max-width: 992px) {
    .lang-selector {
        margin-left: 10px;
    }

    .lang-selector-btn {
        padding: 5px 10px;
    }

    .lang-code {
        display: none;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Nel menu mobile, mostra come lista */
    #mainNav .lang-selector {
        width: 100%;
        margin: 10px 0;
        padding: 0;
    }

    #mainNav .lang-selector-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 15px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }

    #mainNav .lang-code {
        display: inline;
    }

    #mainNav .lang-dropdown {
        position: static;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        margin-top: 5px;
        transform: none;
    }

    #mainNav .lang-dropdown.show {
        display: block;
    }

    #mainNav .lang-option {
        color: white;
        padding: 10px 15px;
    }

    #mainNav .lang-option:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    #mainNav .lang-option.active {
        background: rgba(52, 152, 219, 0.3);
        color: white;
    }
}

/* Extra small */
@media (max-width: 480px) {
    .lang-selector-btn {
        padding: 8px 12px;
    }

    .lang-flag {
        font-size: 16px;
    }
}

/* ==================== ANIMAZIONI ==================== */

@keyframes langDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lang-dropdown.show {
    animation: langDropdownIn 0.2s ease forwards;
}

/* ==================== ACCESSIBILITA ==================== */

.lang-selector-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.lang-option:focus {
    outline: none;
    background: #e8f4fc;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
