/* RTL Support for Persian Website */

/* Import Persian fonts */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* Base RTL styles */
html[dir="rtl"] {
  font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
}

html[dir="rtl"] body {
  font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
  text-align: right;
}

/* RTL Navigation adjustments */
html[dir="rtl"] nav ul {
  direction: rtl;
}

html[dir="rtl"] nav ul li {
  margin-left: 0;
  margin-right: 1.5rem;
}

html[dir="rtl"] nav ul li:last-child {
  margin-right: 0;
}

/* RTL Form elements */
html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] input::placeholder,
html[dir="rtl"] textarea::placeholder {
  text-align: right;
  direction: rtl;
}

/* RTL Button alignment */
html[dir="rtl"] .flex {
  flex-direction: row-reverse;
}

html[dir="rtl"] .flex-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .flex-col {
  flex-direction: column;
}

/* RTL Grid adjustments */
html[dir="rtl"] .grid {
  direction: rtl;
}

/* RTL Text alignment */
html[dir="rtl"] .text-left {
  text-align: right;
}

html[dir="rtl"] .text-right {
  text-align: left;
}

/* RTL Margin and Padding utilities */
html[dir="rtl"] .ml-3 { margin-left: 0; margin-right: 0.75rem; }
html[dir="rtl"] .ml-4 { margin-left: 0; margin-right: 1rem; }
html[dir="rtl"] .ml-6 { margin-left: 0; margin-right: 1.5rem; }
html[dir="rtl"] .mr-3 { margin-right: 0; margin-left: 0.75rem; }
html[dir="rtl"] .mr-4 { margin-right: 0; margin-left: 1rem; }
html[dir="rtl"] .mr-6 { margin-right: 0; margin-left: 1.5rem; }

html[dir="rtl"] .pl-3 { padding-left: 0; padding-right: 0.75rem; }
html[dir="rtl"] .pl-4 { padding-left: 0; padding-right: 1rem; }
html[dir="rtl"] .pl-6 { padding-left: 0; padding-right: 1.5rem; }
html[dir="rtl"] .pr-3 { padding-right: 0; padding-left: 0.75rem; }
html[dir="rtl"] .pr-4 { padding-right: 0; padding-left: 1rem; }
html[dir="rtl"] .pr-6 { padding-right: 0; padding-left: 1.5rem; }

/* RTL Border radius adjustments */
html[dir="rtl"] .rounded-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-top-right-radius: 0.25rem; border-bottom-right-radius: 0.25rem; }
html[dir="rtl"] .rounded-r { border-top-right-radius: 0; border-bottom-right-radius: 0; border-top-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem; }

/* RTL Icon positioning */
html[dir="rtl"] .icon-left { margin-left: 0; margin-right: 0.5rem; }
html[dir="rtl"] .icon-right { margin-right: 0; margin-left: 0.5rem; }

/* RTL List styles */
html[dir="rtl"] ul {
  padding-right: 1.5rem;
  padding-left: 0;
}

html[dir="rtl"] ol {
  padding-right: 1.5rem;
  padding-left: 0;
}

/* RTL Table styles */
html[dir="rtl"] table {
  direction: rtl;
}

html[dir="rtl"] th,
html[dir="rtl"] td {
  text-align: right;
}

/* RTL Modal and dropdown adjustments */
html[dir="rtl"] .dropdown-menu {
  right: 0;
  left: auto;
}

/* RTL Card and component adjustments */
html[dir="rtl"] .card-header {
  text-align: right;
}

html[dir="rtl"] .card-body {
  text-align: right;
}

/* RTL Footer adjustments */
html[dir="rtl"] footer {
  text-align: right;
}

/* RTL Alert and notification styles */
html[dir="rtl"] .alert {
  text-align: right;
}

html[dir="rtl"] .alert .alert-icon {
  margin-left: 0.5rem;
  margin-right: 0;
}

/* RTL Breadcrumb adjustments */
html[dir="rtl"] .breadcrumb {
  direction: rtl;
}

