/* dot-button */
@scope (.dot-button) {
  :scope {
    width: 60px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 12px;
    cursor: pointer;
    flex-shrink: 0;

  }

  .dot {
    display: block;
    width: 12px;
    height: 12px;
    color: var(--color-on-surface);
    opacity: 0.25;
    transition: transform var(--dur-quick) ease-out,
                opacity var(--dur-quick) ease-out;
  }

  :scope:hover .dot {
    transform: scale(1.83);
    opacity: 1;
  }
}

/* bubble */
@scope (.bubble) {
  :scope {
    padding: 8px;
  }

  .bubble {
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.23;
    color: var(--color-on-surface);
  }

  .bubble--interviewer {
    background-color: var(--color-bubble-interviewer);
    margin-left: 50px;
    border-bottom-right-radius: 0;
  }

  .bubble--customer {
    background-color: var(--color-bubble-customer);
    margin-right: 50px;
    border-bottom-left-radius: 0;
  }

  .bubble--assistant {
    background-color: var(--color-bubble-assistant);
    margin-right: 50px;
    border-bottom-left-radius: 0;
  }
}

/* add-button */
@scope (.add-button) {
  :scope {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--dur-quick), border-radius var(--dur-quick);
  }

  .icon {
    width: 18px;
    height: 18px;
    color: var(--color-on-surface);
    opacity: 0.10;
    transition: width var(--dur-quick), height var(--dur-quick), opacity var(--dur-quick), transform var(--dur-quick), color var(--dur-quick);
  }

  .icon path { fill: currentColor; }

  :scope:hover .icon {
    width: 22px;
    height: 22px;
    opacity: 1;
  }

}

.add-button.add-button--active {
  background-color: var(--color-on-surface);
  border-radius: 8px;
}

.add-button.add-button--active .icon {
  width: 14px;
  height: 14px;
  color: var(--color-surface);
  opacity: 1;
  transform: rotate(45deg);
}

/* team (collapsed) */
.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  overflow: hidden;
}

.team__line {
  width: 4px;
  background-color: var(--color-on-surface);
  opacity: 0.10;
  border-radius: 2px;
}

.team__line--top    { height: 30px; }
.team__line--join   { height: 15px; }
.team__line--spacer { flex: 1; }

.team__avatar {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.team__avatar::before {
  content: "";
  width: 20px;
  height: 20px;
  background-color: var(--color-on-surface);
  border-radius: 6px;
  opacity: 0.25;
  transition: width var(--dur-base) ease, height var(--dur-base) ease,
              border-radius var(--dur-base) ease, opacity var(--dur-base) ease;
}

.team__avatar:hover::before {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  opacity: 1;
}

.team__avatar--settle::before {
  animation: avatar-settle var(--dur-base) ease both;
}

@keyframes avatar-settle {
  from {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    opacity: 1;
  }
}

/* member reveal (first open — exact reverse of closing) */
.member--reveal .bubble {
  animation: bubble-unfold var(--dur-base) ease both,
             text-reveal var(--dur-quick) var(--dur-base) ease both;
}

/* member quick (switching inside :team) */
.member--quick .bubble {
  animation: bubble-unfold var(--dur-base) ease both,
             text-reveal var(--dur-instant) var(--dur-quick) ease both;
}

/* member closing */
.member--closing .bubble {
  animation: text-hide var(--dur-quick) ease both,
             bubble-fold var(--dur-base) var(--dur-instant) ease both;
}

@keyframes bubble-unfold {
  from { max-height: 0; padding-top: 0; padding-bottom: 0; }
  to   { max-height: 300px; }
}

@keyframes bubble-fold {
  from { max-height: 300px; }
  to   { max-height: 0; padding-top: 0; padding-bottom: 0; }
}

@keyframes text-reveal {
  from { color: transparent; }
  to   { color: var(--color-surface); }
}

@keyframes text-hide {
  from { color: var(--color-surface); }
  to   { color: transparent; }
}

/* member (expanded) */
@scope (.member) {
  :scope {
    width: 100%;
    padding-bottom: 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
  }

  .avatar {
    width: 30px;
    height: 30px;
    background-color: var(--color-on-surface);
    border-radius: 8px;
    flex-shrink: 0;
  }

  .bubble {
    align-self: stretch;
    margin-top: -10px;
    padding: 29px 6px 30px 10px;
    background: color-mix(in srgb, var(--color-on-surface) 75%, transparent);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.47;
    letter-spacing: 0.12px;
    color: var(--color-surface);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }
}

/* thread-input */
@scope (.thread-input) {
  :scope {
    width: 100%;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .avatar {
    width: 30px;
    height: 30px;
    background-color: var(--color-on-surface);
    border-radius: 8px;
  }

  .bubble {
    align-self: stretch;
    padding: 10px 5px 8px 5px;
    background: color-mix(in srgb, var(--color-on-surface) 75%, transparent);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  textarea {
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.23;
    color: var(--color-surface);
    width: 100%;
    min-height: 40px;
  }

  textarea::placeholder { opacity: 0.5; }

  .actions {
    display: flex;
    justify-content: center;
    gap: 4px;
  }

  .btn {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--color-surface);
    opacity: 0.7;
  }

  .btn--save {
    opacity: 1;
    background: color-mix(in srgb, var(--color-surface) 20%, transparent);
  }
}

/* insights section header */
.insights-header {
  position: sticky;
  top: 0;
  background-color: var(--color-surface);
  padding: 15px 12px 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-on-surface);
  z-index: 1;
}

.insights-item {
  padding: 0 12px 10px 12px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-on-surface);
}

/* insights group-indicator */
.group-indicator {
  width: 3px;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--dur-quick) ease;
}

.group-indicator--visible {
  opacity: 1;
}

.group-indicator__segment {
  flex: 1;
  border-radius: 1.5px;
  background-color: color-mix(in srgb, var(--color-on-surface) 15%, transparent);
  transition: background-color var(--dur-quick) ease;
}

.group-indicator__segment--active {
  background-color: var(--color-on-surface);
}

/* insights layout row */
.insights-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.insights-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.insights-spacer {
  height: 100px;
}

/* settings panel */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-quick) ease;
}

.settings-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--color-surface, #fff);
  z-index: 201;
  padding: 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--dur-base) ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
}

.settings-panel--visible {
  transform: translateX(0);
}

/* settings panel content */
.settings__section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-on-surface);
}

.settings__options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.settings__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-on-surface);
}

.settings__option input[type="radio"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}

.settings__option-subtitle {
  font-size: 12px;
  color: var(--color-on-surface-variant);
  margin-left: auto;
}

.settings__close {
  margin-top: 24px;
  padding: 8px 16px;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--color-primary);
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-family);
}

.settings__close:hover {
  background: var(--color-primary-container);
}
