/* هدر مشترک (TeamZoom از search.html) — رنگ‌ها داخل .header اسکوپ شده‌اند تا صفحات دیگر :root را عوض نکنند */

.header {
  --h-blue: #4f6ef7;
  --h-blue-dark: #3a56d4;
  --h-blue-light: #eef1ff;
  --h-purple: #7c3aed;
  --h-gray-50: #f9fafb;
  --h-gray-100: #f3f4f6;
  --h-gray-200: #e5e7eb;
  --h-gray-300: #d1d5db;
  --h-gray-400: #9ca3af;
  --h-gray-500: #6b7280;
  --h-gray-600: #4b5563;
  --h-gray-700: #374151;
  --h-gray-900: #111827;
  --h-white: #fff;

  font-family: "Vazirmatn", "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;

  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h, 72px);
  min-height: var(--header-h, 72px);
  background: var(--h-white);
  border-bottom: 1px solid var(--h-gray-200);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  overflow: visible;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.header .logo .site-logo {
  flex-shrink: 0;
}

.header .logo-text {
  font-family: "Vazirmatn", "Plus Jakarta Sans", sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--h-gray-900);
  line-height: 1;
}

.header .search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
  display: flex;
  align-items: center;
}

.header .search-ico-btn {
  position: absolute;
  inset-inline-start: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--h-gray-400);
  transition: color 0.12s, background 0.12s;
}

.header .search-ico-btn:hover,
.header .search-ico-btn:focus-visible {
  color: var(--h-gray-600);
  background: var(--h-gray-100);
  outline: none;
}

.header .search-ico {
  flex-shrink: 0;
  pointer-events: none;
}

.header .search-suggest-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.header .search-suggest-wrap .search-input {
  width: 100%;
}

.header .search-suggest-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 320px;
  overflow-y: auto;
  background: var(--h-white);
  border: 1px solid var(--h-gray-200);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  z-index: 250;
  padding: 4px;
  direction: rtl;
  text-align: right;
}

.header .search-suggest-dropdown.open {
  display: block;
}

.header .search-suggest-item {
  width: 100%;
  border: none;
  background: transparent;
  margin: 0;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  text-align: right;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--h-gray-900);
  border-radius: 8px;
  transition: background 0.12s;
  direction: rtl;
}

.header .search-suggest-item:hover,
.header .search-suggest-item.active {
  background: var(--h-gray-100);
}

.header .search-suggest-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--h-gray-200);
}

.header .search-suggest-avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--h-blue), var(--h-purple));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.header .search-suggest-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: right;
}

.header .search-suggest-name {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header .search-suggest-item--freetext {
  border-bottom: 1px solid var(--h-gray-100);
  margin-bottom: 2px;
  padding-bottom: 10px;
}

.header .search-suggest-sub,
.header .search-suggest-alias {
  font-size: 11px;
  color: var(--h-gray-500);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header .search-suggest-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--h-gray-500);
  background: var(--h-gray-100);
  padding: 2px 7px;
  border-radius: 999px;
}

.header .search-suggest-query-ico {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--h-blue-light);
  color: var(--h-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header .search-suggest-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--h-gray-500);
  text-align: center;
}

.header .search-suggest-wrap--open {
  z-index: 251;
}

.header .search-input {
  width: 100%;
  height: 40px;
  padding: 0 44px 0 40px;
  border: 1.5px solid var(--h-gray-200);
  border-radius: 20px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--h-gray-50);
  color: var(--h-gray-900);
  transition: border-color 0.2s;
}

.header .search-input:focus {
  border-color: var(--site-secondary, #141d30);
  background: var(--h-white);
}

.header .search-input::placeholder {
  color: var(--h-gray-400);
}

.header .filter-ico-btn {
  position: absolute;
  inset-inline-end: 8px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--h-gray-500);
  transition: background 0.2s, color 0.2s;
}

.header .filter-ico-btn:hover,
.header .filter-ico-btn.active {
  background: var(--site-secondary, #141d30);
  color: white;
}

.header .nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline-start: auto;
  flex-shrink: 1;
  min-width: 0;
}

.header .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  text-decoration: none;
  color: var(--h-gray-500);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.2s, background 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
}

.header .nav-item:hover {
  background: var(--h-gray-100);
  color: var(--h-gray-700);
}

.header .nav-item.active {
  color: var(--site-secondary, #141d30);
}

.header .nav-item.active::after {
  content: "";
  position: absolute;
  bottom: -11px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--site-secondary, #141d30);
  border-radius: 2px 2px 0 0;
}

.header .nav-item--locked {
  opacity: 0.38;
  color: var(--h-gray-400);
  cursor: not-allowed;
  pointer-events: none;
  gap: 0;
  padding-top: 6px;
  padding-bottom: 6px;
}

.header .nav-item--locked:hover {
  background: none;
  color: var(--h-gray-400);
}

.header .nav-item__icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-bottom: 2px;
}

.header .nav-item--locked .nav-item__icon {
  opacity: 0.85;
}

.header .nav-item__lock {
  position: absolute;
  inset-inline-end: -4px;
  bottom: -3px;
  padding: 1px;
  border-radius: 999px;
  background: var(--h-white);
  color: var(--h-gray-500);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.header .nav-item--locked .nav-item__title {
  display: block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.header .nav-item--locked .nav-item__soon {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--h-gray-400);
  white-space: nowrap;
}

.header .header-nav-dropdown {
  position: relative;
}

.header .header-nav-dropdown > summary {
  list-style: none;
}

.header .header-nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.header .header-nav-dropdown__panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 180px;
  background: var(--h-white);
  border: 1px solid var(--h-gray-200);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.06);
  padding: 6px 0;
  z-index: 220;
}

