/* RTL/LTR Language Support for CONSORT Reviewer AI */

/* Default RTL (Persian/Arabic) */
html[lang="fa"], html[lang="ar"], html[dir="rtl"] {
 direction: rtl;
 text-align: right;
}

html[lang="fa"] body, html[lang="ar"] body, html[dir="rtl"] body {
 direction: rtl;
 text-align: right;
 font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
}

/* LTR (English) */
html[lang="en"], html[dir="ltr"] {
 direction: ltr;
 text-align: left;
}

html[lang="en"] body, html[dir="ltr"] body {
 direction: ltr;
 text-align: left;
 font-family: 'Inter', 'Segoe UI', 'Arial', sans-serif;
}

/* Text Alignment Classes */
.text-justify {
 text-align: justify;
 text-justify: inter-word;
 line-height: 1.8;
}

/* RTL Specific Styles */
[dir="rtl"] .form-control {
 text-align: right;
 padding-right: 1rem;
 padding-left: 1rem;
}

[dir="rtl"] .form-control:focus {
 text-align: right;
}

[dir="rtl"] .form-control::placeholder {
 text-align: right;
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
 text-align: right;
}

[dir="rtl"] .nav-link {
 text-align: right;
}

[dir="rtl"] .btn {
 text-align: center;
}

[dir="rtl"] .alert {
 text-align: right;
}

[dir="rtl"] .card-header,
[dir="rtl"] .card-body,
[dir="rtl"] .card-footer {
 text-align: right;
}

[dir="rtl"] .dropzone-text,
[dir="rtl"] .dropzone-subtext {
 text-align: center;
}

/* LTR Specific Styles */
[dir="ltr"] .form-control {
 text-align: left;
 padding-left: 1rem;
 padding-right: 1rem;
}

[dir="ltr"] .form-control:focus {
 text-align: left;
}

[dir="ltr"] .form-control::placeholder {
 text-align: left;
}

[dir="ltr"] .table th,
[dir="ltr"] .table td {
 text-align: left;
}

[dir="ltr"] .nav-link {
 text-align: left;
}

[dir="ltr"] .btn {
 text-align: center;
}

[dir="ltr"] .alert {
 text-align: left;
}

[dir="ltr"] .card-header,
[dir="ltr"] .card-body,
[dir="ltr"] .card-footer {
 text-align: left;
}

[dir="ltr"] .dropzone-text,
[dir="ltr"] .dropzone-subtext {
 text-align: center;
}

/* Paragraph Justification */
[dir="rtl"] p,
[dir="rtl"] .text-content,
[dir="rtl"] .description {
 text-align: justify;
 text-justify: inter-word;
 line-height: 1.8;
}

[dir="ltr"] p,
[dir="ltr"] .text-content,
[dir="ltr"] .description {
 text-align: justify;
 text-justify: inter-word;
 line-height: 1.7;
}

/* Navigation Fixes */
[dir="rtl"] .navbar-nav {
 flex-direction: row-reverse;
}

[dir="rtl"] .navbar-nav .nav-item {
 margin-left: 0.5rem;
 margin-right: 0;
}

[dir="ltr"] .navbar-nav .nav-item {
 margin-right: 0.5rem;
 margin-left: 0;
}

/* Breadcrumb Fixes */
[dir="rtl"] .breadcrumb {
 flex-direction: row-reverse;
}

[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
 content: "‹";
 padding-right: 0.5rem;
 padding-left: 0;
}

[dir="ltr"] .breadcrumb-item + .breadcrumb-item::before {
 content: "›";
 padding-left: 0.5rem;
 padding-right: 0;
}

/* Modal Fixes */
[dir="rtl"] .modal-header .btn-close {
 margin-left: auto;
 margin-right: 0;
}

[dir="ltr"] .modal-header .btn-close {
 margin-right: auto;
 margin-left: 0;
}

/* Dropdown Fixes */
[dir="rtl"] .dropdown-menu {
 right: 0;
 left: auto;
 text-align: right;
}

[dir="ltr"] .dropdown-menu {
 left: 0;
 right: auto;
 text-align: left;
}

/* Icon Positioning */
[dir="rtl"] .icon-left {
 margin-left: 0.5rem;
 margin-right: 0;
}

[dir="rtl"] .icon-right {
 margin-right: 0.5rem;
 margin-left: 0;
}

[dir="ltr"] .icon-left {
 margin-right: 0.5rem;
 margin-left: 0;
}

[dir="ltr"] .icon-right {
 margin-left: 0.5rem;
 margin-right: 0;
}

/* List Fixes */
[dir="rtl"] ul,
[dir="rtl"] ol {
 padding-right: 2rem;
 padding-left: 0;
}

[dir="ltr"] ul,
[dir="ltr"] ol {
 padding-left: 2rem;
 padding-right: 0;
}

/* Float Fixes */
[dir="rtl"] .float-left {
 float: right !important;
}

[dir="rtl"] .float-right {
 float: left !important;
}

[dir="ltr"] .float-left {
 float: left !important;
}

[dir="ltr"] .float-right {
 float: right !important;
}

/* Margin and Padding Fixes */
[dir="rtl"] .mr-auto {
 margin-left: auto !important;
 margin-right: 0 !important;
}

[dir="rtl"] .ml-auto {
 margin-right: auto !important;
 margin-left: 0 !important;
}

[dir="ltr"] .mr-auto {
 margin-right: auto !important;
 margin-left: 0 !important;
}

[dir="ltr"] .ml-auto {
 margin-left: auto !important;
 margin-right: 0 !important;
}

