/* =============================================
   Contacts Modal — Matches pixel-perfect UI mockup
   ============================================= */

.contacts-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 32px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

.contacts-modal-container {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  width: 100%;
  max-width: 1440px;
  height: 100%;
  max-height: 920px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* ---- Sidebar ---- */
.contacts-sidebar {
  display: flex;
  flex-direction: column;
  padding: 32px 16px 32px 24px;
  border-right: 1px solid #f1f5f9;
  background: #ffffff;
  overflow-y: auto;
}

.contacts-sidebar-title {
  color: #0f172a;
  font-size: var(--gf-text-card);
  font-weight: var(--gf-weight-semibold);
  line-height: var(--gf-leading-card);
  padding: 0 8px;
  margin-bottom: 24px;
}

/* Category tabs */
.contacts-sidebar-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 32px;
}

.contacts-tab-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 999px; /* Pill shape */
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  text-align: left;
  cursor: pointer;
  transition:
    background 160ms cubic-bezier(0.2, 0, 0, 1),
    color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.contacts-tab-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.contacts-tab-btn.is-active {
  background: #eef2f6;
  color: #2966f4;
  font-weight: var(--gf-weight-semibold);
}

/* Filters */
.contacts-filters-title {
  color: #0f172a;
  font-size: var(--gf-text-body-strong);
  font-weight: var(--gf-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 8px;
  margin-bottom: 12px;
}

.contacts-filters {
  display: flex;
  flex-direction: column;
  /* The sidebar is narrow: space the shared filter selects like the old filter groups. */
  gap: 10px;
  padding: 0 4px;
}

/* The shared dropdown (assets/css/components/filter-select.css) sits in a 240px sidebar, so its
   option list is capped to keep every choice reachable inside the modal. */
.contacts-filters .gf-filter-select__menu {
  max-height: 320px;
}

.contacts-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.contacts-filter-group:last-child {
  border-bottom: none;
}

.contacts-filter-group label {
  color: #64748b;
  font-size: var(--gf-text-body-strong);
  font-weight: var(--gf-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.contacts-filter-select {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.contacts-filter-select select {
  width: 100%;
  padding: 4px 24px 4px 0;
  border: none;
  background: transparent;
  color: #0f172a;
  font-family: inherit;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-medium);
  appearance: none;
  outline: none;
  cursor: pointer;
}

.contacts-filter-select svg {
  position: absolute;
  right: 0;
  width: 14px;
  height: 14px;
  color: #64748b;
  pointer-events: none;
  flex-shrink: 0;
}

/* ---- Main area ---- */
.contacts-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
}

.contacts-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px 14px;
  background: #ffffff;
  flex-shrink: 0;
}

.contacts-main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.contacts-nav-link {
  border: none;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-medium);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px; /* Pill shape */
  transition:
    color 160ms cubic-bezier(0.2, 0, 0, 1),
    background 160ms cubic-bezier(0.2, 0, 0, 1);
  white-space: nowrap;
}

.contacts-nav-link:hover {
  color: #0f172a;
  background: #f8fafc;
}

.contacts-nav-link.is-active {
  color: #2966f4;
  font-weight: var(--gf-weight-semibold);
  background: #eef2f6;
}

.contacts-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 240px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: #f1f5f9;
  flex-shrink: 0;
}

.contacts-search-wrap svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #64748b;
}

.contacts-search-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #0f172a;
  font-family: inherit;
  font-size: var(--gf-text-body-strong);
  outline: none;
}

.contacts-search-wrap input::placeholder {
  color: #94a3b8;
}

/* ---- Body & Grid ---- */
.contacts-body {
  background: #f8fafc;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.contacts-description {
  padding: 24px 32px 4px;
  font-size: var(--gf-text-body);
  color: #475569;
  font-weight: var(--gf-weight-medium);
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 32px 32px;
  align-content: start;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  transition:
    transform 160ms cubic-bezier(0.2, 0, 0, 1),
    border-color 160ms cubic-bezier(0.2, 0, 0, 1),
    box-shadow 160ms cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
}

.contact-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.contact-card-avatar {
  position: relative;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-avatar-inner {
  position: relative;
  z-index: 2;
  width: 76%;
  height: 76%;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.contact-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.contact-card-avatar .avatar-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 7%));
  width: 135%;
  height: 135%;
  z-index: 1;
  pointer-events: none;
}

.contact-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.contact-card-name {
  color: #0f172a;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--gf-leading-body);
}

.contact-card-role {
  color: #64748b;
  font-size: var(--gf-text-body-strong);
  font-weight: var(--gf-weight-medium);
}

.contact-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.contact-card-btn-chat,
.contact-card-btn-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 160ms cubic-bezier(0.2, 0, 0, 1);
}

.contact-card-btn-chat:hover,
.contact-card-btn-more:hover {
  background: #f1f5f9;
}

.contact-card-btn-chat svg {
  width: 18px;
  height: 18px;
  color: #2966f4;
}

.contact-card-btn-more svg {
  width: 18px;
  height: 18px;
  color: #64748b;
}

/* ---- Card Dropdown Menu ---- */
.contacts-card-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 100;
  width: 170px;
  background: #ffffff;
  border: 1px solid #eef1f5;
  border-radius: 12px;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.contacts-card-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: #344054;
  font-family: inherit;
  font-size: var(--gf-text-control);
  font-weight: var(--gf-weight-medium);
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 160ms cubic-bezier(0.2, 0, 0, 1),
    color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.contacts-card-dropdown-item:hover {
  background: #f2f4f7;
  color: #101828;
}

.contacts-card-dropdown-item svg {
  color: #667085;
  flex-shrink: 0;
}

.contacts-card-dropdown-item:hover svg {
  color: #344054;
}

.contacts-card-dropdown-item.danger-action {
  color: #d92d20;
}

.contacts-card-dropdown-item.danger-action svg {
  color: #d92d20;
}

.contacts-card-dropdown-item.danger-action:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.contacts-card-dropdown-item.danger-action:hover svg {
  color: #b91c1c;
}

/* ---- Custom Select Dropdown ---- */
.contacts-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  font-family: inherit;
  font-size: var(--gf-text-body);
  font-weight: var(--gf-weight-medium);
  line-height: var(--gf-leading-body);
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
}

.contacts-select-trigger:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.contacts-select-trigger:focus {
  background: #ffffff;
  border-color: #2966f4;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.contacts-select-trigger svg {
  width: 16px;
  height: 16px;
  color: #64748b;
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1);
}

.contacts-select-trigger svg.rotate-180 {
  transform: rotate(180deg);
}

/* Floating Options Menu */
.contacts-select-options-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 4px 6px -2px rgba(0, 0, 0, 0.03);
  max-height: 200px;
  overflow-y: auto;
}

.contacts-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  font-family: inherit;
  font-size: var(--gf-text-body-strong);
  font-weight: var(--gf-weight-medium);
  text-align: left;
  cursor: pointer;
  transition:
    background 160ms cubic-bezier(0.2, 0, 0, 1),
    color 160ms cubic-bezier(0.2, 0, 0, 1);
}

.contacts-select-option:hover {
  background: #f2f4f7;
  color: #101828;
}

.contacts-select-option.is-active {
  background: #eef2f6;
  color: #2966f4;
  font-weight: var(--gf-weight-semibold);
}

.contacts-select-option .option-check {
  width: 14px;
  height: 14px;
  color: #2966f4;
}
