/**
 * Language Switcher Styles
 * RTL/LTR Support for Admin Dashboard
 */

/* Language Switcher Container */
.language-switcher {
    position: relative;
    display: inline-block;
}

.language-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0;
    width: 35px;
    height: 35px;
    background: #ff8c00 !important;
    border: 1px solid #ff8c00 !important;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    color: white !important;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(128, 128, 128, 0.3);
}

.language-btn:hover {
    background: #ff7700 !important;
    border-color: #ff7700 !important;
    box-shadow: 0 12px 30px rgba(128, 128, 128, 0.4);
    transform: translateY(-2px);
}

.language-btn:focus {
    outline: none;
    border-color: #ff6600 !important;
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.3);
}

.lang-flag {
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-name {
    display: none; /* مخفی کردن متن، فقط ایموجی نمایش داده می‌شود */
}

.language-btn i {
    font-size: 8px;
    color: white;
    transition: transform 0.3s ease;
    display: none; /* مخفی کردن آیکون chevron در حالت عادی */
}

.language-btn:hover i {
    transform: rotate(0deg);
}

.language-switcher.show .language-btn i.fa-chevron-down {
    transform: rotate(180deg);
}

/* Dark Mode Styles */
.dark .language-btn,
[data-theme="dark"] .language-btn {
    background: white !important;
    border-color: white !important;
    color: #1f2937 !important;
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
}

.dark .language-btn:hover,
[data-theme="dark"] .language-btn:hover {
    background: #f3f4f6 !important;
    border-color: #f3f4f6 !important;
    box-shadow: 0 12px 30px rgba(255, 255, 255, 0.4);
}

.dark .language-btn:focus,
[data-theme="dark"] .language-btn:focus {
    border-color: #e5e7eb !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.dark .language-btn .fa-chevron-down,
[data-theme="dark"] .language-btn .fa-chevron-down {
    color: #1f2937;
}

/* Dropdown */
.language-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: auto;
    background: #ff8c00;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* RTL Support */
[dir="rtl"] .language-dropdown {
    right: auto;
    left: 0;
}

.lang-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    width: 35px;
    height: 35px;
    background: white;
    border: 1px solid white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1f2937;
    font-size: 1.2rem;
    position: relative;
}

.lang-option:hover {
    background: #f3f4f6;
    border-color: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lang-option.active {
    background: white;
    border-color: white;
    color: #ff8c00;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

.lang-option .lang-flag {
    font-size: 1.2rem;
    line-height: 1;
}

.lang-option .lang-name {
    display: none; /* مخفی کردن متن */
}

.lang-option .fa-check {
    display: none; /* مخفی کردن آیکون چک */
}



[dir="rtl"] .lang-option .fa-check {
    margin-left: 0;
    margin-right: auto;
}

/* RTL/LTR Global Styles */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.ltr {
    direction: ltr;
    text-align: left;
}

/* Admin Dashboard Specific Styles */
.admin-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-header .language-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    height: 38px;
}

.admin-header .language-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.admin-header .language-dropdown {
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Dark mode for admin */
.dark-mode .language-dropdown {
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .lang-option {
    color: #e5e7eb;
}

.dark-mode .lang-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dark-mode .lang-option.active {
    background: rgba(124, 58, 237, 0.15);
    color: #c4b5fd;
}

/* RTL Adjustments for Common Elements */
[dir="rtl"] .dashboard-sidebar {
    right: 0;
    left: auto;
}

[dir="rtl"] .dashboard-main {
    margin-right: 250px;
    margin-left: 0;
}

[dir="rtl"] .fa-chevron-right::before {
    content: "\f053"; /* chevron-left */
}

[dir="rtl"] .fa-chevron-left::before {
    content: "\f054"; /* chevron-right */
}

/* Flip icons in RTL */
[dir="rtl"] .flip-rtl {
    transform: scaleX(-1);
}

/* Text alignment */
.text-start {
    text-align: start;
}

.text-end {
    text-align: end;
}

[dir="rtl"] .text-left {
    text-align: right;
}

[dir="rtl"] .text-right {
    text-align: left;
}

/* Margins and Padding RTL */
[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

[dir="rtl"] .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .language-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .lang-name {
        display: none;
    }

    .language-dropdown {
        min-width: 150px;
    }
}

/* Animation */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Loading state */
.language-btn.loading::after {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .language-dropdown {
        background: #1f2937;
    }

    .lang-option {
        color: #e5e7eb;
    }

    .lang-option:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .lang-option.active {
        background: rgba(124, 58, 237, 0.2);
        color: #c4b5fd;
    }
}
