/* =========================
   HEADER BASE
========================= */
.es-header {
  background: #fff;
  border-bottom: 1px solid #000;
  z-index: 1050;
}

/* Logo */
.header-logo {
  height: 40px;
  border-radius: 5px;
}

/* Location */
.location-pin {
  width: 20px;
  height: 20px;
}
.location-text {
  font-size: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Search Area */
.search-area {
  width: 530px;
  max-width: 100%;
}

.search-input {
  padding: 10px 14px !important;
  font-size: 0.92rem;
  border-right: 1px solid lightgray !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  border-top-right-radius: 5px !important;
  border-bottom-right-radius: 5px !important;
}

.input-group-text {
  border-radius: 5px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

.search-btn {
  color: #fff !important;
  padding: 10px 27px !important;
  border-radius: 5px 0 0 5px !important; /* exactly your original */
  border: 1px solid lightgray;
  border-right: none;
}
.search-btn:hover {
  background: #3490e3 !important;
}
/* =========================
   INSTANT SEARCH DROPDOWN
========================= */

.suggestions-box {
  position: absolute;
  top: 54px; /* دقیقاً زیر input */
  right: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  max-height: 260px;
  overflow-y: auto;
  padding: 0;
  margin-top: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  z-index: 3000; /* بالاتر از هدر */
}

.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.suggestion-item span:first-child {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.suggestion-item:hover {
  background: #f2f2f2;
}

/* دکمه حذف (×) فقط روی hover دیده شود */
.delete-suggestion {
  opacity: 0;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.suggestion-item:hover .delete-suggestion {
  opacity: 1;
}

/* Buttons */
.action-btn {
  border-radius: 5px;
  padding: 10px 25px;
  font-size: 0.9rem;
}
/* ============================
   WHITE BUTTON
============================ */
.whiteBtn {
  background: #fff;
  border: 1px solid #a3a3a3;
  color: #333;
  transition: 0.2s;
}

.whiteBtn:hover {
  background: #f2f2f2;
  border-color: #8d8d8d;
}

/* Active (زمانی که کلیک می‌شود) */
.whiteBtn:active {
  background: #e6e6e6 !important;
  border-color: #7a7a7a !important;
  transform: scale(0.97);
}

/* Focus (وقتی انتخاب می‌شود) */
.whiteBtn:focus,
.whiteBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 144, 227, 0.35); /* آبی برند */
}

/* ============================
   BLUE BUTTON
============================ */
.blueBtn {
  background-color: #3490e3;
  border: 1px solid #3490e3;
  color: #fff;
  transition: 0.2s;
}

/* Hover */
.blueBtn:hover {
  background-color: #2f86d4 !important;
  border-color: #2f86d4 !important;
}

/* Active */
.blueBtn:active {
  background-color: #2779bd !important; /* هاور تیره‌تر */
  border-color: #2779bd !important;
  transform: scale(0.97);
}

/* Focus */
.blueBtn:focus,
.blueBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 144, 227, 0.4);
  background-color: #3490e3;
}

.whiteBtn:hover {
  background-color: #f5f5f5 !important; /* خاکستری خیلی کم */
  border-color: #8f8f8f !important; /* کمی تیره‌تر */
  color: #000 !important;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: url("/src/img/avatar.jpg") center/cover no-repeat;
  border: 1px solid #000;
}

/* ====================================================
       RESPONSIVE — Only resize items (992px → larger)
  ==================================================== */

/* ★ XL: 1200–1399 */
@media (min-width: 1200px) and (max-width: 1399px) {
  .header-logo {
    height: 38px;
  }

  .search-area {
    width: 460px;
  }

  .search-input {
    font-size: 0.88rem;
    padding: 9px 12px !important;
  }
}

/* ★ LG: 992–1199 */
@media (min-width: 992px) and (max-width: 1199px) {
  .header-logo {
    height: 34px;
  }

  .search-area {
    width: 400px;
  }

  .search-input {
    font-size: 0.85rem;
    padding: 8px 12px !important;
  }

  .search-btn {
    padding: 8px 14px !important;
    font-size: 0.82rem;
  }

  .action-btn {
    padding: 6px 18px;
    font-size: 0.82rem;
  }

  .avatar {
    width: 34px;
    height: 34px;
  }
}

/* ★ Shrink slightly 992–1070 */
@media (max-width: 1070px) {
  .search-area {
    width: 370px;
  }
  .header-logo {
    height: 30px;
  }

  .search-input {
    font-size: 0.82rem !important;
  }

  .location-text {
    font-size: 0.55rem;
  }
}

