/* إصلاحات RTL وتحسينات التناسق لموقع دار النصيحة */

/* إعدادات RTL الأساسية */
html[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

body {
  direction: rtl;
  text-align: right;
  font-family: 'Almarai', sans-serif !important;
}

/* إصلاحات الهيدر */
.header-rtl {
  direction: rtl;
}

.header-rtl .flex {
  direction: rtl;
}

.header-rtl .justify-between {
  justify-content: space-between;
}

/* إصلاحات الشعار */
.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  direction: rtl;
}

.logo-text {
  text-align: right;
  direction: rtl;
}

/* إصلاحات شريط البحث */
.search-input-rtl {
  direction: rtl;
  text-align: right;
  padding-right: 3.5rem;
  padding-left: 1.5rem;
}

.search-button-rtl {
  right: 1rem;
  left: auto;
}

/* إصلاحات الأزرار */
.btn-group-rtl {
  display: flex;
  align-items: center;
  gap: 1rem;
  direction: rtl;
}

.btn-rtl {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  direction: rtl;
}

.btn-text-rtl {
  text-align: right;
  direction: rtl;
}

/* إصلاحات القوائم المنسدلة */
.dropdown-rtl {
  right: 0;
  left: auto;
  direction: rtl;
  text-align: right;
}

.dropdown-item-rtl {
  display: flex;
  align-items: center;
  direction: rtl;
  text-align: right;
}

.dropdown-icon-rtl {
  margin-right: 0;
  margin-left: 1rem;
}

/* إصلاحات القائمة المحمولة */
.mobile-menu-rtl {
  right: 0;
  left: auto;
  direction: rtl;
}

.mobile-search-rtl {
  direction: rtl;
  text-align: right;
  padding-right: 3rem;
  padding-left: 1rem;
}

.mobile-search-button-rtl {
  right: 0.75rem;
  left: auto;
}

/* إصلاحات الفوتر */
.footer-rtl {
  direction: rtl;
  text-align: right;
}

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

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

.footer-contact-rtl {
  display: flex;
  align-items: center;
  direction: rtl;
  gap: 1rem;
}

.footer-icon-rtl {
  margin-left: 0;
  margin-right: 1rem;
}

/* تحسينات التناسق */
.consistent-spacing {
  padding: 1rem;
  margin: 0.5rem 0;
}

.consistent-border {
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
}

.consistent-shadow {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.consistent-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.consistent-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ألوان متناسقة */
:root {
  --primary-color: #0c7b62;
  --primary-hover: #065a47;
  --secondary-color: #f59e0b;
  --accent-color: #10b981;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --background-primary: #ffffff;
  --background-secondary: #f9fafb;
  --background-tertiary: #f3f4f6;
  --border-color: #e5e7eb;
  --border-hover: #d1d5db;
}

.text-primary-custom {
  color: var(--text-primary);
}

.text-secondary-custom {
  color: var(--text-secondary);
}

.text-muted-custom {
  color: var(--text-muted);
}

.bg-primary-custom {
  background-color: var(--primary-color);
}

.bg-primary-custom:hover {
  background-color: var(--primary-hover);
}

.border-custom {
  border-color: var(--border-color);
}

.border-custom:hover {
  border-color: var(--border-hover);
}

/* تحسينات الخطوط */
.font-primary {
  font-family: 'Almarai', sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

.font-bold-custom {
  font-weight: 700;
}

.font-semibold-custom {
  font-weight: 600;
}

.font-medium-custom {
  font-weight: 500;
}

/* أحجام النصوص المتناسقة */
.text-xs-custom { font-size: 0.75rem; line-height: 1rem; }
.text-sm-custom { font-size: 0.875rem; line-height: 1.25rem; }
.text-base-custom { font-size: 1rem; line-height: 1.5rem; }
.text-lg-custom { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl-custom { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl-custom { font-size: 1.5rem; line-height: 2rem; }
.text-3xl-custom { font-size: 1.875rem; line-height: 2.25rem; }

/* تحسينات المسافات */
.spacing-xs { padding: 0.25rem; margin: 0.125rem; }
.spacing-sm { padding: 0.5rem; margin: 0.25rem; }
.spacing-md { padding: 0.75rem; margin: 0.375rem; }
.spacing-lg { padding: 1rem; margin: 0.5rem; }
.spacing-xl { padding: 1.25rem; margin: 0.625rem; }
.spacing-2xl { padding: 1.5rem; margin: 0.75rem; }

/* تحسينات الأزرار */
.btn-primary-custom {
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary-custom:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(12, 123, 98, 0.3);
}

.btn-secondary-custom {
  background-color: transparent;
  color: var(--primary-color);
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid var(--primary-color);
  cursor: pointer;
}

.btn-secondary-custom:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
}

/* تحسينات النماذج */
.input-custom {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  direction: rtl;
  text-align: right;
  font-family: 'Almarai', sans-serif;
}

.input-custom:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(12, 123, 98, 0.1);
}

.input-custom::placeholder {
  color: var(--text-muted);
  direction: rtl;
  text-align: right;
}

/* تحسينات البطاقات */
.card-custom {
  background-color: var(--background-primary);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  direction: rtl;
  text-align: right;
}

.card-custom:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* تحسينات الشبكة */
.grid-custom {
  display: grid;
  gap: 1.5rem;
  direction: rtl;
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* تحسينات الأنيميشن */
.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-up {
  animation: slideUp 0.5s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes scaleIn {
  from { 
    opacity: 0; 
    transform: scale(0.9); 
  }
  to { 
    opacity: 1; 
    transform: scale(1); 
  }
}

/* تحسينات الاستجابة */
@media (max-width: 640px) {
  .header-mobile-rtl {
    padding: 0.75rem;
  }
  
  .logo-mobile-rtl {
    gap: 0.5rem;
  }
  
  .logo-mobile-rtl h1 {
    font-size: 1.125rem;
  }
  
  .btn-mobile-rtl {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .search-mobile-rtl {
    padding: 0.75rem;
    font-size: 0.875rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .header-tablet-rtl {
    padding: 1rem;
  }
  
  .logo-tablet-rtl h1 {
    font-size: 1.5rem;
  }
  
  .btn-tablet-rtl {
    padding: 0.75rem;
    gap: 0.75rem;
  }
}

@media (min-width: 1025px) {
  .header-desktop-rtl {
    padding: 1.25rem;
  }
  
  .logo-desktop-rtl h1 {
    font-size: 2rem;
  }
  
  .btn-desktop-rtl {
    padding: 1rem;
    gap: 1rem;
  }
}

/* إصلاحات خاصة للعناصر المعكوسة */
.rtl-fix {
  direction: rtl !important;
  text-align: right !important;
}

.ltr-fix {
  direction: ltr !important;
  text-align: left !important;
}

/* إصلاحات الأيقونات */
.icon-rtl {
  margin-left: 0.5rem;
  margin-right: 0;
}

.icon-ltr {
  margin-right: 0.5rem;
  margin-left: 0;
}

/* تحسينات إمكانية الوصول */
.focus-visible-custom:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.sr-only-custom {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* تحسينات الطباعة */
@media print {
  .no-print-custom {
    display: none !important;
  }
  
  .print-only-custom {
    display: block !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
    color: black;
    background: white;
  }
  
  .card-custom {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* تحسينات الأداء */
.gpu-accelerated-custom {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.will-change-transform-custom {
  will-change: transform;
}

.will-change-opacity-custom {
  will-change: opacity;
}
