:root {
  --color-bg: #f9f9f9;
  --color-border: #BFB2AE;
  --color-btn: #191919;
  --color-btn-text: #ffffff;
  --color-btn-hover: #3e4c67;
  --color-btn-border: #95212c;
  --color-suggestions-bg: #efeadd;
  --color-suggestions-border: #747474;
  --color-text: #333;
  --input-radius: 33px;
  --font-main: 'Tajawal';
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
}

.search-heading {
  font-size: 18px;
  font-weight: bold;
  margin: 0px 3px 3px 4px;
  text-align: right;
  color: #9f1826;
}

.search-row {
  position: relative;
  display: block;
  flex-direction: column;
  gap: 10px;
  z-index: 1;
  padding: 0 !important;
}

/* ====== صندوق البحث ====== */
.search-input-box {
  display: flex !important;
  height: 56px !important;
  min-height: 56px !important;
  max-height: 56px !important;
  align-items: center;
  direction: rtl;
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--input-radius);
  padding: 2px;
  position: relative;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* ====== حقل الإدخال (يمتد لكامل الصندوق) ====== */
.search-input-field {
  /* جعله يغطي كامل الصندوق */
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  
  /* مسافات داخلية: يمين 70px لزر البحث، يسار 80px للأزرار الصوت والمسح */
  padding: 0 55px 0 96px !important;
  box-sizing: border-box !important;
  
  /* باقي خصائص التنسيق */
  border: none;
  font-size: 18px;
  font-weight: bold;
  text-align: right;
  font-family: var(--font-main);
  direction: rtl;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
  outline: none;
  cursor: text;
  line-height: 1.4;
  z-index: 1; /* يكون خلف الأزرار مباشرة */
}

.search-input-field:focus {
  outline: none;
}

/* ====== زر البحث الأصفر (في جهة اليمين) ====== */
.search-icon-btn {
  width: 40px;
  height: 40px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8cd6f;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  flex-shrink: 0;
  z-index: 2; /* فوق الحقل */
}

.search-icon-btn:hover {
  background: #bb9c7f;
  transform: scale(1.05);
}

.search-icon-btn:active {
  transform: scale(0.95);
}

.search-icon-btn:focus {
  outline: none;
  box-shadow: none;
}

/* ====== الأزرار اليسرى (صوت، فاصل، مسح) - تبقى متلاصقة كما هي ====== */
.icon-buttons {
  position: absolute !important;
  left: 20px !important;
  right: auto !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 2px !important;
  white-space: nowrap;
  z-index: 2; /* فوق الحقل */
}

.btn-voice,
.btn-clear,
.slash-separator {
  display: inline-block !important;
  flex-shrink: 0 !important;
  line-height: 1;
}

.slash-separator {
  font-size: 18px;
  color: #999;
  user-select: none;
  transition: color 0.3s ease, transform 0.3s ease;
  margin: 0;
  padding: 0 2px;
}

.slash-separator:hover {
  color: #555;
  transform: translate(3px, -3px);
}

.btn-clear {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #c0392b;
  transition: color 0.3s ease, transform 0.3s ease;
  margin: 0;
  padding: 0 2px;
}

.btn-clear:hover {
  color: #e74c3c;
  transform: translate(5px, -5px);
}

.btn-voice {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #555;
  transition: color 0.3s ease, transform 0.3s ease;
  margin: 0;
  padding: 0 2px;
}

.btn-voice:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.btn-voice:hover {
  color: #000;
  transform: translate(-5px, 5px);
}

.custom-placeholder-text {
  position: absolute;
  right: 60px !important;
  top: 50%;
  transform: translateY(-50%);
  color: #777;
  opacity: 0.7;
  pointer-events: none;
  font-weight: 700 !important;
  font-size: 18px;
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  z-index: 1;
}

/* ====== قائمة الاقتراحات ====== */
.search-suggestions {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  margin-top: 14px;
  z-index: 9999;
  background: var(--color-suggestions-bg);
  border: 1px solid var(--color-suggestions-border);
  max-height: 300px;
  overflow-y: auto;
  border-radius: 10px;
}

.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 18px;
  border-bottom: 1px solid #ccc;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: right;
}

.suggestion-item:hover {
  background-color: #f0f0f0;
}

/* ====== تحسينات للشاشات الصغيرة ====== */
@media (max-width: 600px) {
  .search-heading {
    font-size: 18px;
    margin: 0px 2px 0px 0px;
    text-align: center;
  }

  .search-input-box {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
  }

  .search-input-field {
    padding: 0 60px 0 70px !important; /* تقليل المسافات للشاشات الصغيرة */
    font-size: 16px;
  }

  .icon-buttons {
    left: 10px !important;
    gap: 1px !important;
  }

  .btn-clear,
  .btn-voice {
    font-size: 18px;
    padding: 0 1px;
  }

  .slash-separator {
    font-size: 16px;
    padding: 0 1px;
  }

  .search-icon-btn {
    width: 34px;
    height: 34px;
    font-size: 16px;
    margin-right: 2px;
  }

  .custom-placeholder-text {
    right: 50px !important;
    font-size: 14px;
  }
}

html,
body {
  overflow-x: hidden;
}

.search-wrapper,
.search-input-box,
.search-input-field {
  max-width: 100%;
  box-sizing: border-box;
}

.search-input-box {
  overflow: hidden;
}

.custom-placeholder-text {
  font-size: 18px !important;
}

@media (max-width: 600px) {
  .custom-placeholder-text {
    font-size: 12px !important;
    right: 50px !important;
    white-space: nowrap;
  }
}