/* ============================================================
   1. بارگذاری فونت وزیرمتن از CDN
   ============================================================ */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* ============================================================
   2. تنظیمات ریشه و متغیرهای CSS (تم دیفالت Bootstrap)
   ============================================================ */
:root {
  /* رنگ‌های اصلی Bootstrap 5 */
  --bs-white: #ffffff;
  --bs-gray-100: #f8f9fa;
  --bs-gray-200: #e9ecef;
  --bs-gray-300: #dee2e6;
  --bs-gray-400: #ced4da;
  --bs-gray-500: #adb5bd;
  --bs-gray-600: #6c757d;
  --bs-gray-700: #495057;
  --bs-gray-800: #343a40;
  --bs-gray-900: #212529;
  --bs-black: #000000;

  --bs-blue: #0d6efd;
  --bs-indigo: #6610f2;
  --bs-purple: #6f42c1;
  --bs-pink: #d63384;
  --bs-red: #dc3545;
  --bs-orange: #fd7e14;
  --bs-yellow: #ffc107;
  --bs-green: #198754;
  --bs-teal: #20c997;
  --bs-cyan: #0dcaf0;

  --bs-primary: #0d6efd;
  --bs-secondary: #6c757d;
  --bs-success: #198754;
  --bs-info: #0dcaf0;
  --bs-warning: #ffc107;
  --bs-danger: #dc3545;
  --bs-light: #f8f9fa;
  --bs-dark: #212529;

  /* تنظیمات تایپوگرافی */
  --bs-font-family-base: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bs-font-family-sans-serif: var(--bs-font-family-base);
  --bs-font-family-monospace: 'Vazirmatn', SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  --bs-body-bg: #ffffff;
  --bs-body-color: #212529;
  --bs-body-font-size: 1rem;
  --bs-body-font-weight: 400;
  --bs-body-line-height: 1.6;

  /* حاشیه‌ها */
  --bs-border-radius: 0.375rem;
  --bs-border-radius-sm: 0.25rem;
  --bs-border-radius-lg: 0.5rem;
}

/* ============================================================
   3. تنظیمات پایه Bootstrap
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--bs-font-family-base);
  font-size: var(--bs-body-font-size);
  font-weight: var(--bs-body-font-weight);
  line-height: var(--bs-body-line-height);
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.02em;
}

/* تنظیمات تیترها */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

h1, .h1 { font-size: calc(1.375rem + 1.5vw); }
h2, .h2 { font-size: calc(1.325rem + 0.9vw); }
h3, .h3 { font-size: calc(1.3rem + 0.6vw); }
h4, .h4 { font-size: calc(1.275rem + 0.3vw); }
h5, .h5 { font-size: 1.25rem; }
h6, .h6 { font-size: 1rem; }

/* پاراگراف */
p {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* لینک‌ها */
a {
  color: var(--bs-primary);
  text-decoration: underline;
}

a:hover {
  color: #0a58ca;
}

/* ============================================================
   4. کلاس‌های Justify (تراز شده)
   ============================================================ */
.text-justify {
  text-align: justify !important;
  text-justify: inter-word;
  word-spacing: -0.05em;
}

.justify-text {
  text-align: justify !important;
  text-justify: distribute;
  hyphens: auto;
}

.text-justify-rtl {
  text-align: justify !important;
}

/* ============================================================
   5. پشتیبانی کامل از RTL (راست‌چین)
   ============================================================ */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] * {
  direction: rtl;
  text-align: right;
}

/* اصلاح المان‌های خاص در حالت RTL */
[dir="rtl"] .dropdown-menu {
  text-align: right;
}

[dir="rtl"] .dropdown-menu .dropdown-item {
  text-align: right;
}

[dir="rtl"] .navbar-nav .nav-link {
  text-align: right;
}

[dir="rtl"] .list-group-item {
  text-align: right;
}

[dir="rtl"] .card-title,
[dir="rtl"] .card-text,
[dir="rtl"] .card-body {
  text-align: right;
}

[dir="rtl"] .modal-header,
[dir="rtl"] .modal-footer {
  flex-direction: row-reverse;
}

[dir="rtl"] .form-label {
  text-align: right;
}

[dir="rtl"] .form-check {
  padding-left: 0;
  padding-right: 1.5em;
}

[dir="rtl"] .form-check .form-check-input {
  margin-left: 0;
  margin-right: -1.5em;
}

[dir="rtl"] .form-check .form-check-label {
  text-align: right;
}

/* چرخش آیکون‌های جهت‌دار در RTL */
[dir="rtl"] .bi-chevron-right {
  transform: rotate(180deg);
}

[dir="rtl"] .bi-chevron-left {
  transform: rotate(180deg);
}

[dir="rtl"] .bi-arrow-right {
  transform: rotate(180deg);
}

