/* ========================================== */
/* تنسيقات التوب بار (كامل ومُصحح للغتين) */
/* ========================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Amazon Ember", Arial, sans-serif;
}

body {
  background-color: #faf6f3;
  overflow-x: hidden;
}

/* تعديل هام: شلنا direction: rtl عشان الصفحة تاخد الاتجاه من ملف الـ Blade */
.top-bar {
  background-color: #E9E1DD;
  padding: 0;
  width: 100%;
  height: 74px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
}

.top-bar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 100%;
}

/* ========================================== */
/* اللوجو */
/* ========================================== */

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 60px;
  width: 200px;
  display: block;
}

/* ========================================== */
/* شريط البحث (ديسكتوب) */
/* ========================================== */

.search-wrapper {
  flex: 1;
  position: relative;
  max-width: 650px;
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border-radius: 4px;
  padding: 0;
  border: 1px solid #cdcdcd;
  /* overflow: hidden removed to allow dropdown visibility */
  height: 42px;
}

.search-select {
  padding: 0 12px;
  border: none;
  /* تغيير جوهري: الخط الفاصل يكون في "نهاية" العنصر حسب اللغة */
  border-inline-end: 1px solid #cdcdcd;
  border-radius: 0;
  background: #f3f3f3;
  font-size: 12px;
  color: #333;
  outline: none;
  cursor: pointer;
  font-weight: 400;
  min-width: 160px;
  height: 100%;
}

.search-select:focus {
  border-color: #cdcdcd;
  background: #e7e7e7;
}

.search-input {
  flex: 1;
  /* تبديل الـ padding ليعمل مع الجهتين */
  padding-inline-start: 12px;
  padding-inline-end: 48px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #333;
  outline: none;
  height: 100%;
}

.search-input::placeholder {
  color: #999;
}

.search-btn {
  position: absolute;
  /* تغيير جوهري: الزرار يكون في "نهاية" الشريط حسب اللغة */
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: #111;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0;
  padding: 0;
}

.search-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.search-btn svg {
  width: 20px;
  height: 20px;
}

/* اقتراحات البحث (ديسكتوب) */
.search-suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
}

.search-suggestion-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #333;
  font-size: 14px;
  border-bottom: 1px solid #f5f5f5;
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-item:hover {
  background: #f9f9f9;
}

.suggestion-type {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #eee;
  color: #666;
}

.suggestion-type.type-product {
  background: #e7f5ff;
  color: #007185;
}

/* ========================================== */
/* مجموعة اليمين (اللغة + الدول + تسجيل الدخول) */
/* ========================================== */

.topbar-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================== */
/* تغيير اللغة */
/* ========================================== */

.lang-switcher {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid #d5d9d9;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 400;
  color: #111;
  font-size: 13px;
  height: 36px;
}

.lang-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: #a0a0a0;
}

.lang-btn i {
  font-size: 10px;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  /* يضمن أن القائمة تفتح محاذية للزرار سواء عربي أو إنجليزي */
  inset-inline-end: 0;
  min-width: 110px;
  background: #fff;
  border: 1px solid #d5d9d9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  overflow: hidden;
  display: none;
  z-index: 9999;
}

.lang-dropdown.active {
  display: block;
}

/* تصحيح شكل الروابط داخل الدروب داون */
.lang-option {
  display: block;
  /* عشان ياخد العرض كامل */
  width: 100%;
  text-align: inherit;
  /* عشان يتبع اتجاه اللغة (يمين في العربي، يسار في الإنجليزي) */
  padding: 10px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 400;
  color: #333;
  /* لون الخط أسود بدل الأزرق */
  font-size: 13px;
  text-decoration: none;
  /* إزالة الخط اللي تحت اللينك */
  transition: background 0.2s;
}

.lang-option:hover {
  background: #f3f3f3;
  color: #111;
}

.lang-option.active {
  background: #e7f5ff;
  color: #007185;
  font-weight: 700;
  /* تمييز العنصر النشط */
}

/* ========================================== */
/* الدول */
/* ========================================== */

.country-switcher {
  position: relative;
}

.country-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid #d5d9d9;
  border-radius: 4px;
  cursor: pointer;
  height: 36px;
}

.country-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: #a0a0a0;
}

.country-btn i {
  font-size: 10px;
  color: #565959;
}

.flag-icon {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  object-fit: cover;
  display: block;
  border: 1px solid #ddd;
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  /* القائمة تفتح من بداية العنصر */
  inset-inline-start: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #d5d9d9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  overflow: hidden;
  display: none;
  z-index: 9999;
  text-align: start;
  /* مهم عشان النصوص تتظبط */
}

.country-dropdown.active {
  display: block;
}

.country-search-box {
  padding: 10px;
  border-bottom: 1px solid #e7e7e7;
}

