/**
 * Styles pour le système multilingue
 * Math Quiz Kids
 */

/* ============================================
   SÉLECTEUR DE LANGUE
   ============================================ */

.language-selector {
    position: relative;
    display: inline-block;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.25);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

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

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
}

.lang-option:hover {
    background: #f5f5f5;
}

.lang-option.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Version dans le header */
.header .language-selector {
    margin-left: 10px;
}

/* Version dans le footer */
.footer .language-selector .lang-btn {
    background: rgba(255,255,255,0.1);
}

.footer .language-selector .lang-dropdown {
    bottom: 100%;
    top: auto;
    margin-bottom: 8px;
    margin-top: 0;
}

/* Version dans le profil */
.profile-language {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.profile-language h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.profile-language .lang-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-language .lang-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-language .lang-item:hover {
    border-color: #6c63ff;
}

.profile-language .lang-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
}

/* ============================================
   SUPPORT RTL (Right-to-Left)
   ============================================ */

/* Direction générale */
html[dir="rtl"] {
    direction: rtl;
}

body.rtl {
    text-align: right;
}

/* Header RTL */
body.rtl .header-content {
    flex-direction: row-reverse;
}

body.rtl .nav-links {
    flex-direction: row-reverse;
}

body.rtl .logo {
    flex-direction: row-reverse;
}

body.rtl .user-section {
    flex-direction: row-reverse;
}

/* Cards RTL */
body.rtl .level-card,
body.rtl .card {
    text-align: right;
}

body.rtl .card-header {
    flex-direction: row-reverse;
}

/* Quiz RTL */
body.rtl .quiz-header {
    flex-direction: row-reverse;
}

body.rtl .answer-btn {
    text-align: right;
}

body.rtl .quiz-feedback {
    text-align: center;
}

/* Leaderboard RTL */
body.rtl .leaderboard-item {
    flex-direction: row-reverse;
}

body.rtl .lb-rank {
    text-align: right;
}

/* Forms RTL */
body.rtl .form-group label {
    text-align: right;
}

body.rtl .form-input,
body.rtl textarea,
body.rtl select {
    text-align: right;
}

/* Modals RTL */
body.rtl .modal-header {
    flex-direction: row-reverse;
}

body.rtl .modal-close {
    left: 15px;
    right: auto;
}

/* Profile RTL */
body.rtl .profile-header {
    flex-direction: row-reverse;
}

body.rtl .stat-card {
    text-align: center;
}

/* Challenges RTL */
body.rtl .challenge-card {
    text-align: right;
}

body.rtl .challenge-header {
    flex-direction: row-reverse;
}

body.rtl .challenge-meta {
    flex-direction: row-reverse;
}

/* Buttons RTL */
body.rtl .btn {
    flex-direction: row-reverse;
}

body.rtl .btn-group {
    flex-direction: row-reverse;
}

/* Navigation mobile RTL */
@media (max-width: 768px) {
    body.rtl .nav-links {
        right: auto;
        left: 0;
    }
}

/* Footer RTL */
body.rtl .footer-content {
    flex-direction: row-reverse;
}

body.rtl .footer-links {
    flex-direction: row-reverse;
}

/* Timer RTL - reste centré */
body.rtl .timer-container {
    direction: ltr;
}

/* Progress bar RTL */
body.rtl .progress-bar {
    direction: ltr;
}

body.rtl .progress-fill {
    float: right;
}

/* Dropdown positions RTL */
body.rtl .lang-dropdown {
    right: auto;
    left: 0;
}

body.rtl .dropdown-menu {
    right: auto;
    left: 0;
}

/* Emojis - ne pas inverser */
body.rtl .emoji,
body.rtl .level-icon {
    direction: ltr;
    display: inline-block;
}

/* Animations RTL */
@keyframes slideInRTL {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

body.rtl .page {
    animation: slideInRTL 0.3s ease;
}

/* Scrollbar RTL - pour certains navigateurs */
body.rtl::-webkit-scrollbar {
    direction: rtl;
}

/* ============================================
   RESPONSIVE LANGUAGE SELECTOR
   ============================================ */

@media (max-width: 768px) {
    .language-selector {
        margin: 10px 0;
    }
    
    .lang-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .lang-dropdown {
        min-width: 140px;
    }
    
    .profile-language .lang-grid {
        flex-direction: column;
    }
    
    .profile-language .lang-item {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .lang-dropdown {
        background: #2d2d2d;
    }
    
    .lang-option {
        color: #fff;
    }
    
    .lang-option:hover {
        background: #3d3d3d;
    }
    
    .profile-language {
        background: #1a1a2e;
    }
    
    .profile-language h4 {
        color: #fff;
    }
    
    .profile-language .lang-item {
        background: #2d2d2d;
        border-color: #3d3d3d;
        color: #fff;
    }
}
