@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');

:root {
  --primary-color: #ffffff;
  --primary-dark: #f8f9fa;
  --primary-light: #e9ecef;
  --accent-color: #1a3a7a;
  --text-color: #000000;
  --bg-light: #fafafa;
  --card-border: #e0e0e0;
  --region-bg: #f0f0f0;
}

/* ===== الفلترة المحسنة ===== */
.filter-container {
  display: flex;
  justify-content: center;
  padding: 12px 15px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--card-border);
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  color: #000;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin: 0;
  text-decoration: none;
}

.filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
  background: #f8f8f8;
}

.filter-btn.active {
  background: var(--accent-color);
  color: white;
  box-shadow: 0 3px 6px rgba(26, 58, 122, 0.25);
  border-color: var(--accent-color);
}

.filter-btn.active i {
  color: #fff; /* تأكيد أن الأيقونة بيضاء في الحالة النشطة */
}

.filter-btn i {
  color: #000;
  font-size: 14px;
}

.filter-btn.active i {
  color: #fff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  overflow-x: hidden;
  height: 100%;
  font-size: 14px;
}

body {
  background-color: var(--bg-light);
  color: var(--text-color);
  font-family: 'Tajawal', sans-serif;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

/* ===== الهيدر الجديد المحسن ===== */
.site-header {
  width: 100%;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  margin-bottom: 0;
  position: relative;
  z-index: 100;
}

.site-header.scrolled {
  box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.topbar {
  background: #f8f9fa;
  padding: 5px 0;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: center;
}

.top-links {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-weight: 500;
  font-size: 12px;
  max-width: 1200px;
  width: 100%;
  padding: 0 12px;
}

.top-links a {
  color: #666;
  text-decoration: none;
  transition: all 0.3s ease;
}

.top-links a:hover {
  color: var(--accent-color);
}

.tutorials-link {
  display: none;
}

.mainbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #ffffff;
  max-width: 1200px;
  margin: 0 auto;
}

.hamburger {
  background: none;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  padding: 7px;
  color: #333;
  transition: all 0.3s ease;
  z-index: 101;
}

.hamburger:hover {
  color: var(--accent-color);
}

.logo {
  font-weight: 800;
  font-size: 20px;
  color: #333;
  text-decoration: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.logo-strong {
  color: var(--accent-color);
  margin-left: 5px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-actions .icon {
  font-size: 16px;
  color: #333;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.header-actions .icon:hover {
  color: var(--accent-color);
}

.category-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 7px 12px;
  border-top: 1px solid #e9ecef;
  background: #ffffff;
  white-space: nowrap;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

.category-nav::-webkit-scrollbar {
  height: 3px;
}

.category-nav::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.05);
}

.category-nav::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
}

.category-nav .nav-link {
  display: inline-block;
  padding: 7px 14px;
  text-decoration: none;
  color: #666;
  font-weight: 600;
  border-radius: 5px;
  transition: all 0.3s ease;
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.category-nav .nav-link:hover,
.category-nav .nav-link.active {
  background: #f8f9fa;
  color: var(--accent-color);
  border-color: #e9ecef;
}

/* ===== تنسيق موحد لجميع الأزرار النشطة ===== */
.category-nav .nav-link.active {
  background: #f8f9fa;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  box-shadow: 0 2px 4px rgba(26, 58, 122, 0.1);
}

/* ===== البحث المعدل - خلفية بيضاء ===== */
.search-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 15px;
  background: #ffffff;
  position: relative;
  gap: 8px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  margin-top: 0;
}

.search-input {
  width: 100%;
  max-width: 500px;
  padding: 10px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 25px;
  font-family: inherit;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  background: #fff;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  border-color: var(--accent-color);
}

.search-icon {
  color: #666;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 8px;
  border-radius: 50%;
  background: #f8f9fa;
}

.search-icon:hover {
  color: var(--accent-color);
  background: #e9ecef;
}

/* === تنسيقات البطاقات الجديدة المأخوذة من الرئيسية === */
.games-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 18px 12px;
  max-width: 1400px;
  margin: 0 auto;
}

.game-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  text-align: center;
  padding: 10px;
  border-radius: 5px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  border-color: var(--accent-color);
}

.game-card img {
  width: 100%;
  height: 170px;
  object-fit: contain;
  border-radius: 3px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.game-title {
  color: #000;
  font-weight: bold;
  font-size: 12px;
  line-height: 1.4;
  height: 34px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: auto;
}

/* إضافة شارة Popular للبطاقات الشائعة */
.game-card::before {
  content: 'Popular';
  position: absolute;
  top: 7px;
  right: 7px;
  background: var(--accent-color);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 3px;
  z-index: 2;
}

/* علامات الترجمة للعربية */
.game-translation {
  position: absolute;
  top: 7px;
  left: 7px;
  background: #28a745;
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 3px;
  z-index: 2;
}

.game-card.arabic-game::before {
  display: none;
}

/* إضافة معلومات التحميل والتقييم */
.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 7px;
  font-size: 11px;
  color: #666;
}

.download-count {
  display: flex;
  align-items: center;
  gap: 3px;
}

