/**
 * Custom Language Translator Styles
 */

/* Main wrapper */
.custom-translator-wrapper {
    display: inline-block;
    font-family: Arial, sans-serif;
}

/* Flags style selector - Minimized for encouraging dropdown use */
.translator-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 10px 0;
    justify-content: center;
}

.translator-flags .lang-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 10px;
    text-decoration: none;
    color: #666;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    min-height: 36px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.translator-flags .lang-link:hover {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border-color: #007cba;
    color: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 124, 186, 0.2);
}

.translator-flags .lang-link.current-lang {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border-color: #004a73;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(0, 124, 186, 0.3);
}

.translator-flags .lang-link img {
    margin-right: 8px;
    border-radius: 2px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    /* Smaller flags for compact display */
    min-width: 24px;
    min-height: 18px;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: middle;
}

/* Dropdown style selector - Improved */
.translator-dropdown {
    position: relative;
    display: inline-block;
    margin: 10px 0;
}

.translator-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    min-width: 200px;
    min-height: 52px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    user-select: none;
}

.translator-dropdown .dropdown-toggle:hover {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border-color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 124, 186, 0.25);
}

.translator-dropdown .dropdown-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.translator-dropdown .dropdown-toggle img {
    margin-right: 12px;
    border-radius: 4px;
    /*border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);*/
    /* Ensure flags are larger and more visible */
    min-width: 36px;
    min-height: 27px;
    object-fit: cover;
}

.translator-dropdown .dropdown-arrow {
    margin-left: auto;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.3s ease;
    color: #fff;
    padding-left: 8px;
}

.translator-dropdown .dropdown-menu.show .dropdown-toggle .dropdown-arrow {
    transform: rotate(180deg);
    color: #007cba;
}

.translator-dropdown .dropdown-menu {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-15px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 400px;
    overflow-y: auto;
    margin-top: 8px;
    backdrop-filter: blur(10px);
}

/* Custom scrollbar for dropdown */
.translator-dropdown .dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.translator-dropdown .dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.translator-dropdown .dropdown-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    border-radius: 10px;
}

.translator-dropdown .dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0088d0 0%, #006b9a 100%);
}

.translator-dropdown .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.translator-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    text-decoration: none;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
    white-space: nowrap;
    position: relative;
}

.translator-dropdown .dropdown-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.translator-dropdown .dropdown-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.translator-dropdown .dropdown-item:hover {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    color: #005a87;
    /*transform: translateX(4px);*/
    padding-left: 18px;
}

.translator-dropdown .dropdown-item.current-lang {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    font-weight: 600;
}