/* Border Radius Fixes */
[dir="rtl"] .rounded-left {
 border-top-right-radius: var(--radius-md) !important;
 border-bottom-right-radius: var(--radius-md) !important;
 border-top-left-radius: 0 !important;
 border-bottom-left-radius: 0 !important;
}

[dir="rtl"] .rounded-right {
 border-top-left-radius: var(--radius-md) !important;
 border-bottom-left-radius: var(--radius-md) !important;
 border-top-right-radius: 0 !important;
 border-bottom-right-radius: 0 !important;
}

[dir="ltr"] .rounded-left {
 border-top-left-radius: var(--radius-md) !important;
 border-bottom-left-radius: var(--radius-md) !important;
 border-top-right-radius: 0 !important;
 border-bottom-right-radius: 0 !important;
}

[dir="ltr"] .rounded-right {
 border-top-right-radius: var(--radius-md) !important;
 border-bottom-right-radius: var(--radius-md) !important;
 border-top-left-radius: 0 !important;
 border-bottom-left-radius: 0 !important;
}

/* Language Switcher */
.language-switcher {
 position: relative;
 display: inline-block;
}

.language-switcher .dropdown-toggle {
 background: transparent;
 border: 1px solid var(--border-color);
 border-radius: var(--radius-md);
 padding: 0.5rem 1rem;
 color: var(--text-primary);
 text-decoration: none;
 display: flex;
 align-items: center;
 gap: 0.5rem;
}

.language-switcher .dropdown-toggle:hover {
 background: var(--bg-secondary);
 border-color: var(--primary-500);
}

.language-switcher .dropdown-menu {
 min-width: 150px;
 border: 1px solid var(--border-color);
 border-radius: var(--radius-md);
 box-shadow: var(--shadow-lg);
 background: var(--bg-primary);
 backdrop-filter: blur(10px);
}

.language-switcher .dropdown-item {
 padding: 0.5rem 1rem;
 color: var(--text-primary);
 text-decoration: none;
 display: flex;
 align-items: center;
 gap: 0.5rem;
 transition: var(--transition-fast);
}

.language-switcher .dropdown-item:hover {
 background: var(--bg-secondary);
 color: var(--primary-600);
}

.language-switcher .dropdown-item.active {
 background: var(--primary-50);
 color: var(--primary-600);
 font-weight: 600;
}

/* Typography Improvements */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, 
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6 {
 text-align: right;
 font-family: 'Vazirmatn', 'Tahoma', sans-serif;
 font-weight: 600;
}

[dir="ltr"] h1, [dir="ltr"] h2, [dir="ltr"] h3, 
[dir="ltr"] h4, [dir="ltr"] h5, [dir="ltr"] h6 {
 text-align: left;
 font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
 font-weight: 400;
 letter-spacing: -0.01em;
}

[dir="ltr"] h1 {
 font-weight: 500;
 font-size: 2.5rem;
}

[dir="ltr"] h2 {
 font-weight: 500;
 font-size: 2rem;
}

[dir="ltr"] h3 {
 font-weight: 500;
 font-size: 1.75rem;
}

[dir="ltr"] h4 {
 font-weight: 500;
 font-size: 1.5rem;
}

[dir="ltr"] h5 {
 font-weight: 500;
 font-size: 1.25rem;
}

[dir="ltr"] h6 {
 font-weight: 500;
 font-size: 1.125rem;
}

[dir="ltr"] p, [dir="ltr"] .text-content {
 font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
 font-weight: 400;
 line-height: 1.6;
}

[dir="ltr"] .btn {
 font-family: 'Inter', 'Segoe UI', sans-serif;
 font-weight: 500;
 letter-spacing: 0.01em;
}

[dir="ltr"] .badge {
 font-family: 'Inter', 'Segoe UI', sans-serif;
 font-weight: 500;
 font-size: 0.875rem;
}

[dir="ltr"] .nav-link {
 font-family: 'Inter', 'Segoe UI', sans-serif;
 font-weight: 500;
}

[dir="ltr"] .card-title {
 font-weight: 500;
}

[dir="ltr"] .form-label {
 font-weight: 500;
}

/* Analysis Result Styling */
.analysis-content {
 line-height: 1.8;
}

[dir="rtl"] .analysis-content {
 text-align: justify;
 font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

[dir="ltr"] .analysis-content {
 text-align: justify;
 font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* Score Display */
.score-display {
 text-align: center;
 font-weight: bold;
}

/* Recommendation Lists */
[dir="rtl"] .recommendations ul,
[dir="rtl"] .issues ul {
 list-style-position: inside;
 text-align: right;
}

[dir="ltr"] .recommendations ul,
[dir="ltr"] .issues ul {
 list-style-position: inside;
 text-align: left;
}

/* Form Labels */
[dir="rtl"] .form-label {
 text-align: right;
 display: block;
}

[dir="ltr"] .form-label {
 text-align: left;
 display: block;
}

/* Button Groups */
[dir="rtl"] .btn-group {
 flex-direction: row-reverse;
}

[dir="ltr"] .btn-group {
 flex-direction: row;
}

/* Progress Bars */
[dir="rtl"] .progress {
 transform: scaleX(-1);
}

[dir="rtl"] .progress .progress-bar {
 transform: scaleX(-1);
}

/* Responsive Text Alignment */
@media (max-width: 768px) {
 [dir="rtl"] .text-md-center {
 text-align: center !important;
 }
 
 [dir="ltr"] .text-md-center {
 text-align: center !important;
 }
}

/* Print Styles */
@media print {
 [dir="rtl"] * {
 text-align: right !important;
 }
 
 [dir="ltr"] * {
 text-align: left !important;
 }
 
 .text-justify {
 text-align: justify !important;
 }
}