[dir="rtl"] .bi-arrow-left {
  transform: rotate(180deg);
}

[dir="rtl"] .bi-caret-right {
  transform: rotate(180deg);
}

[dir="rtl"] .bi-caret-left {
  transform: rotate(180deg);
}

/* نوار ناوبری در RTL */
[dir="rtl"] .navbar-brand {
  margin-right: 0;
  margin-left: 1rem;
}

[dir="rtl"] .navbar-toggler {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .navbar-nav {
  padding-right: 0;
}

/* مسیرنما (Breadcrumb) در RTL */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item {
  padding-left: 0;
  padding-right: 0.5rem;
}

[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
  padding-left: 0;
  padding-right: 0.5rem;
  content: '«';
}

/* صفحه‌بندی (Pagination) در RTL */
[dir="rtl"] .page-item:first-child .page-link {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--bs-border-radius);
  border-bottom-right-radius: var(--bs-border-radius);
}

[dir="rtl"] .page-item:last-child .page-link {
  border-top-left-radius: var(--bs-border-radius);
  border-bottom-left-radius: var(--bs-border-radius);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

[dir="rtl"] .pagination .page-item + .page-item {
  margin-left: 0;
  margin-right: -1px;
}

/* آکاردئون (Accordion) در RTL */
[dir="rtl"] .accordion-button {
  text-align: right;
}

[dir="rtl"] .accordion-button::after {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .accordion-button:not(.collapsed)::after {
  transform: rotate(180deg);
}

[dir="rtl"] .accordion-body {
  text-align: right;
}

/* جداول در RTL */
[dir="rtl"] .table {
  text-align: right;
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
  text-align: right;
}

/* Tooltip و Popover در RTL */
[dir="rtl"] .tooltip {
  text-align: right;
}

[dir="rtl"] .popover {
  text-align: right;
}

[dir="rtl"] .popover-header,
[dir="rtl"] .popover-body {
  text-align: right;
}

[dir="rtl"] .popover .popover-arrow {
  right: auto;
}

[dir="rtl"] .toast-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .toast-header .btn-close {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .offcanvas-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .offcanvas-header .btn-close {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .modal-header .btn-close {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .alert {
  text-align: right;
}

[dir="rtl"] .alert .btn-close {
  right: auto;
  left: 0;
}

[dir="rtl"] .list-unstyled {
  padding-right: 0;
}

[dir="rtl"] .list-inline {
  padding-right: 0;
}

[dir="rtl"] .list-inline-item:not(:last-child) {
  margin-right: 0;
  margin-left: 0.5rem;
}

[dir="rtl"] .input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--bs-border-radius);
  border-bottom-right-radius: var(--bs-border-radius);
}

[dir="rtl"] .input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n+3),
[dir="rtl"] .input-group:not(.has-validation) > .form-floating:not(:last-child) > .form-control,
[dir="rtl"] .input-group:not(.has-validation) > .form-floating:not(:last-child) > .form-select {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: var(--bs-border-radius);
  border-bottom-right-radius: var(--bs-border-radius);
}

[dir="rtl"] .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
  margin-left: 0;
  margin-right: -1px;
  border-top-left-radius: var(--bs-border-radius);
  border-bottom-left-radius: var(--bs-border-radius);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

[dir="rtl"] .input-group > .form-floating:not(:first-child) > .form-control,
[dir="rtl"] .input-group > .form-floating:not(:first-child) > .form-select {
  border-top-left-radius: var(--bs-border-radius);
  border-bottom-left-radius: var(--bs-border-radius);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

[dir="rtl"] .dropdown-toggle::after {
  margin-left: 0;
  margin-right: 0.255em;
}

[dir="rtl"] .btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

[dir="rtl"] .btn-group > .btn:not(:first-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

[dir="rtl"] .btn-group .btn + .btn {
  margin-left: 0;
  margin-right: -1px;
}

[dir="rtl"] .btn-group-vertical .btn + .btn {
  margin-left: 0;
}

/* ============================================================
   6. کلاس‌های ترکیبی برای راست/چپ هوشمند
   ============================================================ */
.text-right-rtl {
  text-align: right !important;
}

[dir="rtl"] .text-right-rtl {
  text-align: right !important;
}

[dir="ltr"] .text-right-rtl {
  text-align: left !important;
}

.text-left-rtl {
  text-align: left !important;
}

[dir="rtl"] .text-left-rtl {
  text-align: left !important;
}

[dir="ltr"] .text-left-rtl {
  text-align: right !important;
}

/* ============================================================
   7. کلاس‌های هم‌ترازی استاندارد
   ============================================================ */
.text-start {
  text-align: left !important;
}

.text-end {
  text-align: right !important;
}

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

[dir="rtl"] .text-start {
  text-align: right !important;
}

[dir="rtl"] .text-end {
  text-align: left !important;
}

/* ============================================================
   8. ویژگی‌های پیشرفته فونت وزیرمتن
   ============================================================ */
* {
  font-feature-settings: 'ss02' on, 'ss03' on, 'ss04' on, 'cv01' on, 'cv02' on, 'cv03' on;
}

small,
.small {
  font-weight: 300;
}

/* بهبود Justify برای متون فارسی */
[dir="rtl"] .text-justify,
[dir="rtl"] .justify-text,
[dir="rtl"] .text-justify-rtl {
  text-justify: kashida;
  word-spacing: 0.05em;
}

[dir="ltr"] .text-justify,
[dir="ltr"] .justify-text {
  text-justify: inter-word;
  word-spacing: 0.05em;
}

/* ============================================================
   9. پشتیبانی از حالت تاریک (Dark Mode)
   ============================================================ */
[data-bs-theme="dark"] {
  --bs-body-bg: #212529;
  --bs-body-color: #f8f9fa;
  --bs-primary: #6ea8fe;
  --bs-secondary: #adb5bd;
  --bs-success: #75b798;
  --bs-info: #6edff6;
  --bs-warning: #ffda6a;
  --bs-danger: #ea868f;
  --bs-light: #dee2e6;
  --bs-dark: #f8f9fa;
  --bs-border-color: #495057;
}

[data-bs-theme="dark"] body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .card {
  background-color: #2b3035;
  border-color: #373b3e;
}

[data-bs-theme="dark"] .bg-light {
  background-color: #2b3035 !important;
}

[data-bs-theme="dark"] .bg-white {
  background-color: #2b3035 !important;
}

[data-bs-theme="dark"] .text-dark {
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .border {
  border-color: #373b3e !important;
}

[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
  --bs-table-active-bg: rgba(255, 255, 255, 0.1);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
  border-color: #373b3e;
}

[data-bs-theme="dark"] .dropdown-menu {
  background-color: #2b3035;
  border-color: #373b3e;
}

[data-bs-theme="dark"] .dropdown-item {
  color: #f8f9fa;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
  background-color: #373b3e;
}

[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.65);
}

[data-bs-theme="dark"] .navbar-light .navbar-nav .nav-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="dark"] .modal-content {
  background-color: #2b3035;
  border-color: #373b3e;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: #373b3e;
}

[data-bs-theme="dark"] .form-control {
  background-color: #2b3035;
  border-color: #373b3e;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .form-control:focus {
  background-color: #2b3035;
  border-color: #6ea8fe;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .form-select {
  background-color: #2b3035;
  border-color: #373b3e;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .input-group-text {
  background-color: #373b3e;
  border-color: #373b3e;
  color: #f8f9fa;
}

/* ============================================================
   10. تنظیمات نهایی و بهینه‌سازی
   ============================================================ */

/* بهبود نمایش اسکرول در RTL */
[dir="rtl"] ::-webkit-scrollbar {
  width: 12px;
}

[dir="rtl"] ::-webkit-scrollbar-track {
  background: #f1f1f1;
}

[dir="rtl"] ::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 6px;
}

[dir="rtl"] ::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* پشتیبانی از تصاویر float در RTL */
[dir="rtl"] .float-start {
  float: right !important;
}

[dir="rtl"] .float-end {
  float: left !important;
}

[dir="ltr"] .float-start {
  float: left !important;
}

[dir="ltr"] .float-end {
  float: right !important;
}

[dir="rtl"] .me-1 {
  margin-right: 0 !important;
  margin-left: 0.25rem !important;
}

[dir="rtl"] .ms-1 {
  margin-left: 0 !important;
  margin-right: 0.25rem !important;
}

[dir="rtl"] .me-2 {
  margin-right: 0 !important;
  margin-left: 0.5rem !important;
}

[dir="rtl"] .ms-2 {
  margin-left: 0 !important;
  margin-right: 0.5rem !important;
}

[dir="rtl"] .me-3 {
  margin-right: 0 !important;
  margin-left: 1rem !important;
}

[dir="rtl"] .ms-3 {
  margin-left: 0 !important;
  margin-right: 1rem !important;
}

[dir="rtl"] .pe-1 {
  padding-right: 0 !important;
  padding-left: 0.25rem !important;
}

[dir="rtl"] .ps-1 {
  padding-left: 0 !important;
  padding-right: 0.25rem !important;
}

[dir="rtl"] .pe-2 {
  padding-right: 0 !important;
  padding-left: 0.5rem !important;
}

[dir="rtl"] .ps-2 {
  padding-left: 0 !important;
  padding-right: 0.5rem !important;
}

/* ============================================================
   پایان فایل استایل
   ============================================================ */