html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
  content: "\\";
  margin-left: 0.5rem;
  margin-right: 0;
}

/* RTL Pagination adjustments */
html[dir="rtl"] .pagination {
  direction: rtl;
}

/* RTL Progress bar adjustments */
html[dir="rtl"] .progress {
  direction: rtl;
}

/* RTL Badge and label adjustments */
html[dir="rtl"] .badge {
  margin-left: 0.25rem;
  margin-right: 0;
}

/* RTL Tooltip adjustments */
html[dir="rtl"] .tooltip {
  direction: rtl;
}

/* RTL Popover adjustments */
html[dir="rtl"] .popover {
  direction: rtl;
}

/* RTL Carousel adjustments */
html[dir="rtl"] .carousel {
  direction: rtl;
}

/* RTL Accordion adjustments */
html[dir="rtl"] .accordion {
  direction: rtl;
}

/* RTL Tab adjustments */
html[dir="rtl"] .nav-tabs {
  direction: rtl;
}

/* RTL Navbar adjustments */
html[dir="rtl"] .navbar {
  direction: rtl;
}

html[dir="rtl"] .navbar-nav {
  direction: rtl;
}

/* RTL Sidebar adjustments */
html[dir="rtl"] .sidebar {
  right: 0;
  left: auto;
}

/* RTL Offcanvas adjustments */
html[dir="rtl"] .offcanvas {
  right: 0;
  left: auto;
}

/* RTL Toast adjustments */
html[dir="rtl"] .toast {
  direction: rtl;
}

/* RTL Spinner adjustments */
html[dir="rtl"] .spinner {
  direction: rtl;
}

/* RTL Custom scrollbar for RTL */
html[dir="rtl"] ::-webkit-scrollbar {
  direction: rtl;
}

/* RTL Focus styles */
html[dir="rtl"] *:focus {
  outline-offset: -2px;
}

/* RTL Selection styles */
html[dir="rtl"] ::selection {
  background-color: rgba(59, 130, 246, 0.3);
}

/* RTL Print styles */
@media print {
  html[dir="rtl"] {
    direction: rtl;
  }
  
  html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
  }
}

/* RTL Responsive adjustments */
@media (max-width: 768px) {
  html[dir="rtl"] .mobile-menu {
    direction: rtl;
  }
  
  html[dir="rtl"] .mobile-menu ul {
    padding-right: 1rem;
    padding-left: 0;
  }
}

/* RTL Animation adjustments */
html[dir="rtl"] .fade-in-right {
  animation: fadeInRight 0.3s ease-in-out;
}

html[dir="rtl"] .fade-in-left {
  animation: fadeInLeft 0.3s ease-in-out;
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* RTL Custom utilities */
.rtl-text {
  direction: rtl;
  text-align: right;
}

.rtl-input {
  direction: rtl;
  text-align: right;
}

.rtl-list {
  direction: rtl;
  padding-right: 1.5rem;
  padding-left: 0;
}

/* RTL Persian number formatting */
html[dir="rtl"] .persian-numbers {
  font-feature-settings: "numr" 1;
  font-variant-numeric: tabular-nums;
}

/* RTL Persian date formatting */
html[dir="rtl"] .persian-date {
  direction: rtl;
  text-align: right;
}

/* RTL Persian currency formatting */
html[dir="rtl"] .persian-currency {
  direction: rtl;
  text-align: right;
}

/* RTL Persian phone number formatting */
html[dir="rtl"] .persian-phone {
  direction: ltr;
  text-align: left;
  unicode-bidi: bidi-override;
}

/* RTL Persian email formatting */
html[dir="rtl"] .persian-email {
  direction: ltr;
  text-align: left;
  unicode-bidi: bidi-override;
}

/* RTL Persian URL formatting */
html[dir="rtl"] .persian-url {
  direction: ltr;
  text-align: left;
  unicode-bidi: bidi-override;
}
