/* ===================================
   Styles pour le système multilingue
   =================================== */

/* Sélecteur de langue */
.language-switcher {
    position: relative;
    display: inline-block;
}

.language-switcher select {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: white;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.language-switcher select:hover {
    border-color: #3b82f6;
}

.language-switcher select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Styles pour le mode RTL (Right-to-Left) */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] body {
    direction: rtl;
}

/* Inversement des marges et padding pour RTL */
[dir="rtl"] .ml-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

[dir="rtl"] .mr-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

[dir="rtl"] .pl-4 {
    padding-left: 0 !important;
    padding-right: 1rem !important;
}

[dir="rtl"] .pr-4 {
    padding-right: 0 !important;
    padding-left: 1rem !important;
}

/* Navigation RTL */
[dir="rtl"] nav {
    direction: rtl;
}

[dir="rtl"] .nav-item {
    float: right;
}

/* Formulaires RTL */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] textarea,
[dir="rtl"] select {
    text-align: right;
}

/* Icônes RTL - inversement horizontal */
[dir="rtl"] .icon-flip {
    transform: scaleX(-1);
}

/* Dropdown RTL */
[dir="rtl"] .dropdown-menu {
    left: auto;
    right: 0;
}

/* Flexbox RTL */
[dir="rtl"] .flex-row {
    flex-direction: row-reverse;
}

/* Grid RTL */
[dir="rtl"] .grid {
    direction: rtl;
}

/* Tables RTL */
[dir="rtl"] table {
    direction: rtl;
}

[dir="rtl"] th,
[dir="rtl"] td {
    text-align: right;
}

/* Boutons avec icônes RTL */
[dir="rtl"] button .icon-left {
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] button .icon-right {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* Position du sélecteur de langue dans le header */
.header-language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-language-switcher .language-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: #6b7280;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .language-switcher select {
        font-size: 0.75rem;
        padding: 0.375rem 2rem 0.375rem 0.75rem;
    }
}

/* Animation de transition pour le changement de langue */
.language-transition {
    transition: opacity 0.3s ease-in-out;
}

.language-transition.fade-out {
    opacity: 0;
}

.language-transition.fade-in {
    opacity: 1;
}

/* Badge de langue */
.language-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.language-badge.active {
    background-color: #3b82f6;
    color: white;
}

.language-badge.inactive {
    background-color: #e5e7eb;
    color: #6b7280;
}

/* Style pour les textes en arabe */
[lang="ar"],
[dir="rtl"] {
    font-family: 'Noto Sans Arabic', 'Cairo', 'Tajawal', Arial, sans-serif;
}

/* Style pour les textes en anglais */
[lang="en"] {
    font-family: 'Inter', 'Roboto', 'Open Sans', Arial, sans-serif;
}

/* Style pour les textes en français */
[lang="fr"] {
    font-family: 'Inter', 'Roboto', 'Open Sans', Arial, sans-serif;
}

/* Indicateur de chargement du changement de langue */
.language-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Amélioration de la lisibilité pour l'arabe */
[lang="ar"] {
    line-height: 2;
    letter-spacing: 0.02em;
}

/* Alignement des listes en RTL */
[dir="rtl"] ul,
[dir="rtl"] ol {
    padding-right: 1.5rem;
    padding-left: 0;
}

[dir="rtl"] li {
    text-align: right;
}