.country-search-box input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid #d5d9d9;
  outline: none;
}

.country-search-box input:focus {
  border-color: #007185;
}

.country-dropdown .country-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

.country-dropdown .country-list li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  text-decoration: none;
  color: #333;
  transition: background 0.15s;
}

.country-dropdown .country-list li a:hover {
  background: #f3f3f3;
}

/* ========================================== */
/* تسجيل الدخول */
/* ========================================== */

.account-section {
  display: flex;
  align-items: center;
}

.account-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #111;
  transition: opacity 0.2s;
  padding: 6px 8px;
  border-radius: 4px;
}

.account-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.account-icon-bundlex {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid #d5d9d9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.account-icon-bundlex svg {
  stroke: #111;
  width: 18px;
  height: 18px;
}

.account-item span {
  font-size: 13px;
  font-weight: 600;
}

/* ========================================== */
/* إخفاء الموبايل افتراضيًا */
/* ========================================== */

.mobile-only {
  display: none;
}

/* ========================================== */
/* Modal المحافظات والدول للموبايل */
/* ========================================== */

.countries-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
}

.countries-modal.active {
  display: block;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 70vh;
  background: #fff;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a1a;
}

.close-modal {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.close-modal svg {
  stroke: #666;
}

.modal-body {
  padding: 12px;
  max-height: calc(70vh - 50px);
  overflow-y: auto;
}

.modal-body .country-search {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.modal-body .country-search input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.modal-body .country-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.modal-body .country-list li {
  padding: 0;
}

.modal-body .country-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}

.modal-body .country-list a:hover {
  background: #f9f9f9;
}

/* تنسيق الأعلام في المودال */
.modal-body .country-list .flag-icon {
  width: 24px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* ========================================== */
/* Modal البحث للموبايل */
/* ========================================== */

.search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001;
}

.search-modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.search-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.search-modal-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: #fff;
  animation: modalSlideDown 0.25s ease;
  max-height: 80vh;
  overflow-y: auto;
}

@keyframes modalSlideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid #eee;
}

.search-modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a1a;
}

.close-search-modal {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.close-search-modal svg {
  stroke: #666;
}

.search-modal-body {
  padding: 14px;
}

.search-wrapper-modal {
  position: relative;
  width: 100%;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: none;
  background-color: transparent;
}

/* دروب داون المحافظات في الموبايل */
.search-select-modal {
  width: 100%;
  padding: 0 16px;
  border: 1px solid #ddd;
  background: #fdfbfb;
  font-size: 14px;
  color: #333;
  outline: none;
  height: 48px;
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
}

html[lang^="en"] .search-select-modal {
  background-position: right 16px center;
}

html[lang^="ar"] .search-select-modal {
  background-position: left 16px center;
}

.search-input-group-modal {
  position: relative;
  width: 100%;
  display: flex;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #fdfbfb;
  /* overflow: hidden removed to allow dropdown visibility */
}

/* حقل الإدخال */
.search-input-modal {
  width: 100%;
  border: none;
  background-color: transparent;
  padding-block: 12px;
  padding-inline-start: 16px;
  padding-inline-end: 48px;
  height: 48px;
  outline: none;
}

.search-input-modal:focus {
  background-color: #fff;
}

/* زر البحث */
.search-btn-modal {
  position: absolute;
  /* تغيير المكان بناءً على اللغة */
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: #000;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.search-btn-modal:hover {
  background: #333;
}

.search-suggestions {
  margin-top: 12px;
}

.suggestions-title {
  font-size: 12px;
  font-weight: 700;
  color: #777;
  margin-bottom: 8px;
}

.suggestions-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.suggestions-list li a {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
  border-radius: 6px;
  transition: background 0.15s;
}

.suggestions-list li a:hover {
  background: #f5f5f5;
}

/* ========================================== */
/* تجاوب الشاشات */
/* ========================================== */

@media (max-width: 992px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .top-bar {
    height: auto;
    padding: 6px 0;
  }

  .top-bar-container {
    padding: 0 12px;
    gap: 8px;
  }

  .icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #000;
    display: flex;
    align-items: center;
  }

  .logo img {
    height: 28px;
    width: auto;
    max-width: 160px;
  }
}

/* ========================================== */
/* تحسين عرض الأعلام في مودال الدول (موبايل) */
/* ========================================== */

.countries-modal .country-list {
  padding: 0;
  margin: 0;
}

.countries-modal .country-list li {
  margin: 0;
}

.countries-modal .country-list a {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: #222;
  font-size: 15px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.countries-modal .country-list a:hover {
  background: #f8f8f8;
}

.countries-modal .country-list .flag-icon {
  width: 28px;
  height: 20px;
  min-width: 28px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.countries-modal .country-list span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}