.rating {
  display: flex;
  align-items: center;
  gap: 2px;
}

.rating i {
  color: #ffc107;
  font-size: 9px;
}

.no-results {
  grid-column: 1/-1;
  text-align: center;
  padding: 35px 18px;
  color: #666;
  font-size: 15px;
  background: #f9f9f9;
  border-radius: 7px;
}

/* Enhanced and compact pagination */
.pagination-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 18px 0;
  gap: 8px;
}

.pagination-info {
  color: #666;
  font-size: 11px;
  text-align: center;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  max-width: 100%;
}

.pagination button {
  background: #fff;
  color: var(--text-color);
  border: 1px solid #ddd;
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button:not(:disabled):hover {
  background: #f8f9fa;
}

.page-number {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 10px;
}

.page-number.active {
  background: var(--accent-color);
  color: #fff;
  border-color: transparent;
}

.page-ellipsis {
  padding: 3px 2px;
  color: #666;
  font-size: 10px;
}

/* Platform Sections */
.platform-section {
  margin: 35px 0;
  width: 100%;
}

.platform-header {
  background: transparent;
  color: #000;
  padding: 12px 0;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #f0f0f0;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.platform-title {
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #000;
}

.view-all-btn {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.view-all-btn:hover {
  transform: translateX(-3px);
}

/* ===== القائمة الجانبية المعدلة ===== */
.categories-slider {
  position: fixed;
  top: 0;
  right: -280px;
  width: 260px;
  height: 100%;
  background-color: #fff;
  z-index: 1000;
  transition: right 0.3s ease;
  padding: 15px;
  overflow-y: auto;
  border-left: 1px solid var(--card-border);
  box-shadow: -4px 0 12px rgba(0,0,0,0.1);
}

.categories-slider.show {
  right: 0;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
  margin-bottom: 12px;
}

.slider-header h3 {
  color: #000;
  font-size: 1.1rem;
  font-weight: 700;
}

.close-slider {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #000;
  transition: all 0.3s ease;
}

.close-slider:hover {
  transform: rotate(90deg);
}

.categories-list {
  display: flex;
  flex-direction: column;
}

.categories-list a {
  padding: 10px 12px;
  color: #000;
  text-decoration: none;
  transition: all 0.2s;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #eee;
  display: flex;
  align-items: center;
}

.categories-list a i {
  margin-right: 8px;
  font-size: 1rem;
  width: 20px;
  color: #000;
}

.categories-list a:hover {
  background-color: #f8f9fa;
  color: var(--accent-color);
}

.categories-list a.active {
  background-color: #f8f9fa;
  color: var(--accent-color);
  border-right: 3px solid var(--accent-color);
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.4);
  z-index: 999;
}

.overlay.show {
  display: block;
}

/* Loading icon */
.loading-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
}

.loading-spinner.active {
  display: block;
}

.spinner {
  width: 45px;
  height: 45px;
  border: 4px solid rgba(26, 58, 122, 0.2);
  border-left: 4px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

.loading-text {
  color: var(--accent-color);
  font-size: 15px;
  font-weight: bold;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== الفوتر ===== */
.footer {
  margin-top: 35px;
  padding: 25px 0;
  color: #666;
  font-size: 0.8rem;
  border-top: 1px solid #f0f0f0;
  background: #fff;
  width: 100%;
  text-align: center;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f5f5f5;
  color: var(--accent-color);
  font-size: 0.9rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.footer-social a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent-color);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.3s ease;
}

.footer-social a:hover::before {
  transform: scale(1);
}

.footer-social a i {
  position: relative;
  z-index: 1;
}

.footer-social a:hover i {
  color: white;
}

.footer-social a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.footer-links a {
  color: var(--accent-color);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.8rem;
  position: relative;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 0;
  height: 1px;
  background: var(--accent-color);
  transition: width 0.3s ease;
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
  body {
    padding: 0;
  }
  
  .container {
    padding: 0 10px;
  }
  
  .mainbar {
    padding: 8px 12px;
  }
  
  .logo {
    font-size: 16px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .hamburger {
    margin-left: 0;
    margin-right: 0;
  }
  
  .header-actions {
    gap: 4px;
  }
  
  .header-actions .icon {
    padding: 4px;
  }
  
  .category-nav {
    padding: 7px 10px;
    justify-content: flex-start;
  }
  
  .category-nav .nav-link {
    padding: 7px 10px;
    font-size: 0.75rem;
  }
  
  /* تعديلات البطاقات للشاشات الصغيرة */
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 12px 10px;
    gap: 10px;
  }
  
  .game-card img {
    height: 150px;
  }
  
  .game-info {
    font-size: 10px;
  }
  
  .footer-social a {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
  
  .footer-links {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .game-card img {
    height: 140px;
  }
  
  .game-title {
    font-size: 11px;
  }
  
  .top-links {
    font-size: 11px;
    gap: 12px;
  }
  
  .category-nav .nav-link {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
  
  .header-actions .icon {
    font-size: 14px;
  }
}

/* Desktop Enhancements */
@media (min-width: 769px) {
  .games-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .container { 
    max-width: 100%; 
  }
  
  .games-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}