.header .header-nav-dropdown__item {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--h-gray-700);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.header .header-nav-dropdown__item:hover,
.header .header-nav-dropdown__item--active {
  background: var(--h-gray-100);
  color: var(--h-gray-900);
}

.header .header-nav-dropdown--workspace .header-nav-dropdown__panel {
  min-width: 200px;
  max-width: 260px; /* محدود کردن عرض برای فعال شدن ellipsis روی اسم میزکار */
  padding: 6px 0;
}

.header .header-nav-dropdown__team {
  position: relative;
}

.header .header-nav-dropdown__team-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  color: var(--h-gray-700);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.header .header-nav-dropdown__team-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header .header-nav-dropdown__team-chevron {
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.header .header-nav-dropdown__team:hover > .header-nav-dropdown__team-label,
.header .header-nav-dropdown__team:focus-within > .header-nav-dropdown__team-label {
  background: var(--h-gray-100);
  color: var(--h-gray-900);
}

.header .header-nav-dropdown__team:hover > .header-nav-dropdown__team-label .header-nav-dropdown__team-chevron,
.header .header-nav-dropdown__team:focus-within > .header-nav-dropdown__team-label .header-nav-dropdown__team-chevron {
  opacity: 1;
}

.header .header-nav-dropdown__subpanel {
  display: none;
  position: absolute;
  top: 0;
  inset-inline-start: calc(100% - 6px);
  min-width: 180px;
  background: var(--h-white);
  border: 1px solid var(--h-gray-200);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.06);
  padding: 6px 0;
  z-index: 230;
}

.header .header-nav-dropdown__team:hover > .header-nav-dropdown__subpanel,
.header .header-nav-dropdown__team:focus-within > .header-nav-dropdown__subpanel {
  display: block;
}

.header .notif-badge {
  position: absolute;
  top: 2px;
  inset-inline-start: 6px;
  background: #dc2626;
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--h-white, #fff);
  line-height: 1;
  pointer-events: none;
}

.header .notif-badge[hidden] {
  display: none !important;
}

.header .user-menu {
  position: relative;
  flex-shrink: 0;
  z-index: 210;
  max-width: min(200px, 34vw);
}

.header .user-menu__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  margin: 0;
  border: none;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  font: inherit;
  color: inherit;
  transition: background 0.2s ease;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  direction: rtl;
}

.header .user-menu__trigger:hover,
.header .user-menu__trigger:focus-visible {
  background: #f5f5f5;
  outline: none;
}

.header .user-menu__trigger[aria-expanded="true"] {
  background: #f5f5f5;
}

.header .user-menu__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--h-gray-200);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--h-blue), var(--h-purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.header .user-menu__avatar--img {
  padding: 0;
}

.header .user-menu__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
  text-align: right;
}

.header .user-menu__chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--h-gray-500);
  transition: transform 0.2s ease;
  margin-inline-end: 2px;
}

.header .user-menu__trigger[aria-expanded="true"] .user-menu__chevron {
  transform: rotate(180deg);
}

.header .user-menu__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  inset-inline-start: auto;
  width: 240px;
  max-width: min(240px, calc(100vw - 16px));
  background: #fff;
  border-radius: 12px;
  padding: 8px 0;
  margin: 0;
  list-style: none;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.06);
  opacity: 0;
  transform: scale(0.95) translateY(-5px);
  transform-origin: top right;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.header .user-menu__dropdown.is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.header[dir="rtl"] .user-menu__dropdown {
  transform-origin: top left;
}

.header .user-menu__summary {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--h-gray-100);
}

.header .user-menu__summary-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--h-gray-200);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--h-blue), var(--h-purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.header .user-menu__summary-avatar--img {
  padding: 0;
}

.header .user-menu__summary-text {
  min-width: 0;
  text-align: right;
}

.header .user-menu__summary-name {
  font-family: "Vazirmatn", "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  font-style: normal;
  color: var(--h-gray-900);
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.header .user-menu__summary-text .user-menu__summary-name {
  word-break: break-word;
}

.header .user-menu__summary-email {
  font-size: 12px;
  color: var(--h-gray-500);
  margin-top: 2px;
  word-break: break-word;
}

.header .user-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--h-gray-700);
  font-family: inherit;
  transition: background 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: right;
  direction: rtl;
  cursor: pointer;
  box-sizing: border-box;
}

.header .user-menu__item:hover,
.header .user-menu__item:focus-visible {
  background: #f5f5f5;
  outline: none;
}

.header .user-menu__item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--h-gray-600);
  stroke: currentColor;
  fill: none;
}

.header .user-menu__item--logout {
  color: #e53935;
}

.header .user-menu__item--logout .user-menu__item-icon {
  color: #e53935;
}

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

.header .header-auth-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.header .header-auth-btn--login {
  color: var(--h-gray-700);
  background: transparent;
  border: 1.5px solid var(--h-gray-300, #d1d5db);
}

.header .header-auth-btn--login:hover {
  background: #f5f5f5;
  border-color: var(--h-gray-400, #9ca3af);
}

.header .header-auth-btn--signup {
  color: #fff;
  background: #4f46e5;
  border: 1.5px solid #4f46e5;
}

.header .header-auth-btn--signup:hover {
  background: #4338ca;
  border-color: #4338ca;
}

@media (max-width: 640px) {
  .header .user-menu__trigger {
    max-width: min(200px, 52vw);
    padding-right: 8px;
  }

  .header .header-auth-btn {
    padding: 7px 12px;
    font-size: 13px;
  }

  .header .search-suggest-dropdown {
    max-height: min(50vh, 280px);
    -webkit-overflow-scrolling: touch;
  }

  .header .search-suggest-item {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .header .search-suggest-avatar {
    width: 36px;
    height: 36px;
  }
}
