/* =====================================
   تحسينات نظام التبويبات - Tabs Styling
   ===================================== */

/* تحسين أزرار التبويبات الأساسية */
.tab-btn, .tab-head-card {
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  font-size: 16px;
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
}

.tab-btn:hover, .tab-head-card:hover {
  background: rgba(0, 123, 255, 0.05);
  color: #007bff;
  border-bottom-color: #007bff;
}

/* التبويب المفعل */
.tab-btn.active-tab, 
.tab-head-card.active-tab,
.tab-btn.active,
.tab-head-card.active {
  background: rgba(0, 123, 255, 0.1);
  color: #007bff;
  border-bottom-color: #007bff;
  font-weight: 600;
}

/* إضاءة للتبويب المفعل */
.tab-btn.active-tab::after, 
.tab-head-card.active-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #007bff, #0056b3);
  border-radius: 3px 3px 0 0;
}

/* محتوى التبويبات */
.tab-content {
  display: none;
  animation: fadeInTabs 0.3s ease;
  padding: 20px 0;
}

.tab-content.active,
.tab-content[style*="display: block"] {
  display: block !important;
}

/* انتقال سلس للمحتوى */
@keyframes fadeInTabs {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* دعم Ant Design Tabs */
.ant-tabs-tabpane {
  display: none !important;
}

.ant-tabs-tabpane.ant-tabs-tabpane-active {
  display: block !important;
  animation: fadeInTabs 0.3s ease;
}

.ant-tabs-tabpane-hidden {
  display: none !important;
}

/* تحسين قائمة التبويبات */
.tab-head-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
  border-radius: 8px 8px 0 0;
}

.tab-head-roww {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
  border-radius: 8px 8px 0 0;
  padding: 0;
}

/* Grid للتبويبات */
.tab-head-row .ant-row {
  width: 100%;
  gap: 0 !important;
}

.tab-head-row .ant-col,
.tab-head-roww .ant-col {
  padding: 0 !important;
  flex: 1;
  min-width: 120px;
}

.tab-head-card {
  width: 100%;
  justify-content: center;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 12px 8px;
}

.tab-head-card.active-tab {
  border-bottom-color: #007bff;
  background: #fff;
}

/* Container التبويبات */
.tabs-wrapper, .tabs-content {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tabs-content {
  padding: 0;
}

/* شبكة المحتوى */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px;
}

/* تحسين التوافقية مع الأجهزة المختلفة */
@media (max-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 16px;
  }
  
  .tab-head-card {
    padding: 10px 6px;
    font-size: 14px;
  }
  
  .tab-head-card span {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 12px;
  }
  
  .tab-head-row, .tab-head-roww {
    flex-direction: column;
  }
  
  .tab-head-row .ant-col,
  .tab-head-roww .ant-col {
    width: 100%;
  }
  
  .tab-head-card {
    padding: 10px 12px;
    font-size: 13px;
    justify-content: flex-start;
  }
  
  .tab-head-card img {
    width: 18px !important;
    height: 18px !important;
  }
  
  .tab-btn, .tab-head-card {
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }
  
  .tab-btn, .tab-head-card {
    padding: 8px 10px;
    font-size: 12px;
    gap: 4px;
  }
  
  .tab-head-card img {
    width: 16px !important;
    height: 16px !important;
  }
}

/* تحسينات للأجهزة اللمسية */
@media (hover: none) and (pointer: coarse) {
  .tab-btn, .tab-head-card {
    padding: 14px 12px;
    min-height: 44px;
  }
  
  .tab-btn:active, .tab-head-card:active {
    background: rgba(0, 123, 255, 0.15);
  }
}

/* دعم الوضع الليلي */
@media (prefers-color-scheme: dark) {
  .tab-btn, .tab-head-card {
    color: #e0e0e0;
    border-bottom-color: transparent;
  }
  
  .tab-head-row, .tab-head-roww {
    background: #2a2a2a;
    border-bottom-color: #444;
  }
  
  .tab-btn:hover, .tab-head-card:hover {
    background: rgba(0, 123, 255, 0.1);
    color: #66b3ff;
  }
  
  .tab-btn.active-tab, .tab-head-card.active-tab {
    background: rgba(0, 123, 255, 0.2);
    color: #66b3ff;
  }
  
  .tabs-wrapper, .tabs-content {
    background: #1a1a1a;
  }
}

/* دعم RTL (العربية) */
[dir="rtl"] .tab-btn,
[dir="rtl"] .tab-head-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .tab-btn.active-tab::after,
[dir="rtl"] .tab-head-card.active-tab::after {
  right: auto;
  left: 0;
}

[dir="rtl"] .tab-btn:hover,
[dir="rtl"] .tab-head-card:hover {
  border-left-color: #007bff;
  border-bottom-color: transparent;
}

/* تحسين التنقل بالتبويب */
.tab-btn:focus,
.tab-head-card:focus {
  outline: 2px solid #007bff;
  outline-offset: -2px;
}

/* تحسين الانتقالات */
.tab-content {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* منع التحديد المزدوج */
.tab-btn, .tab-head-card {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* تأثير نشط */
.tab-btn.active-tab img,
.tab-head-card.active-tab img {
  filter: brightness(0.9);
}

/* تحسين الأداء */
.tab-content {
  will-change: opacity;
}

.tabs-wrapper {
  contain: layout style paint;
}