.translator-dropdown .dropdown-item.current-lang:hover {
    background: linear-gradient(135deg, #0088d0 0%, #006b9a 100%);
    transform: translateX(2px);
}

.translator-dropdown .dropdown-item img {
    margin-right: 14px;
    border-radius: 4px;
    /*border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);*/
    /* Ensure flags are larger and more visible */
    min-width: 36px;
    min-height: 27px;
    object-fit: cover;
}

/* Widget styles */
.widget .custom-translator-wrapper {
    width: 100%;
}

.widget .translator-flags {
    justify-content: center;
}

.widget .translator-flags .lang-link {
    margin: 2px;
    padding: 4px 8px;
    font-size: 12px;
}

/* Responsive design */
@media (max-width: 768px) {
    .translator-flags {
        gap: 4px;
    }
    
    .translator-flags .lang-link {
        padding: 4px 6px;
        font-size: 12px;
    }
    
    .translator-flags .lang-link span {
        display: none;
    }
    
    .translator-dropdown .dropdown-toggle {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 100px;
    }
    
    .translator-dropdown .dropdown-item {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .translator-flags .lang-link {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .translator-flags .lang-link:hover {
        background: #3a3a3a;
        border-color: #007cba;
        color: #87ceeb;
    }
    
    .translator-dropdown .dropdown-toggle {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .translator-dropdown .dropdown-toggle:hover {
        background: #3a3a3a;
        border-color: #007cba;
    }
    
    .translator-dropdown .dropdown-menu {
        background: #2c2c2c;
        border-color: #444;
    }
    
    .translator-dropdown .dropdown-item {
        color: #9b9b9b;
    }
    
    .translator-dropdown .dropdown-item:hover {
        background: #3a3a3a;
        color: #87ceeb;
    }
}

/* Loading state */
.custom-translator-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Animation for language switching */
.translator-flags .lang-link.switching {
    transform: scale(0.95);
    opacity: 0.7;
}

/* Accessibility improvements */
.translator-flags .lang-link:focus,
.translator-dropdown .dropdown-toggle:focus,
.translator-dropdown .dropdown-item:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .translator-flags .lang-link {
        border-width: 2px;
    }
    
    .translator-flags .lang-link.current-lang {
        border-width: 3px;
    }
    
    .translator-dropdown .dropdown-toggle,
    .translator-dropdown .dropdown-menu {
        border-width: 2px;
    }
}

/* RTL support */
[dir="rtl"] .translator-flags .lang-link img {
    margin-right: 0;
    margin-left: 6px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .translator-flags {
        gap: 8px;
        justify-content: center;
    }
    
    .translator-flags .lang-link {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .translator-flags .lang-link img {
        min-width: 28px;
        min-height: 20px;
        margin-right: 8px;
    }
    
    .translator-dropdown .dropdown-toggle {
        min-width: 160px;
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .translator-dropdown .dropdown-toggle img {
        min-width: 28px;
        min-height: 20px;
        margin-right: 10px;
    }
    
    .translator-dropdown .dropdown-item {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .translator-dropdown .dropdown-item img {
        min-width: 28px;
        min-height: 20px;
        margin-right: 10px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .translator-flags {
        gap: 6px;
    }
    
    .translator-flags .lang-link {
        padding: 6px 8px;
        font-size: 13px;
        min-height: 36px;
    }
    
    .translator-flags .lang-link img {
        min-width: 24px;
        min-height: 18px;
        margin-right: 6px;
    }
    
    .translator-dropdown .dropdown-toggle {
        min-width: 140px;
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
    }
    
    .translator-dropdown .dropdown-toggle img {
        min-width: 24px;
        min-height: 18px;
        margin-right: 8px;
    }
    
    .translator-dropdown .dropdown-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .translator-dropdown .dropdown-item img {
        min-width: 24px;
        min-height: 18px;
        margin-right: 8px;
    }
}

/* Force minimum flag dimensions for better visibility */
.translator-flags .lang-link img,
.translator-dropdown .dropdown-toggle img,
.translator-dropdown .dropdown-item img {
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
}

/* Flag size classes */
.custom-translator-wrapper.flag-size-16 img {
    min-width: 24px !important;
    min-height: 18px !important;
}

.custom-translator-wrapper.flag-size-24 img {
    min-width: 32px !important;
    min-height: 24px !important;
}

.custom-translator-wrapper.flag-size-32 img {
    min-width: 40px !important;
    min-height: 30px !important;
}

.custom-translator-wrapper.flag-size-48 img {
    min-width: 56px !important;
    min-height: 42px !important;
}

[dir="rtl"] .translator-dropdown .dropdown-toggle img {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .translator-dropdown .dropdown-item img {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .translator-dropdown .dropdown-arrow {
    margin-left: 0;
    margin-right: auto;
}

/* ============================================
   FLOATING LANGUAGE SELECTOR - PDR
   ============================================ */

/* Floating container */
.gautotranslate-floating {
    position: fixed;
    z-index: 9999;
    /*background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 124, 186, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.9;*/
    max-width: 280px;
}

.gautotranslate-floating:hover {
    opacity: 1;
    /*transform: scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);*/
}

/* Posizioni disponibili */
.gautotranslate-floating.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.gautotranslate-floating.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.gautotranslate-floating.position-top-right {
    top: 20px;
    right: 20px;
}

.gautotranslate-floating.position-top-left {
    top: 20px;
    left: 20px;
}

/* Stili specifici per il floating */
.gautotranslate-floating .translator-dropdown {
    margin: 0;
    width: 100%;
}

.gautotranslate-floating .dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 10px 15px;
    font-weight: 600;
    border-radius: 8px;
}

.gautotranslate-floating .dropdown-toggle:hover {
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
    transform: none;
}

.gautotranslate-floating .dropdown-menu {
    position: absolute;
    width: 230px;
    bottom: 110%;
    left: 0;
    margin-bottom: 5px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 124, 186, 0.2);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.gautotranslate-floating.position-top-right .dropdown-menu,
.gautotranslate-floating.position-top-left .dropdown-menu {
    bottom: auto;
    top: 100%;
    margin-top: 5px;
    margin-bottom: 0;
}

.gautotranslate-floating .dropdown-item {
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.gautotranslate-floating .dropdown-item:hover {
    background: rgba(0, 124, 186, 0.1);
    color: #005a87;
}

/* Responsive per mobile */
@media (max-width: 768px) {
    .gautotranslate-floating {
        bottom: 15px;
        right: 15px;
        left: auto !important;
        max-width: 200px;
        padding: 8px;
    }
    
    .gautotranslate-floating.position-bottom-left,
    .gautotranslate-floating.position-top-left {
        left: 15px;
        right: auto;
    }
    
    .gautotranslate-floating .dropdown-toggle {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .gautotranslate-floating .dropdown-menu {
        max-height: 200px;
        width: 100%;
        left: 0;
        right: 0;
    }
}

/* Animazione di entrata */
@keyframes gautotranslate-float-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 0.9;
        transform: translateY(0) scale(1);
    }
}

.gautotranslate-floating {
    animation: gautotranslate-float-in 0.5s ease-out;
}

/* Scroll personalizzato per il dropdown */
.gautotranslate-floating .dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.gautotranslate-floating .dropdown-menu::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.gautotranslate-floating .dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(0, 124, 186, 0.3);
    border-radius: 3px;
}

.gautotranslate-floating .dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 124, 186, 0.5);
}