/* ====================================================
       SMART HIDE — ONLY when space is tight
  ==================================================== */
@media (max-width: 1280px) {
  .location-text {
    display: none !important;
  }
}

/* کمی خواناتر شدن location در دسکتاپ */
.location-text {
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- تبلت و موبایل: ساختار ستونی ---------- */
@media (max-width: 991.98px) {
  .es-header .container-fluid {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  /* ردیف لوگو */
  .es-header .container-fluid > div:first-child {
    justify-content: center;
  }

  .header-logo {
    height: 32px;
  }

  /* ردیف لوکیشن: فقط آیکن */
  .location-text {
    display: none !important;
  }

  .location-pin {
    width: 20px;
    height: 20px;
  }

  .es-header .container-fluid > div:nth-child(2) {
    justify-content: center;
  }

  /* سرچ فول‌ویدث زیرش */
  .search-area {
    width: 100%;
  }

  .search-input {
    font-size: 0.85rem !important;
    padding: 8px 10px !important;
  }

  .search-btn {
    padding: 8px 14px !important;
    font-size: 0.8rem;
  }

  /* ردیف دکمه‌ها: وسط‌چین و جمع‌وجور */
  .es-header .container-fluid > div:last-child {
    justify-content: center;
    gap: 0.5rem;
  }

  .action-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .avatar {
    width: 32px;
    height: 32px;
  }
}

/* ---------- موبایل خیلی کوچک ---------- */
@media (max-width: 575.98px) {
  .header-logo {
    height: 28px;
  }

  .search-input {
    font-size: 0.78rem !important;
  }

  .search-btn {
    display: none; /* اگر خواستی نگه‌داری، این خط رو حذف کن */
  }

  .action-btn {
    padding: 5px 8px;
    font-size: 0.78rem;
  }
}

@media (min-width: 1281px) and (max-width: 1425px) {
  .location-text {
    font-size: 0.55rem;
  }
}

/* =========================
   FIX: Focus border for whole search group
========================= */

/* 1) remove default focus ring from input */
.search-input:focus,
.search-input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-color: #3490e3 !important; /* optional */
}

/* 2) apply focus ring to the whole group */
.search-area .input-group {
  border-radius: 5px; /* match your corners */
}

/* when any child (input/button) is focused -> highlight the whole group */
.search-area .input-group:focus-within {
  /* box-shadow: 0 0 0 2px rgba(52, 144, 227, 0.35) !important; */
  border-radius: 5px;
}

/* 3) make borders look unified */
.search-area .input-group .search-input,
.search-area .input-group .search-btn {
  box-shadow: none !important;
}

/* optional: keep consistent borders while focused */
.search-area .input-group:focus-within .search-input,
.search-area .input-group:focus-within .search-btn {
  border-color: #3490e3 !important;
}

/* =========================
   ACTIONS / USER AREA (NEW)
========================= */
.es-actions {
  flex-wrap: nowrap;
}

/* user trigger area */
.es-user {
  position: relative; /* ✅ anchor for dropdown */
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
}

.es-user:hover {
  background: #f6f7f9;
}

.es-user-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  color: #111;
  white-space: nowrap;
}

/* avatar polish */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* dropdown base */
.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  z-index: 4000;

  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: 0.18s ease;
}

/* open state (same class you already use in JS) */
.user-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* optional: small arrow */
.user-menu::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 18px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-left: 1px solid #e6e6e6;
  border-top: 1px solid #e6e6e6;
  transform: rotate(45deg);
}

/* menu items look */
.user-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.92rem;
}

.user-menu .menu-item:hover {
  background: #f2f4f7;
}

.user-menu .menu-item i {
  font-size: 1.05rem;
}

.user-menu .menu-divider {
  height: 1px;
  background: #eee;
  margin: 8px 0;
}

.user-menu .menu-section-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #666;
  padding: 6px 10px 2px;
}

.user-menu .menu-item.danger {
  color: #b42318;
}
.user-menu .menu-item.danger:hover {
  background: rgba(180, 35, 24, 0.08);
}

/* =========================
   RESPONSIVE FIX
========================= */
@media (max-width: 991.98px) {
  .es-actions {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .es-user-title {
    font-size: 0.9rem;
  }
}

@media (max-width: 575.98px) {
  .es-user-title {
    display: none; /* ✅ mobile: فقط آواتار بمونه */
  }
}
