/* ============================================================
   Brief detail → Company tab → Corporate structure (pitchiq#828)
   Figma Evolve-Edge: component 316:11231 (Related companies 316:11230, Locations 316:11229), people-count popover
   617:25241, additional-location popover 617:25434, sheet content 622:2416. Values are Figma's; colours are the
   shell's tokens where they are equal.
   ============================================================ */

/* ---------- Card — 316:11231 ---------- */
.ebcc-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  border-radius: 20px;
  background: var(--evsh-white);
  box-shadow: 0 4px 8px 0 rgba(0, 32, 47, 0.1);   /* the prototype's card surface (pitchiq#908) */
  font-family: var(--evsh-font);
}
/* Header and view selector (prototype `.corporate-card > .subtabs`): a 54px row; its tabs are dark, medium until selected. */
.ebcc-tabs .ebci-subtab { gap: 4px; height: 54px; font-weight: 500; color: var(--evsh-neutral-1); }
.ebcc-tabs .ebci-subtab--selected { font-weight: 600; }

/* ---------- Panels — 285:10448 (related), 300:11070 (locations) ---------- */
.ebcc-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 24px 16px 12px;       /* prototype `.locations-panel` */
}
/* Related companies (prototype `.related-panel`): the list between 16px, closed by a rule; the View all bar 12px
   below, 16px in from the card like the list (pitchiq#914 item 5: 608 in the 640 card). */
.ebcc-panel--related { padding-top: 0; }

/* ---------- Icons: a 16px slot with the exported group at its Figma offset ---------- */
.ebcc-icon { position: relative; display: inline-block; flex: none; width: 16px; height: 16px; }
.ebcc-icon > img { position: absolute; display: block; max-width: none; }

/* ---------- Related companies — 622:2660 (preview), 622:2416 (sheet) ---------- */
.ebcc-companies { margin: 0; padding: 0; list-style: none; }
.ebcc-companies--preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--evsh-bg-light-blue);
}
.ebcc-companies--sheet { display: flex; flex-direction: column; align-items: stretch; }

.ebcc-company {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 36px;
  box-sizing: border-box;
}
.ebcc-companies--sheet .ebcc-company {
  padding: 14px 0;                 /* prototype `.related-company-sheet li` */
  border-bottom: 1px solid var(--evsh-bg-light-blue);
}
.ebcc-companies--sheet .ebcc-company:last-child { border-bottom: 0; }

.ebcc-company-details {
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.ebcc-company-name {                            /* subtitle/subtitle-3 */
  width: 100%;
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  color: var(--evsh-neutral-1);
  word-break: break-word;
}
.ebcc-company-location {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  margin-top: 2px;
}
.ebcc-company-location-text {                   /* body/body-4 */
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 18px;
  font-weight: 400;
  color: var(--evsh-neutral-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The "+N" badge (622:2678) is the shared Badge inside a focusable trigger. */
.ebcc-more { flex: none; }
.ebcc-more-trigger,
.ebcc-location-trigger {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: default;
}
.ebcc-more-trigger { border-radius: 6px; }
/* Prototype `.location-count`: 14px tall, radius 5, regular, on white (the Badge's inside stroke is its 1px border). */
.ebcc-more-trigger .evsh-badge { padding: 1px 4px; border-radius: 5px; background: var(--evsh-white); font-weight: 400; line-height: 12px; color: var(--evsh-neutral-blue-1); }
.ebcc-location-trigger { border-radius: 8px; }
.ebcc-more-trigger:focus-visible,
.ebcc-location-trigger:focus-visible { outline: 2px solid var(--evsh-blue-1); outline-offset: 1px; }

/* ---------- Location chip: Badge, Status=Default, Size=Large — 300:11077 (filled), 617:27443 (outlined) ---------- */
.evsh-badge.ebcc-chip {
  min-width: 24px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--evsh-neutral-blue-4);
  box-shadow: none;
  font-size: 14px;
  line-height: 16px;
  justify-content: center;
  text-align: center;
}
.evsh-badge.ebcc-chip--outlined {
  background: none;
  box-shadow: inset 0 0 0 1px var(--evsh-neutral-blue-3);
}

/* ---------- Locations by region — 300:11071 ---------- */
.ebcc-group {
  display: grid;
  grid-template-columns: 182px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--evsh-bg-light-blue);
}
.ebcc-group:last-child { padding-bottom: 0; border-bottom: 0; }
.ebcc-group-heading { display: flex; align-items: center; gap: 4px; }
.ebcc-group-label {                             /* body/body-3 */
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  color: var(--evsh-neutral-2);
  white-space: nowrap;
}
.ebcc-group-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ebcc-location { display: inline-flex; }

/* ---------- Popovers ---------- */
/* People count — 617:25241: 130px wide, the icon and the count only. */
.evsh-popover.ebcc-people-popover { width: 130px; }
.ebcc-people-popover .evsh-popover-content { display: none; }
/* Additional locations — 617:27409: 382px wide, wrapping chips 4px apart. */
.evsh-popover.ebcc-locations-popover { width: 382px; max-width: calc(100vw - 32px); }
.ebcc-popover-chips { display: flex; flex-wrap: wrap; align-items: center; align-content: center; gap: 4px; width: 100%; }

.ebcc-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ebcc-location--plain { position: relative; }

/* 700px and narrower (prototype; pitchiq#908): smaller records in the Related companies preview, 16 apart. */
@media (max-width: 700px) {
  /* Locations: the group's heading sits above its chips, so they keep the card's whole width (pitchiq#914 item 6). */
  .ebcc-group { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
  .ebcc-companies--preview { gap: 16px; }
  .ebcc-companies--preview .ebcc-company { gap: 6px; }
  .ebcc-companies--preview .ebci-avatar { width: 28px; height: 28px; }
  .ebcc-companies--preview .ebcc-company-name { font-size: 12px; }
  .ebcc-companies--preview .ebcc-company-location-text { max-width: 130px; font-size: 10px; }
}
