:host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: block;
  width: 500px;
  height: 650px;
  border-radius: 12px;
  box-shadow: var(--overlay-shadow);
  background-color: var(--card-bg-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.3s ease-in-out;
  transition-property: height, width;
  border: 1px solid var(--border-color);

  &.expanded {
    width: 80%;
    height: 90%;
  }
}

.ai-assistant-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ai-assistant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--background-color);

  .header-title {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .title-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  h2 {
    margin: 0;
    font-size: 1.2em;
    color: var(--text-primary);
  }

  .model-selector-container {
    display: flex;
    align-items: center;
    color: var(--text-secondary);

    select {
      padding-left: 6px;
      width: 100%;
      font-size: 0.8rem;
      height: 1.5rem;
    }
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .close-button,
  .expand-button {
    all: unset;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    font-size: 12px;
    border-radius: 50%;
    color: var(--text-secondary);

    &:hover {
      background-color: var(--button-active-bg-color);
      color: var(--text-primary);
    }
  }
}

.ai-assistant-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--card-bg-color);
}

.messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--text-primary);
}

.message {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 85%;
  word-wrap: break-word;

  &.user-message {
    background-color: var(--accent-blue);
    color: var(--text-on-status);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
  }

  &.model-message {
    background-color: var(--button-active-bg-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
  }
}

.input-container {
  display: flex;
  padding: 12px;
  border-top: 1px solid var(--border-color);
  gap: 8px;

  textarea {
    flex: 1;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-primary);
    border-radius: 18px;
    padding: 10px 14px;
    resize: none;
    font-family: inherit;
    font-size: 1em;
    line-height: 1.4;
    height: 45px;

    &:focus {
      outline: none;
      border-color: var(--accent-blue);
    }
  }

  button {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: var(--accent-blue);
    color: white;
    cursor: pointer;

    &:disabled {
      background-color: var(--text-secondary);
      cursor: not-allowed;
    }
  }
}
