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

/* تحسينات عامة للتصميم المتجاوب */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Almarai', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* تحسينات الهيدر */
.header-enhanced {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.search-bar-enhanced {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-bar-enhanced:focus {
  background: white;
  border-color: #0c7b62;
  box-shadow: 0 0 0 4px rgba(12, 123, 98, 0.1);
}

/* تحسينات الأزرار */
.btn-enhanced {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-enhanced:hover::before {
  left: 100%;
}

/* تحسينات الفوتر */
.footer-enhanced {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.footer-link {
  position: relative;
  transition: all 0.3s ease;
}

.footer-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background: #10b981;
  transition: width 0.3s ease;
}

.footer-link:hover::after {
  width: 100%;
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .header-mobile {
    padding: 0.75rem 0;
  }
  
  .logo-mobile {
    height: 2.5rem;
  }
  
  .title-mobile {
    font-size: 1.125rem;
    line-height: 1.4;
  }
  
  .subtitle-mobile {
    font-size: 0.75rem;
  }
  
  .search-mobile {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  
  .btn-mobile {
    padding: 0.75rem;
    min-height: 44px;
    min-width: 44px;
  }
  
  .footer-mobile {
    padding: 2rem 0;
  }
  
  .footer-section-mobile {
    margin-bottom: 2rem;
  }
  
  .footer-title-mobile {
    font-size: 1.125rem;
    margin-bottom: 1rem;
  }
  
  .footer-text-mobile {
    font-size: 0.875rem;
    line-height: 1.5;
  }
}

/* تحسينات للشاشات المتوسطة */
@media (min-width: 641px) and (max-width: 1024px) {
  .header-tablet {
    padding: 1rem 0;
  }
  
  .logo-tablet {
    height: 3rem;
  }
  
  .title-tablet {
    font-size: 1.5rem;
  }
  
  .search-tablet {
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
  }
  
  .btn-tablet {
    padding: 1rem;
  }
}

/* تحسينات للشاشات الكبيرة */
@media (min-width: 1025px) {
  .header-desktop {
    padding: 1.25rem 0;
  }
  
  .logo-desktop {
    height: 4rem;
  }
  
  .title-desktop {
    font-size: 2rem;
  }
  
  .search-desktop {
    padding: 1.25rem 1.75rem;
    font-size: 1.25rem;
  }
  
  .btn-desktop {
    padding: 1.25rem;
  }
}

/* تحسينات الأنيميشن */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.animate-pulse-custom {
  animation: pulse 2s infinite;
}

/* تحسينات إمكانية الوصول */
.focus-visible:focus {
  outline: 2px solid #0c7b62;
  outline-offset: 2px;
}

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

/* تحسينات الأداء */
.will-change-transform {
  will-change: transform;
}

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

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* تحسينات للطباعة */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  img {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* تحسينات للوضع المظلم */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    background-color: #1f2937;
    color: #f9fafb;
  }
  
  .dark-mode-auto .bg-white {
    background-color: #374151;
  }
  
  .dark-mode-auto .text-gray-900 {
    color: #f9fafb;
  }
  
  .dark-mode-auto .text-gray-700 {
    color: #d1d5db;
  }
  
  .dark-mode-auto .border-gray-200 {
    border-color: #4b5563;
  }
}

/* تحسينات الحركة المخفضة */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* تحسينات للشاشات عالية الكثافة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .high-dpi {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* تحسينات التمرير */
.smooth-scroll {
  scroll-behavior: smooth;
}

.scroll-snap-container {
  scroll-snap-type: y mandatory;
}

.scroll-snap-item {
  scroll-snap-align: start;
}

/* تحسينات الشبكة */
.grid-responsive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .grid-responsive {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* تحسينات الصور */
.img-responsive {
  max-width: 100%;
  height: auto;
  object-fit: cover;
  loading: lazy;
}

.img-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* تحسينات النصوص */
.text-responsive {
  font-size: clamp(0.875rem, 2.5vw, 1.125rem);
  line-height: 1.6;
}

.heading-responsive {
  font-size: clamp(1.5rem, 5vw, 3rem);
  line-height: 1.2;
}

/* تحسينات المسافات */
.spacing-responsive {
  padding: clamp(1rem, 4vw, 2rem);
  margin: clamp(0.5rem, 2vw, 1rem) 0;
}

/* تحسينات الحدود */
.border-responsive {
  border-radius: clamp(0.5rem, 2vw, 1rem);
  border-width: clamp(1px, 0.2vw, 2px);
}

/* تحسينات الظلال */
.shadow-responsive {
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.06);
}

@media (min-width: 1024px) {
  .shadow-responsive {
    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;
  --secondary-color: #f59e0b;
  --accent-color: #10b981;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --background-primary: #ffffff;
  --background-secondary: #f9fafb;
  --border-color: #e5e7eb;
}

/* تحسينات التفاعل */
.interactive {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.interactive:hover {
  transform: translateY(-2px);
}

.interactive:active {
  transform: translateY(0);
}

/* تحسينات التحميل */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

/* تحسينات الأخطاء */
.error-state {
  color: #dc2626;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  padding: 1rem;
}

.success-state {
  color: #059669;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 0.5rem;
  padding: 1rem;
}

/* تحسينات النماذج */
.form-enhanced input,
.form-enhanced textarea,
.form-enhanced select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.3s ease;
}

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

/* تحسينات الجداول */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  min-width: 600px;
  width: 100%;
}

@media (max-width: 640px) {
  .table-responsive table {
    font-size: 0.875rem;
  }
}
