/**
 * Albi CRM — global search widget
 */
.albi-global-search {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.albi-global-search__field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem 0.65rem 0.35rem 0.85rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.albi-global-search.is-open .albi-global-search__field {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
}

.albi-global-search__icon {
  flex-shrink: 0;
  color: #646970;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.albi-global-search__input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.45rem 0;
  margin: 0;
  color: var(--albi-text-color, #1d2327);
  caret-color: currentColor;
  cursor: text;
}

.albi-global-search__input::placeholder {
  color: #787c82;
}

.albi-global-search__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.albi-global-search__panel[hidden] {
  display: none !important;
}

.albi-global-search__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 100050;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dcdcde;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}

.albi-global-search__loading,
.albi-global-search__empty {
  padding: 1rem 1.15rem;
  font-size: 0.9rem;
  color: #646970;
  text-align: center;
}

.albi-global-search__results {
  padding: 0.25rem 0;
}

.albi-global-search__group + .albi-global-search__group {
  border-top: 1px solid #ececec;
}

.albi-global-search__group-title {
  padding: 0.55rem 1rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b0000;
}

.albi-global-search__list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem;
}

.albi-global-search__item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  text-decoration: none;
  color: #1d2327;
  transition: background 0.12s ease;
}

.albi-global-search__item:hover,
.albi-global-search__item:focus {
  background: #f6f7f7;
  outline: none;
}

.albi-global-search__thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.albi-global-search__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.albi-global-search__thumb--empty {
  background: linear-gradient(135deg, #e8e8e8, #f5f5f5);
}

.albi-global-search__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.albi-global-search__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  justify-content: space-between;
}

.albi-global-search__title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.albi-global-search__type {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #50575e;
  background: #f0f0f1;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.albi-global-search__excerpt {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #646970;
}

@media (max-width: 767px) {
  .albi-global-search__panel {
    max-height: 60vh;
  }
}
