/*
 * AILA Tech Solutions - Identity Verification Platform
 * Language Selector CSS
 */

/* Language selector container */
.language-selector-top {
    position: relative;
    cursor: pointer;
    margin-left: 15px;
}

/* Language selector toggle button */
.language-selector-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    min-width: 70px;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.language-selector-toggle:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.language-selector-toggle.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.25));
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.language-selector-toggle i {
    transition: transform 0.3s ease;
    font-size: 10px;
    opacity: 0.8;
}

.language-selector-toggle:hover i {
    opacity: 1;
}

.language-selector-toggle.active i {
    transform: rotate(180deg);
    opacity: 1;
}

.language-selector-toggle .flag-icon {
    font-size: 16px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    margin-right: 6px;
    opacity: 0.95;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    line-height: 1;
}

.language-selector-toggle .flag-emoji-fallback {
    font-size: 16px;
    line-height: 1;
    display: inline-block;
}

.language-selector-toggle .flag-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.language-selector-toggle:hover .flag-icon {
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

/* Language dropdown */
.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    margin-top: 8px;
    min-width: 160px;
    display: none;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: dropdownFadeIn 0.3s ease;
    backdrop-filter: blur(10px);
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.language-dropdown.show {
    display: block;
}

/* Language options */
.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: #374151;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    flex-direction: row;
}

.language-option:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #1e40af;
    transform: translateX(3px);
    padding-left: 20px;
    box-shadow: inset 2px 0 0 #3b82f6;
}

.language-option.active {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    font-weight: 600;
    border-left: 3px solid #3b82f6;
    box-shadow: inset 2px 0 0 #3b82f6;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option .flag-icon {
    font-size: 20px;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
    line-height: 1;
}

.language-option .flag-emoji-fallback {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
}

.language-option .flag-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.language-option:hover .flag-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transform: scale(1.08);
    border-color: rgba(59, 130, 246, 0.3);
}

.language-option .language-text {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.language-option .language-name {
    font-weight: 600;
    line-height: 1.3;
    color: #1f2937;
    transition: color 0.3s ease;
}

.language-option .language-native {
    font-size: 12px;
    color: #6b7280;
    margin-top: 3px;
    font-weight: 400;
    transition: color 0.3s ease;
}

.language-option:hover .language-name {
    color: #1e40af;
}

.language-option:hover .language-native {
    color: #3b82f6;
}

/* Loading state */
.loading-languages {
    padding: 20px;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    margin: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading-languages i {
    color: #3b82f6;
    animation: spin 1s linear infinite;
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
    .language-selector-top {
        margin-left: 0; /* No left margin on mobile */
    }
    
    .language-selector-toggle {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 50px;
    }
    
    .language-dropdown {
        min-width: 120px;
        right: 0; /* Align dropdown to right edge */
    }
    
    .language-option {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* Legacy language menu styles (for backward compatibility) */
.language-menu {
    margin-left: 15px;
}

.language-menu select {
    background-color: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 24px 6px 8px;
    font-size: 14px;
    color: #505F79;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23505F79' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    transition: all 0.2s ease;
}

.language-menu select:focus {
    outline: none;
    border-color: #0052CC;
    box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.2);
}

.language-menu select:hover {
    border-color: #0052CC;
    background-color: #f8f9fa;
}

.mobile-language {
    display: flex;
    align-items: center;
    padding: 10px 0;
    margin-top: 10px;
    border-top: 1px solid #eee;
}

.mobile-language span {
    margin-right: 10px;
    font-size: 14px;
    color: #505F79;
}

.mobile-language select {
    flex: 1;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
}

.mobile-language select:hover {
    border-color: #0052CC;
    background-color: #f8f9fa;
}

@media screen and (max-width: 768px) {
    .nav-links .language-menu {
        display: none;
    }
}