/* Language Selector Styles - Slide Panel Version */

/* Modern Loader Styles - White Theme */
.modern-loader {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loader-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.loader-logo {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
    animation: logoFloat 2s ease-in-out infinite;
}

.loader-text {
    font-size: 18px;
    color: #333333;
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 1px;
}

.loader-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8DC6D8;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Fade out animation for loader */
.modern-loader.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Make loader clickable indication */
.modern-loader {
    cursor: pointer;
}

.modern-loader::after {
    content: "Click anywhere to continue";
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: #666666;
    opacity: 0.7;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 50% { opacity: 0.7; }
    25% { opacity: 1; }
}

/* ==========================================
   LANGUAGE SELECTOR - SLIDE PANEL VERSION
   ========================================== */

/* Language Trigger Button - Compact version to match menu height */
.language-selector {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 0;
}

.language-trigger-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: auto;
    height: auto;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
}

.language-trigger-btn:hover,
.language-trigger-btn:focus {
    background: rgba(245, 164, 37, 0.1);
    color: #f5a425;
}

.language-trigger-btn .flag-icon {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-trigger-btn .flag-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.language-trigger-btn .current-lang-text {
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}

.language-trigger-btn .trigger-icon {
    font-size: 12px;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.language-trigger-btn:hover .trigger-icon {
    opacity: 1;
}

/* Navigation Language Selector - Alignment with menu */
.nav-language-selector {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-language-selector .language-selector {
    margin-left: 0;
}

/* Slide Panel Overlay */
.language-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.language-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Slide Panel */
.language-slide-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: #ffffff;
    z-index: 9999;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.language-slide-panel.active,
.language-slide-panel.open {
    right: 0;
}

/* Panel Header */
.language-panel-header {
    background: linear-gradient(135deg, #0099cc 0%, #0077aa 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.language-panel-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-panel-title i {
    font-size: 20px;
}

.language-panel-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
}

.language-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Panel Search */
.language-panel-search {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.language-search-wrapper {
    position: relative;
}

.language-search-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none;
}

.language-search-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    transition: all 0.3s ease;
}

.language-search-input:focus {
    outline: none;
    border-color: #0099cc;
    box-shadow: 0 0 0 4px rgba(0, 153, 204, 0.1);
}

.language-search-input::placeholder {
    color: #9ca3af;
}

/* Current Language Section */
.language-panel-current {
    padding: 16px 20px;
    background: linear-gradient(135deg, #e3f2fd 0%, #e1f5fe 100%);
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.current-language-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.current-language-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    border: 2px solid #0099cc;
    box-shadow: 0 2px 8px rgba(0, 153, 204, 0.15);
}

.current-language-display .flag-icon {
    width: 32px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
}

.current-language-display .flag-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.current-language-display .language-details {
    flex: 1;
}

.current-language-display .language-name {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.current-language-display .language-native {
    font-size: 12px;
    color: #6b7280;
}

.current-language-display .check-mark {
    color: #10b981;
    font-size: 18px;
}

/* Panel Content - Language List */
.language-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Custom Scrollbar */
.language-panel-content::-webkit-scrollbar {
    width: 6px;
}

.language-panel-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.language-panel-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e0 0%, #a0aec0 100%);
    border-radius: 3px;
}

.language-panel-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #a0aec0 0%, #718096 100%);
}

/* Language Region Group */
.language-region-group {
    margin-bottom: 8px;
}

.region-header {
    padding: 12px 20px 8px;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Language Option Item */
.language-option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
}

.language-option-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding-left: 26px;
}

.language-option-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(180deg, #0099cc 0%, #0077aa 100%);
    transition: width 0.3s ease;
}

.language-option-item:hover::before {
    width: 4px;
}

.language-option-item.active {
    background: linear-gradient(135deg, #e3f2fd 0%, #e1f5fe 100%);
    border-left: 4px solid #0099cc;
    padding-left: 16px;
}

.language-option-item.active::before {
    display: none;
}

.language-option-item .flag-icon {
    width: 28px;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.language-option-item:hover .flag-icon {
    transform: scale(1.1);
    border-color: #0099cc;
}

.language-option-item .flag-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.language-option-item .language-info {
    flex: 1;
    min-width: 0;
}

.language-option-item .language-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
    transition: color 0.3s ease;
}

.language-option-item .language-native {
    font-size: 12px;
    color: #6b7280;
    transition: color 0.3s ease;
}

.language-option-item:hover .language-name {
    color: #0077aa;
}

.language-option-item.active .language-name {
    color: #0077aa;
}

.language-option-item.active .language-native {
    color: #0099cc;
}

.language-option-item .radio-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.language-option-item:hover .radio-indicator {
    border-color: #0099cc;
}

.language-option-item.active .radio-indicator {
    border-color: #0099cc;
    background: #0099cc;
}

.language-option-item.active .radio-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* No Results State */
.no-languages-found {
    padding: 40px 24px;
    text-align: center;
    color: #9ca3af;
}

.no-languages-found i {
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
    color: #d1d5db;
}

.no-languages-found .no-results-title {
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 4px;
    font-size: 16px;
}

.no-languages-found .no-results-text {
    font-size: 13px;
    color: #9ca3af;
}

/* Panel Footer */
.language-panel-footer {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.language-count-info {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Loading State */
.language-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.language-loading-state .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #0099cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.language-loading-state .loading-text {
    color: #6b7280;
    font-weight: 500;
}

/* Highlight for search */
.language-option-item mark {
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* ==========================================
   RESPONSIVE STYLES
   ========================================== */

@media (max-width: 768px) {
    .language-slide-panel {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }
    
    .language-trigger-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .language-trigger-btn .flag-icon {
        width: 18px;
        height: 13px;
    }
    
    .language-panel-header {
        padding: 16px 20px;
    }
    
    .language-panel-title {
        font-size: 16px;
    }
    
    .language-option-item {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .language-trigger-btn {
        padding: 5px 8px;
    }
    
    .language-trigger-btn .current-lang-text {
        display: none;
    }
    
    .language-trigger-btn .trigger-icon {
        margin-left: 2px;
    }
}

@media (max-width: 992px) {
    .nav-language-selector {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        width: 100%;
        justify-content: center;
    }
    
    .language-selector {
        width: auto;
        display: inline-flex;
        justify-content: center;
    }
    
    .language-trigger-btn {
        justify-content: center;
    }
}

/* Body scroll lock when panel is open */
body.language-panel-open {
    overflow: hidden;
}

/* Animation keyframes */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
