/* Family tab */

.family-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.family-content-grid {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) 360px;
  gap: 20px;
  min-height: 0;
}

.family-side-column {
  display: grid;
  gap: 20px;
  align-content: start;
}

.family-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.family-card-header h3 {
  font-size: 22px;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.family-card-header p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.family-list {
  display: grid;
  gap: 14px;
}

.family-member-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fbfbff;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.family-member-card:hover,
.family-member-card.active {
  transform: translateY(-1px);
  border-color: rgba(91, 53, 245, 0.28);
  background: #ffffff;
}

.family-avatar {
  position: relative;
}

.family-avatar img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

.family-status-dot {
  position: absolute;
  right: 1px;
  bottom: 2px;
  width: 13px;
  height: 13px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--green);
}

.family-status-dot.traveling {
  background: var(--blue);
}

.family-status-dot.offline {
  background: #a8afc2;
}

.family-status-dot.help {
  background: #ef4444;
}

.family-member-main {
  min-width: 0;
}

.family-member-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.family-member-top strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-relationship {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.family-location {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #4d5773;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 7px;
}

.family-location i {
  color: var(--primary);
}

.family-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.family-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.family-meta-row i {
  color: #8a92aa;
}

.family-member-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.family-member-actions button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #ffffff;
  color: #66708f;
}

.family-member-actions button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.family-map-preview {
  height: 280px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% 20%, rgba(91, 53, 245, 0.14), transparent 28%),
    linear-gradient(135deg, #fbfbff, #f4f1ff);
  overflow: hidden;
  text-align: center;
}

.family-map-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.family-map-preview > div {
  padding: 24px;
}

.family-map-preview i {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #ffffff;
  color: var(--primary);
  font-size: 22px;
  box-shadow: var(--shadow-card);
}

.family-map-preview strong {
  display: block;
  margin-bottom: 7px;
}

.family-map-preview p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.family-activity-list {
  display: grid;
  gap: 12px;
}

.family-activity-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 17px;
  background: #fbfbff;
}

.family-activity-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}

.family-activity-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.family-activity-item p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.family-privacy-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 14px;
  background:
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 32%),
    #fbfffc;
}

.family-privacy-card > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: #eaf8ef;
  color: #138a41;
  font-size: 20px;
}

.family-privacy-card h3 {
  margin-bottom: 5px;
}

.family-privacy-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .family-content-grid {
    grid-template-columns: 1fr;
  }

  .family-side-column {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .family-privacy-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .family-dashboard-grid,
  .family-content-grid,
  .family-side-column {
    grid-template-columns: 1fr;
  }

  .family-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .family-member-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .family-avatar img {
    width: 52px;
    height: 52px;
  }

  .family-member-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .family-map-preview {
    height: 240px;
  }
}
/* Add family modal */

.family-add-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 20, 40, 0.42);
  backdrop-filter: blur(8px);
}

.family-add-modal-backdrop.active {
  display: flex;
}

.family-add-modal {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow-y: auto;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(24, 20, 70, 0.24);
}

.family-add-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.family-add-modal-header h2 {
  margin-bottom: 8px;
  font-size: 30px;
  letter-spacing: -0.05em;
}

.family-add-modal-header p {
  color: var(--text-muted);
  line-height: 1.5;
}

#closeAddFamilyModal {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  background: #f4f5fb;
  color: #66708f;
}

#closeAddFamilyModal:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.family-search-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.family-search-form label {
  color: #303854;
  font-size: 14px;
  font-weight: 900;
}

.family-search-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.family-search-input-group {
  height: 50px;
}

.family-search-results {
  display: grid;
  gap: 10px;
  max-height: 230px;
  overflow-y: auto;
  margin-bottom: 18px;
  padding-right: 4px;
}

.family-search-empty {
  padding: 16px;
  border-radius: 16px;
  background: #fbfbff;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.family-result-card {
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fbfbff;
  color: var(--text-main);
  text-align: left;
}

.family-result-card:hover,
.family-result-card.active {
  border-color: rgba(91, 53, 245, 0.32);
  background: var(--primary-soft);
}

.family-result-card img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.family-result-card strong,
.family-result-card small {
  display: block;
}

.family-result-card strong {
  margin-bottom: 3px;
}

.family-result-card small {
  color: var(--text-muted);
  font-size: 12px;
}

.family-result-card i {
  color: var(--primary);
}

.add-family-form {
  display: grid;
  gap: 16px;
}

.selected-family-profile {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border-radius: 18px;
  background: #fbfbff;
}

.selected-family-profile > span,
.selected-family-profile img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}

.selected-family-profile > span {
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 18px;
}

.selected-family-profile img {
  object-fit: cover;
}

.selected-family-profile strong {
  display: block;
  margin-bottom: 4px;
}

.selected-family-profile p {
  color: var(--text-muted);
  font-size: 13px;
}

.family-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #303854;
  font-size: 14px;
  font-weight: 800;
}

.family-checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.family-add-submit {
  justify-content: center;
  width: 100%;
}

@media (max-width: 620px) {
  .family-add-modal {
    padding: 22px;
  }

  .family-search-input-row {
    grid-template-columns: 1fr;
  }
}
.family-activity-button {
  width: 100%;
  border: none;
  text-align: left;
  cursor: pointer;
}

.family-activity-arrow {
  margin-left: auto;
  color: #9aa2ba;
  font-size: 12px;
}

.family-more-updates-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 0 14px;
  border-radius: 15px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
}

.family-more-updates-button span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.family-history-modal {
  max-height: min(720px, 88vh);
  overflow: hidden;
}

.family-history-list {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.family-history-item {
  display: grid;
  grid-template-columns: 44px 1fr 38px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fbfbff;
}

.family-history-icon,
.family-history-item a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
}

.family-history-item strong {
  display: block;
  margin-bottom: 4px;
}

.family-history-item p {
  margin: 0 0 5px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.family-history-item small {
  color: #8c92ab;
  font-size: 12px;
  font-weight: 800;
}