/* WPML Floating Language Switcher - Frontend Styles */

/* Floating Button Container */
.wfls-floating-button {
    position: fixed;
    z-index: 9999;
    font-family: var(--e-global-typography-primary-font-family);
}

/* Position variations */
.wfls-position-bottom-right {
    bottom: 110px;
    right: 50px;
}

.wfls-position-bottom-left {
    bottom: 30px;
    left: 30px;
}

.wfls-position-top-right {
    top: 30px;
    right: 30px;
}

.wfls-position-top-left {
    top: 30px;
    left: 30px;
}

/* Toggle Button */
.wfls-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #2d6b3c 0%, #5b8553 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;

}

.wfls-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.wfls-toggle-btn:active {
    transform: translateY(0);
}

/* Button style variations */
.wfls-style-circle .wfls-toggle-btn {
    border-radius: 50%;
    width: 60px;
    height: 60px;
    padding: 0;
}

.wfls-style-circle .wfls-current-lang {
    display: none;
}

.wfls-style-rounded .wfls-toggle-btn {
    border-radius: 30px;
}

.wfls-style-square .wfls-toggle-btn {
    border-radius: 8px;
}

/* Current flag/icon */
.wfls-current-flag {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: absolute;
    top: 0;
    left: 0;
}

/* Ensure button is positioned for absolute flag */
.wfls-style-circle .wfls-toggle-btn {
    position: relative;
    overflow: hidden;
}

.wfls-globe-icon {
    font-size: 24px;
    line-height: 1;
}

.wfls-current-lang {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Language Menu */
.wfls-menu {
    position: absolute;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 320px;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.wfls-menu.wfls-show {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Menu positioning based on button position */
.wfls-position-bottom-right .wfls-menu,
.wfls-position-bottom-left .wfls-menu {
    bottom: 70px;
}

.wfls-position-top-right .wfls-menu,
.wfls-position-top-left .wfls-menu {
    top: 70px;
}

.wfls-position-bottom-right .wfls-menu,
.wfls-position-top-right .wfls-menu {
    right: 0;
}

.wfls-position-bottom-left .wfls-menu,
.wfls-position-top-left .wfls-menu {
    left: 0;
}

/* Menu Header */
.wfls-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #2d6b3c 0%, #5b8553 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
}

.wfls-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.wfls-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Language List */
.wfls-language-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 400px;
    overflow-y: auto;
}

.wfls-language-list::-webkit-scrollbar {
    width: 6px;
}

.wfls-language-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.wfls-language-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.wfls-language-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Language Item */
.wfls-language-item {
    margin: 0;
}

.wfls-language-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: #333333;
    transition: all 0.2s;
    position: relative;
}

.wfls-language-link:hover {
    background: #f8f9ff;
    color: #5b8553;
}

.wfls-language-link.wfls-current {
    background: #f8f9ff;
    color: #2e6d3b;
    font-weight: 600;
}

.wfls-language-link.wfls-current::after {
    content: '✓';
    position: absolute;
    right: 20px;
    font-weight: bold;
    color: #2e6d3b;
}

/* Flag Image */
.wfls-flag {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* Language Info */
.wfls-language-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wfls-language-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.wfls-language-code {
    font-size: 11px;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading State */
.wfls-loading {
    padding: 20px;
    text-align: center;
    color: #999999;
    font-size: 14px;
}

.wfls-loading::after {
    content: '...';
    animation: wfls-dots 1.5s infinite;
}

@keyframes wfls-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Error State */
.wfls-error {
    padding: 20px;
    text-align: center;
    color: #e74c3c;
    font-size: 14px;
}

/* Empty State */
.wfls-empty {
    padding: 20px;
    text-align: center;
    color: #999999;
    font-size: 14px;
}

/* Animations */
@keyframes wfls-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wfls-language-item {
    animation: wfls-fadeIn 0.3s ease-out backwards;
}

.wfls-language-item:nth-child(1) { animation-delay: 0.05s; }
.wfls-language-item:nth-child(2) { animation-delay: 0.1s; }
.wfls-language-item:nth-child(3) { animation-delay: 0.15s; }
.wfls-language-item:nth-child(4) { animation-delay: 0.2s; }
.wfls-language-item:nth-child(5) { animation-delay: 0.25s; }

/* Responsive Design */
@media (max-width: 768px) {
    .wfls-floating-button {
        bottom: 20px;
        right: 20px;
    }
    
    .wfls-position-bottom-right,
    .wfls-position-bottom-left {
        bottom: 107px;
    }
    
    .wfls-position-top-right,
    .wfls-position-top-left {
        top: 20px;
    }
    
    .wfls-position-bottom-left,
    .wfls-position-top-left {
        left: 20px;
    }
    
    .wfls-position-bottom-right,
    .wfls-position-top-right {
        right: 47px;
    }
    
    .wfls-menu {
        min-width: 260px;
        max-width: calc(100vw - 40px);
    }
    
    .wfls-toggle-btn {
        min-width: 50px;
        min-height: 50px;
    }
    
    .wfls-style-circle .wfls-toggle-btn {
        width: 50px;
        height: 50px;
    }
}

/* Accessibility */
.wfls-toggle-btn:focus,
.wfls-close-btn:focus,
.wfls-language-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* RTL Support - Always keep button on bottom-right even in Arabic */
[dir="rtl"] .wfls-position-bottom-right {
    bottom: 108px;
    right: 50px !important;
}

[dir="rtl"] .wfls-position-bottom-left {
    left: 30px !important;
    right: auto !important;
}

[dir="rtl"] .wfls-position-top-right {
    right: 30px !important;
    left: auto !important;
}

[dir="rtl"] .wfls-position-top-left {
    left: 30px !important;
    right: auto !important;
}

/* RTL Menu positioning - always align with button */
[dir="rtl"] .wfls-position-bottom-right .wfls-menu,
[dir="rtl"] .wfls-position-top-right .wfls-menu {
    right: 0 !important;
    left: auto !important;
}

[dir="rtl"] .wfls-position-bottom-left .wfls-menu,
[dir="rtl"] .wfls-position-top-left .wfls-menu {
    left: 0 !important;
    right: auto !important;
}

[dir="rtl"] .wfls-language-link.wfls-current::after {
    right: auto;
    left: 20px;
}

@media (max-width: 768px) {
    [dir="rtl"] .wfls-position-bottom-right {
        right: 48px !important; 
    }
}
/* Print Styles */
@media print {
    .wfls-floating-button {
        display: none !important;
    }
}
