/* Arabic RTL Support CSS */
/* This file provides comprehensive RTL support and Arabic typography */

:root {
    --primary-color: #1f2937;
    --font-heading: 'Cairo', sans-serif;
    --font-body: 'Cairo', sans-serif;
    --font-content: 'Cairo', sans-serif;
}

/* RTL Global Styles */
html[dir="rtl"],
html[lang="ar"] {
    direction: rtl;
    text-align: right;
}

body {
    font-family: var(--font-body);
    direction: rtl;
    text-align: right;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Apply Cairo to all form labels, buttons, and UI elements */
label,
.form-label,
.btn,
.nav-link,
.navbar-brand,
.card-title,
.table,
.dropdown-item,
.badge,
.alert,
.breadcrumb {
    font-family: var(--font-heading);
}

.article-content, 
article,
.post-content {
    font-family: var(--font-content);
    text-align: right;
}

/* Bootstrap RTL Adjustments */
.ms-auto {
    margin-right: auto;
    margin-left: 0;
}

.me-2 {
    margin-right: 0.5rem;
    margin-left: 0;
}

.me-3 {
    margin-right: 0.75rem;
    margin-left: 0;
}

.ms-3 {
    margin-left: 0;
    margin-right: 0.75rem;
}

.ps-3 {
    padding-right: 0.75rem;
    padding-left: 0;
}

.ps-2 {
    padding-right: 0.375rem;
    padding-left: 0;
}

/* List items RTL */
ul, ol {
    padding-right: 1.125rem;
    padding-left: 0;
    text-align: right;
}

/* Table RTL */
table {
    text-align: right;
}

table th,
table td {
    text-align: right;
    border-collapse: collapse;
}

/* Form Elements RTL */
.form-label {
    text-align: right;
    display: block;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    direction: rtl;
    text-align: right;
}

.form-control::placeholder {
    text-align: right;
}

/* Pagination RTL */
.pagination {
    flex-direction: row-reverse;
}

.page-link {
    margin-left: -1px;
    margin-right: 0;
}

/* Navbar RTL */
.navbar-collapse {
    flex-direction: row-reverse;
}

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

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

/* Cards RTL */
.card {
    text-align: right;
    padding: 0.75rem;
    margin-bottom: 1rem;
    max-width: 70%;
    margin-right: auto;
    margin-left: auto;
}

.card-body {
    text-align: right;
    padding: 0.75rem;
}

/* Badges & Pills RTL */
.badge {
    display: inline-block;
    padding: 0.26em 0.49em;
    font-family: var(--font-heading);
}

/* Alerts RTL */
.alert {
    text-align: right;
}

.alert-dismissible .btn-close {
    margin-left: auto;
    margin-right: 0;
}

/* Button RTL */
.btn {
    text-align: center;
    font-family: var(--font-body);
    color: white !important;
}

.btn i {
    margin-left: 0;
    margin-right: 0.5rem;
    color: white !important;
}

/* Breadcrumbs RTL */
.breadcrumb {
    flex-direction: row-reverse;
}

.breadcrumb-item {
    padding-right: 0.375rem;
    padding-left: 0;
}

.breadcrumb-item::before {
    content: "/";
    margin-right: 0.375rem;
    margin-left: 0;
}

.breadcrumb-item:first-child::before {
    content: none;
    margin: 0;
}

/* Input Group RTL */
.input-group {
    flex-direction: row-reverse;
}

.input-group-text {
    margin-left: -1px;
    margin-right: 0;
}

/* Sidebar RTL */
.sidebar {
    padding-right: 0;
    padding-left: 0;
}

.sidebar a {
    text-align: right;
    padding-right: 0.75rem;
    padding-left: 0;
}

/* Typography RTL */
p {
    text-align: right;
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: #0d6efd;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Spacing utilities RTL adjustments */
.float-left {
    float: right;
}

.float-right {
    float: left;
}

.text-center {
    text-align: center;
}

/* Table article styling */
.table {
    direction: rtl;
    text-align: right;
}

.table thead th {
    font-family: var(--font-heading);
    font-weight: 700;
    border-bottom: 2px solid #dee2e6;
}

.table tbody td {
    vertical-align: middle;
}

/* Modal RTL */
.modal-content {
    direction: rtl;
    text-align: right;
}

.modal-header {
    text-align: right;
}

.close {
    margin-right: auto;
    margin-left: 0;
}

/* Search and Filter RTL */
.search-box,
.filter-section {
    text-align: right;
}

/* Utilities for specific Arabic content */
.font-cairo {
    font-family: var(--font-heading);
    font-weight: 600;
}

.font-amiri {
    font-family: var(--font-content);
}

.font-noto {
    font-family: var(--font-body);
}

/* Header and Footer Adjustments */
header {
    direction: rtl;
    text-align: right;
}

footer {
    direction: rtl;
    text-align: right;
}

footer h5,
header h5 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Date formatting for Arabic */
.date-arabic {
    direction: rtl;
    text-align: right;
}

/* Special styling for quotes */
blockquote {
    border-right: 4px solid var(--primary-color);
    border-left: 0;
    padding-right: 1rem;
    padding-left: 0;
    text-align: right;
}

/* Code blocks RTL */
code,
pre {
    direction: ltr;
    text-align: left;
}

/* Responsive adjustments for Arabic */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .article-content {
        line-height: 1.8;
    }
}

/* Print styles for Arabic content */
@media print {
    body {
        font-family: var(--font-body);
        direction: rtl;
    }
    
    h1, h2, h3, h4, h5, h6 {
        font-family: var(--font-heading);
    }
    
    .article-content {
        font-family: var(--font-content);
    }
}

/* Accessibility improvements */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--primary-color);
}

/* Link styles */
a {
    color: inherit;
    transition: color 0.3s ease;
}

a:visited {
    color: inherit;
}

/* Selection color */
::selection {
    background-color: var(--primary-color);
    color: white;
}

::-moz-selection {
    background-color: var(--primary-color);
    color: white;
}
